netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: qca8k: Add check for skb_copy
@ 2023-07-10  1:39 Jiasheng Jiang
  2023-07-10  4:12 ` Pavan Chebbi
  2023-07-10  7:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2023-07-10  1:39 UTC (permalink / raw)
  To: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
	ansuelsmth, rmk+kernel
  Cc: netdev, linux-kernel, Jiasheng Jiang

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>
---
 drivers/net/dsa/qca/qca8k-8xxx.c | 3 +++
 1 file changed, 3 insertions(+)

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 */
-- 
2.25.1


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

* Re: [PATCH] net: dsa: qca8k: Add check for skb_copy
  2023-07-10  1:39 [PATCH] net: dsa: qca8k: Add check for skb_copy Jiasheng Jiang
@ 2023-07-10  4:12 ` Pavan Chebbi
  2023-07-10  7:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Pavan Chebbi @ 2023-07-10  4:12 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
	ansuelsmth, rmk+kernel, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

On Mon, Jul 10, 2023 at 7:09 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> 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>
> ---
>  drivers/net/dsa/qca/qca8k-8xxx.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Looks good to me.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>

> 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 */
> --
> 2.25.1
>
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH] net: dsa: qca8k: Add check for skb_copy
  2023-07-10  1:39 [PATCH] net: dsa: qca8k: Add check for skb_copy Jiasheng Jiang
  2023-07-10  4:12 ` Pavan Chebbi
@ 2023-07-10  7:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-10  7:30 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: andrew, f.fainelli, olteanv, davem, edumazet, kuba, pabeni,
	ansuelsmth, rmk+kernel, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Mon, 10 Jul 2023 09:39:07 +0800 you wrote:
> 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>
> ---
>  drivers/net/dsa/qca/qca8k-8xxx.c | 3 +++
>  1 file changed, 3 insertions(+)

Here is the summary with links:
  - net: dsa: qca8k: Add check for skb_copy
    https://git.kernel.org/netdev/net/c/87355b7c3da9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-07-10  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-10  1:39 [PATCH] net: dsa: qca8k: Add check for skb_copy Jiasheng Jiang
2023-07-10  4:12 ` Pavan Chebbi
2023-07-10  7:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).