diff options
author | Jiasheng Jiang | 2023-07-10 09:39:07 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-07-23 13:49:24 +0200 |
commit | 89726b030373224de23192913774c00f49a07313 (patch) | |
tree | e42d303d143f86fae224946001e3987bb1a0a62a /drivers/net/dsa | |
parent | 436b7cc7eae7851c184b671ed7a4a64c750b86f7 (diff) |
net: dsa: qca8k: Add check for skb_copy
[ Upstream commit 87355b7c3da9bfd81935caba0ab763355147f7b0 ]
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 <jiasheng@iscas.ac.cn>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/qca/qca8k-8xxx.c | 3 |
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 7a6166a0c9bc..b3f798866899 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -469,6 +469,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 */ |