diff options
author | Bongsu Jeon <bongsu.jeon@samsung.com> | 2020-12-13 18:58:50 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-29 13:45:00 +0100 |
commit | 0386f7a99b2c4a1fcb04106c69b9921bef2f7386 (patch) | |
tree | 25a4df4dc2c1c93c2e480727765ce4b6d14f67a5 | |
parent | bdf326bd9523695c85572d30b355e591be52bf42 (diff) | |
download | linux-rt-0386f7a99b2c4a1fcb04106c69b9921bef2f7386.tar.gz |
nfc: s3fwrn5: Release the nfc firmware
[ Upstream commit a4485baefa1efa596702ebffd5a9c760d42b14b5 ]
add the code to release the nfc firmware when the firmware image size is
wrong.
Fixes: c04c674fadeb ("nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip")
Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20201213095850.28169-1-bongsu.jeon@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/nfc/s3fwrn5/firmware.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c index 5f97da1947e3..e6ca1f9a7f63 100644 --- a/drivers/nfc/s3fwrn5/firmware.c +++ b/drivers/nfc/s3fwrn5/firmware.c @@ -304,8 +304,10 @@ static int s3fwrn5_fw_request_firmware(struct s3fwrn5_fw_info *fw_info) if (ret < 0) return ret; - if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) + if (fw->fw->size < S3FWRN5_FW_IMAGE_HEADER_SIZE) { + release_firmware(fw->fw); return -EINVAL; + } memcpy(fw->date, fw->fw->data + 0x00, 12); fw->date[12] = '\0'; |