[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180608.105311.1644703021787191738.davem@davemloft.net>
Date: Fri, 08 Jun 2018 10:53:11 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: pabeni@...hat.com
Cc: netdev@...r.kernel.org, tom@...ntonium.net, ktkhai@...tuozzo.com
Subject: Re: [PATCH net] kcm: fix races on sk_receive_queue
From: Paolo Abeni <pabeni@...hat.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.
Yeah, it's kind of ugly that kcm_recvmsg() is going to become a pile of
conditional operations based upon the peek boolean. :-/
Powered by blists - more mailing lists