aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiasheng Jiang <[email protected]>2023-07-10 09:39:07 +0800
committerDavid S. Miller <[email protected]>2023-07-10 08:21:53 +0100
commit87355b7c3da9bfd81935caba0ab763355147f7b0 (patch)
treeb5f683ae9391ab6ec7142bb47a1009f9f681d7a6
parent73c4d1b307aeb713e80ab03f90c7df9d417dc0f0 (diff)
net: dsa: qca8k: Add check for skb_copy
Add check for the return value of skb_copy in order to avoid NULL pointer dereference. Fixes: 2cd548566384 ("net: dsa: qca8k: add support for phy read/write with mgmt Ethernet") Signed-off-by: Jiasheng Jiang <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--drivers/net/dsa/qca/qca8k-8xxx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c
index f7d7cfb2fd86..09b80644c11b 100644
--- a/drivers/net/dsa/qca/qca8k-8xxx.c
+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
@@ -588,6 +588,9 @@ qca8k_phy_eth_busy_wait(struct qca8k_mgmt_eth_data *mgmt_eth_data,
bool ack;
int ret;
+ if (!skb)
+ return -ENOMEM;
+
reinit_completion(&mgmt_eth_data->rw_done);
/* Increment seq_num and set it in the copy pkt */