Skip to contentSkip to conversation

aacraid: Fix potential null access

PATCH Applied Raghava Aditya Renukunta 3 participants 4 messages Mar 14, 2017 – Mar 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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)
---
 drivers/scsi/aacraid/commsup.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/scsi/aacraid/commsup.c +6 -8
index a3ad042..c8172f1 100644
@@ -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;
 
 		/*
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines

-----Original Message-----
From: Raghava Aditya Renukunta [mailto:[email protected]]
Sent: Tuesday, March 14, 2017 10:20 AM
To: [email protected]; [email protected]; linux- [email protected]
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.

Quoted 9 lines
Fixes 113156bcea9ef1e6 (scsi: aacraid: Reworked aac_command_thread)

Signed-off-by: Raghava Aditya Renukunta
<[email protected]>

---
 drivers/scsi/aacraid/commsup.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
#2 lore raw
In reply to Raghava Aditya Renukunta
Quoted 4 lines · Raghava Aditya Renukunta

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.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering