Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alaa Hleihel <alaa@mellanox.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, xiyou.wangcong@gmail.com,
	marcelo.leitner@gmail.com, Roi Dayan <roid@mellanox.com>
Subject: [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
Date: Wed, 19 Aug 2020 18:24:10 +0300	[thread overview]
Message-ID: <20200819152410.1152049-1-alaa@mellanox.com> (raw)

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


             reply	other threads:[~2020-08-19 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 15:24 Alaa Hleihel [this message]
2020-08-20 23:40 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200819152410.1152049-1-alaa@mellanox.com \
    --to=alaa@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@mellanox.com \
    --cc=xiyou.wangcong@gmail.com \
    --subject='Re: [PATCH net] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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