Commit 2b34e31b authored by Suganath Prabu S's avatar Suganath Prabu S Committed by Kelsey Skunberg

scsi: mpt3sas: Fix double free warnings

BugLink: https://bugs.launchpad.net/bugs/1885932

[ Upstream commit cbbfdb2a ]

Fix following warning from Smatch static analyser:

drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->hpr_lookup' double freed

drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->internal_lookup' double freed

Link: https://lore.kernel.org/r/20200508110738.30732-1-suganath-prabu.subramani@broadcom.comReported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSuganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent a65deebb
...@@ -3165,7 +3165,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) ...@@ -3165,7 +3165,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->scsi_lookup = NULL; ioc->scsi_lookup = NULL;
} }
kfree(ioc->hpr_lookup); kfree(ioc->hpr_lookup);
ioc->hpr_lookup = NULL;
kfree(ioc->internal_lookup); kfree(ioc->internal_lookup);
ioc->internal_lookup = NULL;
if (ioc->chain_lookup) { if (ioc->chain_lookup) {
for (i = 0; i < ioc->chain_depth; i++) { for (i = 0; i < ioc->chain_depth; i++) {
if (ioc->chain_lookup[i].chain_buffer) if (ioc->chain_lookup[i].chain_buffer)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment