All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX
@ 2026-06-12  3:56 Ruoyu Wang
  2026-06-12  7:49 ` Loic Poulain
  2026-06-13 17:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ruoyu Wang @ 2026-06-12  3:56 UTC (permalink / raw)
  To: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Loic Poulain, Sergey Ryazanov, Johannes Berg
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, Ruoyu Wang

t7xx_port_ctrl_tx() clones each skb fragment before passing it to the
port transmit path. The clone is used immediately to set cloned->len, so
an skb_clone() failure results in a NULL pointer dereference.

Check the clone before using it. If previous fragments were already
queued, preserve the driver's existing partial-write behavior by
returning the number of bytes submitted so far.

Fixes: 36bd28c1cb0d ("wwan: core: Support slicing in port TX flow of WWAN subsystem")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
Changes in v3:
- Preserve the partial-write return value when skb_clone() fails after
  earlier fragments were submitted.

Changes in v2:
- Add Fixes tag.
- Return -ENOMEM consistently on skb_clone() failure.

 drivers/net/wwan/t7xx/t7xx_port_wwan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wwan/t7xx/t7xx_port_wwan.c b/drivers/net/wwan/t7xx/t7xx_port_wwan.c
index 7fc569565..d2529df75 100644
--- a/drivers/net/wwan/t7xx/t7xx_port_wwan.c
+++ b/drivers/net/wwan/t7xx/t7xx_port_wwan.c
@@ -106,6 +106,8 @@ static int t7xx_port_ctrl_tx(struct t7xx_port *port, struct sk_buff *skb)
 
 	while (cur) {
 		cloned = skb_clone(cur, GFP_KERNEL);
+		if (!cloned)
+			return cnt ? cnt : -ENOMEM;
 		cloned->len = skb_headlen(cur);
 		ret = t7xx_port_send_skb(port, cloned, 0, 0);
 		if (ret) {
-- 
2.51.0


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

* Re: [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX
  2026-06-12  3:56 [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX Ruoyu Wang
@ 2026-06-12  7:49 ` Loic Poulain
  2026-06-13 17:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2026-06-12  7:49 UTC (permalink / raw)
  To: Ruoyu Wang
  Cc: Chandrashekar Devegowda, Liu Haijun, Ricardo Martinez,
	Sergey Ryazanov, Johannes Berg, Andrew Lunn, davem, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Fri, Jun 12, 2026 at 5:56 AM Ruoyu Wang <ruoyuw560@gmail.com> wrote:
>
> t7xx_port_ctrl_tx() clones each skb fragment before passing it to the
> port transmit path. The clone is used immediately to set cloned->len, so
> an skb_clone() failure results in a NULL pointer dereference.
>
> Check the clone before using it. If previous fragments were already
> queued, preserve the driver's existing partial-write behavior by
> returning the number of bytes submitted so far.
>
> Fixes: 36bd28c1cb0d ("wwan: core: Support slicing in port TX flow of WWAN subsystem")
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>

Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>

> ---
> Changes in v3:
> - Preserve the partial-write return value when skb_clone() fails after
>   earlier fragments were submitted.
>
> Changes in v2:
> - Add Fixes tag.
> - Return -ENOMEM consistently on skb_clone() failure.
>
>  drivers/net/wwan/t7xx/t7xx_port_wwan.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wwan/t7xx/t7xx_port_wwan.c b/drivers/net/wwan/t7xx/t7xx_port_wwan.c
> index 7fc569565..d2529df75 100644
> --- a/drivers/net/wwan/t7xx/t7xx_port_wwan.c
> +++ b/drivers/net/wwan/t7xx/t7xx_port_wwan.c
> @@ -106,6 +106,8 @@ static int t7xx_port_ctrl_tx(struct t7xx_port *port, struct sk_buff *skb)
>
>         while (cur) {
>                 cloned = skb_clone(cur, GFP_KERNEL);
> +               if (!cloned)
> +                       return cnt ? cnt : -ENOMEM;
>                 cloned->len = skb_headlen(cur);
>                 ret = t7xx_port_send_skb(port, cloned, 0, 0);
>                 if (ret) {
> --
> 2.51.0
>

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

* Re: [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX
  2026-06-12  3:56 [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX Ruoyu Wang
  2026-06-12  7:49 ` Loic Poulain
@ 2026-06-13 17:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-13 17:50 UTC (permalink / raw)
  To: Ruoyu Wang
  Cc: chandrashekar.devegowda, haijun.liu, ricardo.martinez,
	loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem,
	edumazet, kuba, pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 12 Jun 2026 11:56:13 +0800 you wrote:
> t7xx_port_ctrl_tx() clones each skb fragment before passing it to the
> port transmit path. The clone is used immediately to set cloned->len, so
> an skb_clone() failure results in a NULL pointer dereference.
> 
> Check the clone before using it. If previous fragments were already
> queued, preserve the driver's existing partial-write behavior by
> returning the number of bytes submitted so far.
> 
> [...]

Here is the summary with links:
  - [net,v3] net: wwan: t7xx: check skb_clone in control TX
    https://git.kernel.org/netdev/net/c/05f789fa90d9

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:[~2026-06-13 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  3:56 [PATCH net v3] net: wwan: t7xx: check skb_clone in control TX Ruoyu Wang
2026-06-12  7:49 ` Loic Poulain
2026-06-13 17:50 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.