Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
@ 2020-08-19 15:24 Alaa Hleihel
  2020-08-20 23:40 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alaa Hleihel @ 2020-08-19 15:24 UTC (permalink / raw)
  To: netdev; +Cc: davem, xiyou.wangcong, marcelo.leitner, Roi Dayan

tcf_ct_handle_fragments() shouldn't free the skb when ip_defrag() call
fails. Otherwise, we will cause a double-free bug.
In such cases, just return the error to the caller.

Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
 net/sched/act_ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index e6ad42b11835..2c3619165680 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -704,7 +704,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb,
 		err = ip_defrag(net, skb, user);
 		local_bh_enable();
 		if (err && err != -EINPROGRESS)
-			goto out_free;
+			return err;
 
 		if (!err) {
 			*defrag = true;
-- 
1.8.3.1


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

* Re: [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
  2020-08-19 15:24 [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow Alaa Hleihel
@ 2020-08-20 23:40 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-20 23:40 UTC (permalink / raw)
  To: alaa; +Cc: netdev, xiyou.wangcong, marcelo.leitner, roid

From: Alaa Hleihel <alaa@mellanox.com>
Date: Wed, 19 Aug 2020 18:24:10 +0300

> tcf_ct_handle_fragments() shouldn't free the skb when ip_defrag() call
> fails. Otherwise, we will cause a double-free bug.
> In such cases, just return the error to the caller.
> 
> Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
> Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>

Applied and queued up for -stable, thank you.

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

end of thread, other threads:[~2020-08-20 23:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 15:24 [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow Alaa Hleihel
2020-08-20 23:40 ` David Miller

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).