scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
PATCH 1/1 scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
From: Stratos Psomadakis <[email protected]>
sym53c8xx_slave_destroy unconditionally assumes that sym53c8xx_slave_alloc has succesesfully allocated a sym_lcb. This can lead to a NULL pointer dereference (exposed by commit 4e6c82b).
---
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/scsi/sym53c8xx_2/sym_glue.c +4 -0
@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)struct sym_lcb *lp =sym_lp (tp, sdev->lun);unsigned long flags; +/* if slave_alloc returned before allocating a sym_lcb, return */ +if (!lp) +return ; +spin_lock_irqsave (np->s.host->host_lock, flags);if (lp->busy_itlq || lp->busy_itl) {
Signature · 1 line
1.7.8.rc1
Quoted 8 lines · On 12/04/2011 02:23 AM, [email protected] wrote:
From: Stratos Psomadakis <[email protected]>
sym53c8xx_slave_destroyunconditionally assumes thatsym53c8xx_slave_allochas succesesfully allocated asym_lcb. This can lead to a NULL pointer dereference (exposed by commit 4e6c82b).Signed-off-by Stratos Psomadakis <[email protected]>
Quoted 20 lines
---
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/scsi/sym53c8xx_2/sym_glue.c +4
-0@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)struct sym_lcb *lp =sym_lp (tp, sdev->lun);unsigned long flags; +/* if slave_alloc returned before allocating a sym_lcb, return */ +if (!lp) +return ; +spin_lock_irqsave (np->s.host->host_lock, flags);if (lp->busy_itlq || lp->busy_itl) {
Signature · 2 lines
Stratos Psomadakis <[email protected]>
Quoted 18 lines · On 12/04/2011 02:23 AM, [email protected] wrote:
From: Stratos Psomadakis <[email protected]>
sym53c8xx_slave_destroyunconditionally assumes thatsym53c8xx_slave_allochas succesesfully allocated asym_lcb. This can lead to a NULL pointer dereference (exposed by commit 4e6c82b).Signed-off-by Stratos Psomadakis <[email protected]>---
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/scsi/sym53c8xx_2/sym_glue.c +0
-0
drivers/scsi/sym53c8xx_2/sym_glue.c static void sym53c8xx_slave_destroy(struct scsi_device *sdev) · line 848
Quoted 10 lines
drivers/scsi/sym53c8xx_2/sym_glue.c +4
-0@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)struct sym_lcb *lp =sym_lp (tp, sdev->lun);unsigned long flags; +/* if slave_alloc returned before allocating a sym_lcb, return */ +if (!lp) +return ; +spin_lock_irqsave (np->s.host->host_lock, flags);if (lp->busy_itlq || lp->busy_itl) {
Any comments/ack/nack on the patch?
Thanks,
Signature · 2 lines
Stratos Psomadakis <[email protected]>
Quoted 18 lines · On 12/04/2011 02:23 AM, [email protected] wrote:
From: Stratos Psomadakis <[email protected]>
sym53c8xx_slave_destroyunconditionally assumes thatsym53c8xx_slave_allochas succesesfully allocated asym_lcb. This can lead to a NULL pointer dereference (exposed by commit 4e6c82b).Signed-off-by Stratos Psomadakis <[email protected]>---
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/scsi/sym53c8xx_2/sym_glue.c +0
-0
drivers/scsi/sym53c8xx_2/sym_glue.c static void sym53c8xx_slave_destroy(struct scsi_device *sdev) · line 848
Quoted 10 lines
drivers/scsi/sym53c8xx_2/sym_glue.c +4
-0@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)struct sym_lcb *lp =sym_lp (tp, sdev->lun);unsigned long flags; +/* if slave_alloc returned before allocating a sym_lcb, return */ +if (!lp) +return ; +spin_lock_irqsave (np->s.host->host_lock, flags);if (lp->busy_itlq || lp->busy_itl) {
resent (directly to the SCSI and sym53c8xx_2 maintainers)
Signature · 2 lines
Stratos Psomadakis <[email protected]>