1 From cced5041ed5a2d1352186510944b0ddfbdbe4c0b Mon Sep 17 00:00:00 2001
2 From: Stratos Psomadakis <psomas@gentoo.org>
3 Date: Sun, 4 Dec 2011 02:23:54 +0200
4 Subject: [SCSI] sym53c8xx: Fix NULL pointer dereference in slave_destroy
6 From: Stratos Psomadakis <psomas@gentoo.org>
8 commit cced5041ed5a2d1352186510944b0ddfbdbe4c0b upstream.
10 sym53c8xx_slave_destroy unconditionally assumes that sym53c8xx_slave_alloc has
11 succesesfully allocated a sym_lcb. This can lead to a NULL pointer dereference
12 (exposed by commit 4e6c82b).
14 Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>
15 Signed-off-by: James Bottomley <JBottomley@Parallels.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19 drivers/scsi/sym53c8xx_2/sym_glue.c | 4 ++++
20 1 file changed, 4 insertions(+)
22 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c
23 +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
24 @@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(stru
25 struct sym_lcb *lp = sym_lp(tp, sdev->lun);
28 + /* if slave_alloc returned before allocating a sym_lcb, return */
32 spin_lock_irqsave(np->s.host->host_lock, flags);
34 if (lp->busy_itlq || lp->busy_itl) {