diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2015-11-16 16:25:56 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-14 21:25:34 -0800 |
commit | 183e815485047e8efbc691884f2ac21c167af7f9 (patch) | |
tree | c29a9aa20f4f6fbb9c8bd42a94a3ce4afad9f8e9 /net/unix/af_unix.c | |
parent | 44fc75be78796cedd7d684ceba3ae15ed52c94d0 (diff) |
af_unix: don't append consumed skbs to sk_receive_queue
[ Upstream commit 8844f97238ca6c1ca92a5d6c69f53efd361a266f ]
In case multiple writes to a unix stream socket race we could end up in a
situation where we pre-allocate a new skb for use in unix_stream_sendpage
but have to free it again in the locked section because another skb
has been appended meanwhile, which we must use. Accidentally we didn't
clear the pointer after consuming it and so we touched freed memory
while appending it to the sk_receive_queue. So, clear the pointer after
consuming the skb.
This bug has been found with syzkaller
(http://github.com/google/syzkaller) by Dmitry Vyukov.
Fixes: 869e7c62486e ("net: af_unix: implement stream sendpage support")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index a5afe414a2d1..3e2ca39f3b68 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1799,6 +1799,7 @@ alloc_skb: * this - does no harm */ consume_skb(newskb); + newskb = NULL; } if (skb_append_pagefrags(skb, page, offset, size)) { |