Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net] Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit"
@ 2021-05-03  3:51 Xie He
  2021-05-03 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Xie He @ 2021-05-03  3:51 UTC (permalink / raw)
  To: Krzysztof Halasa, David S. Miller, Jakub Kicinski, Lv Yunlong,
	netdev, linux-kernel
  Cc: Xie He

This reverts commit 1b479fb80160
("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit").

1. This commit is incorrect. "__skb_pad" will NOT free the skb on
failure when its "free_on_error" parameter is "false".

2. This commit claims to fix my commit. But it didn't CC me??

Fixes: 1b479fb80160 ("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit")
Cc: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
---
 drivers/net/wan/hdlc_fr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 4d9dc7d15908..0720f5f92caa 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -415,7 +415,7 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
 
 		if (pad > 0) { /* Pad the frame with zeros */
 			if (__skb_pad(skb, pad, false))
-				goto out;
+				goto drop;
 			skb_put(skb, pad);
 		}
 	}
@@ -448,9 +448,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 
 drop:
-	kfree_skb(skb);
-out:
 	dev->stats.tx_dropped++;
+	kfree_skb(skb);
 	return NETDEV_TX_OK;
 }
 
-- 
2.27.0


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

* Re: [PATCH net] Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit"
  2021-05-03  3:51 [PATCH net] Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit" Xie He
@ 2021-05-03 20:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-03 20:40 UTC (permalink / raw)
  To: Xie He; +Cc: khc, davem, kuba, lyl2019, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun,  2 May 2021 20:51:36 -0700 you wrote:
> This reverts commit 1b479fb80160
> ("drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit").
> 
> 1. This commit is incorrect. "__skb_pad" will NOT free the skb on
> failure when its "free_on_error" parameter is "false".
> 
> 2. This commit claims to fix my commit. But it didn't CC me??
> 
> [...]

Here is the summary with links:
  - [net] Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit"
    https://git.kernel.org/netdev/net/c/d362fd0be456

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] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03  3:51 [PATCH net] Revert "drivers/net/wan/hdlc_fr: Fix a double free in pvc_xmit" Xie He
2021-05-03 20:40 ` patchwork-bot+netdevbpf

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git