diff mbox series

net: dsa: qca8k: Add check for skb_copy

Message ID 20230710013907.43770-1-jiasheng@iscas.ac.cn (mailing list archive)
State Accepted
Commit 87355b7c3da9bfd81935caba0ab763355147f7b0
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: qca8k: Add check for skb_copy | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1341 this patch: 1341
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1364 this patch: 1364
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1364 this patch: 1364
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiasheng Jiang July 10, 2023, 1:39 a.m. UTC
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(+)

Comments

Pavan Chebbi July 10, 2023, 4:12 a.m. UTC | #1
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
>
>
patchwork-bot+netdevbpf@kernel.org July 10, 2023, 7:30 a.m. UTC | #2
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!
diff mbox series

Patch

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