scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
Quoted 7 lines · On 12/04/2011 02:23 AM, [email protected] wrote:
Quoted 6 lines
From: Stratos Psomadakis <[email protected]>
sym53c8xx_slave_destroyunconditionally assumes that
sym53c8xx_slave_alloc has
Quoted 1 line
Quoted 1 line
succesesfully allocated a
sym_lcb. This can lead to a NULL pointer
dereference
Quoted 12 lines
Quoted 11 lines
(exposed by commit 4e6c82b).
Signed-off-by Stratos Psomadakis <[email protected]>---
Quoted 7 lines
Review
Quoted 7 lines
drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/drivers/scsi/sym53c8xx_2/sym_glue.c
Quoted 7 lines
Review static void sym53c8xx_slave_destroy(struct
Quoted 7 lines
index b4543f5..76432f8 100644
---
a/drivers/scsi/sym53c8xx_2/sym_glue.c+++
b/drivers/scsi/sym53c8xx_2/sym_glue.c(quoted diff) +0
-0@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct
scsi_device *sdev)
Quoted 14 lines
Quoted 13 lines
(quoted diff) +4
-0struct sym_lcb *lp = sym_lp(tp, sdev->lun); unsigned long flags; + /* if slave_alloc returned before allocating a sym_lcb, return */ + if (!lp) + return; +
Quoted 7 lines
Quoted 5 lines
spin_lock_irqsave(np->s.host->host_lock, flags); if (lp->busy_itlq || lp->busy_itl) {Any comments/ack/nack on the patch?
Applied it to 3.1.3, 3.1.4, 3.1.5, and 3.2-rc6. Previously loading sym53c8xx (with my sym53c875 card) would cause a kernel panic during bootup (worked fine on 3.1.0, 3.1.1, and the 2.6.x kernels, was sort of broken in 3.1.2, and panic'ed in 3.1.3-onwards). Now I can boot just fine!
Thank you very much!
Chris