From: Paolo Abeni <pabeni@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, tom@quantonium.net, ktkhai@virtuozzo.com
Subject: Re: [PATCH net] kcm: fix races on sk_receive_queue
Date: Fri, 08 Jun 2018 18:25:58 +0200 [thread overview]
Message-ID: <31934bf4ccf0f28c74266f9da72b9f2da21a7eff.camel@redhat.com> (raw)
In-Reply-To: <20180608.105311.1644703021787191738.davem@davemloft.net>
On Fri, 2018-06-08 at 10:53 -0400, David Miller wrote:
> From: Paolo Abeni <pabeni@redhat.com>
> Date: Wed, 6 Jun 2018 15:16:29 +0200
>
> > @@ -1126,7 +1132,7 @@ static int kcm_recvmsg(struct socket *sock, struct msghdr *msg,
> >
> > lock_sock(sk);
> >
> > - skb = kcm_wait_data(sk, flags, timeo, &err);
> > + skb = kcm_wait_data(sk, flags, peek, timeo, &err);
> > if (!skb)
> > goto out;
> >
>
> Because kcm_wait_data() potentially unlinks now, you will have to kfree the
> SKB in the error paths, for example if skb_copy_datagram_msg() fails.
>
> Otherwise we have an SKB leak.
Right. But now I fear the fix should be different: if we drop the skb
on skb_copy_datagram_msg() error, that will cause a behavior change. I
need to think more for a proper fix.
Thank you for the feedback.
Paolo
prev parent reply other threads:[~2018-06-08 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-06 13:16 [PATCH net] kcm: fix races on sk_receive_queue Paolo Abeni
2018-06-06 13:28 ` Kirill Tkhai
2018-06-06 13:46 ` Paolo Abeni
2018-06-08 14:53 ` David Miller
2018-06-08 16:25 ` Paolo Abeni [this message]
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=31934bf4ccf0f28c74266f9da72b9f2da21a7eff.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=ktkhai@virtuozzo.com \
--cc=netdev@vger.kernel.org \
--cc=tom@quantonium.net \
/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).