public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aacraid: Fix potential null access
@ 2017-03-14 16:20 Raghava Aditya Renukunta
  2017-03-15 22:23 ` Dave Carroll
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Raghava Aditya Renukunta @ 2017-03-14 16:20 UTC (permalink / raw)
  To: jejb, martin.petersen, linux-scsi
  Cc: David.Carroll, Gana.Sridaran, Scott.Benesh, Tomas Henzl

Currently command threads fails to return ioctls commands for older
controller versions, since it returns when all the fibs have been
allocated. Another issue is even all the fibs have not been allocated,
the correct allocated fibs is not updated nor freed.

Fixes: 113156bcea9ef1e6 (scsi: aacraid: Reworked aac_command_thread)
Reported-by: Tomas Henzl <thezl@redhat.com>

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
---
 drivers/scsi/aacraid/commsup.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index a3ad042..c8172f1 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -2056,7 +2056,6 @@ static int fillup_pools(struct aac_dev *dev, struct hw_fib **hw_fib_pool,
 {
 	struct hw_fib **hw_fib_p;
 	struct fib **fib_p;
-	int rcode = 1;
 
 	hw_fib_p = hw_fib_pool;
 	fib_p = fib_pool;
@@ -2074,11 +2073,11 @@ static int fillup_pools(struct aac_dev *dev, struct hw_fib **hw_fib_pool,
 		}
 	}
 
+	/*
+	 * Get the actual number of allocated fibs
+	 */
 	num = hw_fib_p - hw_fib_pool;
-	if (!num)
-		rcode = 0;
-
-	return rcode;
+	return num;
 }
 
 static void wakeup_fibctx_threads(struct aac_dev *dev,
@@ -2186,7 +2185,6 @@ static void aac_process_events(struct aac_dev *dev)
 	struct fib *fib;
 	unsigned long flags;
 	spinlock_t *t_lock;
-	unsigned int rcode;
 
 	t_lock = dev->queues->queue[HostNormCmdQueue].lock;
 	spin_lock_irqsave(t_lock, flags);
@@ -2269,8 +2267,8 @@ static void aac_process_events(struct aac_dev *dev)
 		 * Fill up fib pointer pools with actual fibs
 		 * and hw_fibs
 		 */
-		rcode = fillup_pools(dev, hw_fib_pool, fib_pool, num);
-		if (!rcode)
+		num = fillup_pools(dev, hw_fib_pool, fib_pool, num);
+		if (!num)
 			goto free_mem;
 
 		/*
-- 
1.8.3.1

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

* RE: [PATCH] aacraid: Fix potential null access
  2017-03-14 16:20 [PATCH] aacraid: Fix potential null access Raghava Aditya Renukunta
@ 2017-03-15 22:23 ` Dave Carroll
  2017-03-15 22:55 ` Martin K. Petersen
  2017-03-15 23:02 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Carroll @ 2017-03-15 22:23 UTC (permalink / raw)
  To: Raghava Aditya Renukunta, jejb@linux.vnet.ibm.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org
  Cc: Gana Sridaran, Scott Benesh, Tomas Henzl

> -----Original Message-----
> From: Raghava Aditya Renukunta
> [mailto:RaghavaAditya.Renukunta@microsemi.com]
> Sent: Tuesday, March 14, 2017 10:20 AM
> To: jejb@linux.vnet.ibm.com; martin.petersen@oracle.com; linux-
> scsi@vger.kernel.org
> Cc: Dave Carroll; Gana Sridaran; Scott Benesh; Tomas Henzl
> Subject: [PATCH] aacraid: Fix potential null access
> 
> Currently command threads fails to return ioctls commands for older
> controller versions, since it returns when all the fibs have been allocated.
> Another issue is even all the fibs have not been allocated, the correct
> allocated fibs is not updated nor freed.
> 
> Fixes: 113156bcea9ef1e6 (scsi: aacraid: Reworked aac_command_thread)
> Reported-by: Tomas Henzl <thezl@redhat.com>
> 
> Signed-off-by: Raghava Aditya Renukunta
> <RaghavaAditya.Renukunta@microsemi.com>
> ---
>  drivers/scsi/aacraid/commsup.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>

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

* Re: [PATCH] aacraid: Fix potential null access
  2017-03-14 16:20 [PATCH] aacraid: Fix potential null access Raghava Aditya Renukunta
  2017-03-15 22:23 ` Dave Carroll
@ 2017-03-15 22:55 ` Martin K. Petersen
  2017-03-15 23:02 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-03-15 22:55 UTC (permalink / raw)
  To: Raghava Aditya Renukunta
  Cc: jejb, martin.petersen, linux-scsi, David.Carroll, Gana.Sridaran,
	Scott.Benesh, Tomas Henzl

Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> writes:

> Currently command threads fails to return ioctls commands for older
> controller versions, since it returns when all the fibs have been
> allocated. Another issue is even all the fibs have not been allocated,
> the correct allocated fibs is not updated nor freed.

Applied to 4.11/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] aacraid: Fix potential null access
  2017-03-14 16:20 [PATCH] aacraid: Fix potential null access Raghava Aditya Renukunta
  2017-03-15 22:23 ` Dave Carroll
  2017-03-15 22:55 ` Martin K. Petersen
@ 2017-03-15 23:02 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2017-03-15 23:02 UTC (permalink / raw)
  To: Raghava Aditya Renukunta
  Cc: jejb, martin.petersen, linux-scsi, David.Carroll, Gana.Sridaran,
	Scott.Benesh, Tomas Henzl

Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> writes:

> Reported-by: Tomas Henzl <thezl@redhat.com>

...and another mangled email address.

Fixed it up.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-03-15 23:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 16:20 [PATCH] aacraid: Fix potential null access Raghava Aditya Renukunta
2017-03-15 22:23 ` Dave Carroll
2017-03-15 22:55 ` Martin K. Petersen
2017-03-15 23:02 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox