linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
@ 2011-12-04  0:23 psomas
  2011-12-04 17:38 ` Stratos Psomadakis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: psomas @ 2011-12-04  0:23 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, stable, JBottomley, matthew, Martin.vGagern

From: Stratos Psomadakis <psomas@gentoo.org>

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).

Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>
Cc: stable@vger.kernel.org
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index b4543f5..76432f8 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -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) {
-- 
1.7.8.rc1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
  2011-12-04  0:23 [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy psomas
@ 2011-12-04 17:38 ` Stratos Psomadakis
  2011-12-08 21:15 ` Stratos Psomadakis
  2011-12-24  1:20 ` Stratos Psomadakis
  2 siblings, 0 replies; 5+ messages in thread
From: Stratos Psomadakis @ 2011-12-04 17:38 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, stable, JBottomley, matthew, Martin.vGagern

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

On 12/04/2011 02:23 AM, psomas@gentoo.org wrote:
> From: Stratos Psomadakis <psomas@gentoo.org>
>
> 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).
>
> Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>
> Cc: stable@vger.kernel.org
Reported-by:  Martin von Gagern <Martin.vGagern@gmx.net>
Tested-by: Martin von Gagern <Martin.vGagern@gmx.net>

> ---
>
>  drivers/scsi/sym53c8xx_2/sym_glue.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
> index b4543f5..76432f8 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_glue.c
> +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
> @@ -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) {
-- 
Stratos Psomadakis
<psomas@gentoo.org>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
  2011-12-04  0:23 [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy psomas
  2011-12-04 17:38 ` Stratos Psomadakis
@ 2011-12-08 21:15 ` Stratos Psomadakis
  2011-12-24  1:20 ` Stratos Psomadakis
  2 siblings, 0 replies; 5+ messages in thread
From: Stratos Psomadakis @ 2011-12-08 21:15 UTC (permalink / raw)
  To: linux-scsi; +Cc: linux-kernel, stable, JBottomley, matthew, Martin.vGagern

On 12/04/2011 02:23 AM, psomas@gentoo.org wrote:
> From: Stratos Psomadakis <psomas@gentoo.org>
>
> 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).
>
> Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>
> Cc: stable@vger.kernel.org
> ---
>
>  drivers/scsi/sym53c8xx_2/sym_glue.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
> index b4543f5..76432f8 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_glue.c
> +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
> @@ -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,

-- 
Stratos Psomadakis
<psomas@gentoo.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
@ 2011-12-19 22:57 Chris Pitzel
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Pitzel @ 2011-12-19 22:57 UTC (permalink / raw)
  To: linux-scsi

>On 12/04/2011 02:23 AM, psomas@gentoo.org wrote:

>> From: Stratos Psomadakis <psomas@gentoo.org>

>> 

>> 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).

>> 

>> Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>

>> Cc: stable@vger.kernel.org

>> ---

>> 

>>  drivers/scsi/sym53c8xx_2/sym_glue.c |    4 ++++

>>  1 files changed, 4 insertions(+), 0 deletions(-)

>> 

>> diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c
b/drivers/scsi/sym53c8xx_2/sym_glue.c

>> index b4543f5..76432f8 100644

>> --- a/drivers/scsi/sym53c8xx_2/sym_glue.c

>> +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c

>> @@ -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?

 

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy
  2011-12-04  0:23 [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy psomas
  2011-12-04 17:38 ` Stratos Psomadakis
  2011-12-08 21:15 ` Stratos Psomadakis
@ 2011-12-24  1:20 ` Stratos Psomadakis
  2 siblings, 0 replies; 5+ messages in thread
From: Stratos Psomadakis @ 2011-12-24  1:20 UTC (permalink / raw)
  To: JBottomley, matthew, James.Bottomley
  Cc: linux-scsi, linux-kernel, stable, Martin.vGagern, kernel

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

On 12/04/2011 02:23 AM, psomas@gentoo.org wrote:
> From: Stratos Psomadakis <psomas@gentoo.org>
>
> 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).
>
> Signed-off-by: Stratos Psomadakis <psomas@gentoo.org>
> Cc: stable@vger.kernel.org
> ---
>
>  drivers/scsi/sym53c8xx_2/sym_glue.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
> index b4543f5..76432f8 100644
> --- a/drivers/scsi/sym53c8xx_2/sym_glue.c
> +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
> @@ -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)

-- 
Stratos Psomadakis
<psomas@gentoo.org>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-24  1:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-04  0:23 [PATCH] scsi/sym53c8xx_2: Fix NULL pointer dereference in slave_destroy psomas
2011-12-04 17:38 ` Stratos Psomadakis
2011-12-08 21:15 ` Stratos Psomadakis
2011-12-24  1:20 ` Stratos Psomadakis
  -- strict thread matches above, loose matches on Subject: below --
2011-12-19 22:57 Chris Pitzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).