From: Cong Wang <xiyou.wangcong@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Mohit Bhasi <mohitbhasi1998@gmail.com>,
"Mohit P. Tahiliani" <tahiliani@nitk.edu.in>,
"V. Saicharan" <vsaicharan1998@gmail.com>,
Gautam Ramakrishnan <gautamramk@gmail.com>,
Linux Kernel Network Developers <netdev@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] net: sched: prevent a use after free
Date: Sat, 1 Feb 2020 11:38:43 -0800 [thread overview]
Message-ID: <CAM_iQpUYv9vEVpYc-WfMNfCc9QaBzmTYs66-GEfwOKiqOXHxew@mail.gmail.com> (raw)
In-Reply-To: <20200131065647.joonbg3wzcw26x3b@kili.mountain>
On Thu, Jan 30, 2020 at 10:57 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The code calls kfree_skb(skb); and then re-uses "skb" on the next line.
> Let's re-order these lines to solve the problem.
>
> Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> net/sched/sch_fq_pie.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_fq_pie.c b/net/sched/sch_fq_pie.c
> index bbd0dea6b6b9..78472e0773e9 100644
> --- a/net/sched/sch_fq_pie.c
> +++ b/net/sched/sch_fq_pie.c
> @@ -349,9 +349,9 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,
> while (sch->q.qlen > sch->limit) {
> struct sk_buff *skb = fq_pie_qdisc_dequeue(sch);
>
> - kfree_skb(skb);
> len_dropped += qdisc_pkt_len(skb);
> num_dropped += 1;
> + kfree_skb(skb);
Or even better: use rtnl_kfree_skbs().
Thanks.
next prev parent reply other threads:[~2020-02-01 19:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 6:56 [PATCH net] net: sched: prevent a use after free Dan Carpenter
2020-02-01 19:38 ` Cong Wang [this message]
2020-02-03 8:38 ` Dan Carpenter
2020-02-03 19:58 ` Cong Wang
2020-02-03 20:33 ` Cong Wang
2020-02-05 11:53 ` [PATCH v2 " Dan Carpenter
2020-02-05 18:03 ` Cong Wang
2020-02-06 13:01 ` 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=CAM_iQpUYv9vEVpYc-WfMNfCc9QaBzmTYs66-GEfwOKiqOXHxew@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=gautamramk@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=mohitbhasi1998@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tahiliani@nitk.edu.in \
--cc=vsaicharan1998@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).