[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240923053900.1310-1-kdipendra88@gmail.com>
Date: Mon, 23 Sep 2024 05:38:58 +0000
From: Dipendra Khadka <kdipendra88@...il.com>
To: andrew@...n.ch,
florian.fainelli@...adcom.com,
davem@...emloft.net,
edumazet@...gle.com,
bcm-kernel-feedback-list@...adcom.com,
kuba@...nel.org,
pabeni@...hat.com
Cc: Dipendra Khadka <kdipendra88@...il.com>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 net] net: Add error pointer check in bcmsysport.c
Add error pointer checks in bcm_sysport_map_queues() and
bcm_sysport_unmap_queues() before deferencing 'dp'.
Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>
---
v2:
- Change the subject of the patch to net
v1: https://lore.kernel.org/all/20240922181739.50056-1-kdipendra88@gmail.com/
drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index c9faa8540859..97d2ff2329cb 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2337,6 +2337,9 @@ static int bcm_sysport_map_queues(struct net_device *dev,
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ if (IS_ERR(dp))
+ return PRT_ERR(dp);
+
/* We can't be setting up queue inspection for non directly attached
* switches
*/
@@ -2392,6 +2395,9 @@ static int bcm_sysport_unmap_queues(struct net_device *dev,
unsigned int num_tx_queues;
unsigned int q, qp, port;
+ if (IS_ERR(dp))
+ return PTR_ERR(dp);
+
port = dp->index;
num_tx_queues = slave_dev->real_num_tx_queues;
--
2.43.0
Powered by blists - more mailing lists