be2iscsi: set the boot_kset pointer to NULL in case of failure
Subsystems (2)
PATCH 1/1 be2iscsi: set the boot_kset pointer to NULL in case of failure
In beiscsi_setup_boot_info(), the boot_kset pointer should be set to NULL in case of failure otherwise an invalid pointer dereference may occur later.
--- drivers/scsi/be2iscsi/be_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/be2iscsi/be_main.c +1 -0
@@ -4468,6 +4468,7 @@ put_shost:scsi_host_put (phba->shost); free_kset:iscsi_boot_destroy_kset (phba->boot_kset); + phba->boot_kset =NULL ;return -ENOMEM ; }
Signature · 1 line
Maurizio Lombardi
Quoted 5 lines · Maurizio Lombardi
In
beiscsi_setup_boot_info(), theboot_ksetpointer should be set to NULL in case of failure otherwise an invalid pointer dereference may occur later.Signed-off-by Maurizio Lombardi <[email protected]>
Btw, should this go to stable as well?
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:linux-scsi- [email protected]] On Behalf Of Maurizio Lombardi
Sent: Friday, March 04, 2016 3:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH] be2iscsi: set theboot_ksetpointer to NULL in case of
failure
Quoted 2 lines
In
beiscsi_setup_boot_info(), theboot_ksetpointer should be set to NULL
in case
Review
Quoted 8 lines
of failure otherwise an invalid pointer dereference may occur later.
Signed-off-by Maurizio Lombardi <[email protected]>---
drivers/scsi/be2iscsi/be_main.c| 1 +1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/drivers/scsi/be2iscsi/be_main.c
Quoted 11 lines
index cb9072a..069e5c5 100644
drivers/scsi/be2iscsi/be_main.c +0
-0@@ -4468,6 +4468,7 @@ put_shost:scsi_host_put (phba->shost);
free_kset:iscsi_boot_destroy_kset(phba->boot_kset);drivers/scsi/be2iscsi/be_main.c +1
-0+ phba->boot_kset =NULL ;return -ENOMEM; }
Quoted 5 lines
--
Maurizio Lombardi--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of
Quoted 2 lines
a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Thanks,
JB
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Maurizio" == Maurizio Lombardi <[email protected]> writes:
Maurizio,
Maurizio> In beiscsi_setup_boot_info(), the boot_kset pointer should be Maurizio> set to NULL in case of failure otherwise an invalid pointer Maurizio> dereference may occur later.
iscsi_boot_destroy_kset() checks before deref and the other use location just checks to see whether it's NULL. Are there places in the core iSCSI code that use this without checking?
No particular problem with your patch. Just trying to decide whether it's 4.5 material or not...
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 11 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Maurizio" == Maurizio Lombardi <[email protected]> writes:
Maurizio,
Maurizio> In
beiscsi_setup_boot_info(), theboot_ksetpointer should be Maurizio> set to NULL in case of failure otherwise an invalid pointer Maurizio> dereference may occur later.
iscsi_boot_destroy_kset()checks before deref and the other use location just checks to see whether it's NULL. Are there places in the core iSCSI code that use this without checking?
1) At the beginning of the beiscsi_setup_boot_info() function there is the following check:
----------
/* it has been created previously */
if (phba->boot_kset)
return 0;
----------
If the function fails and the boot_kset pointer is not set to NULL, subsequent calls to beiscsi_setup_boot_info() will incorrectly return success because it assumes that the boot_kset pointer is valid.
2) it is true that iscsi_boot_destroy_kset() checks whether the pointer is NULL or not, but it the kset has been already destroyed and the pointer is not set to NULL, then it will dereference an invalid pointer.
Regards,
Maurizio
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Maurizio" == Maurizio Lombardi <[email protected]> writes:
Maurizio> In beiscsi_setup_boot_info(), the boot_kset pointer should be Maurizio> set to NULL in case of failure otherwise an invalid pointer Maurizio> dereference may occur later.
Applied to 4.5/scsi-fixes.
Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering