]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
af_unix: don't append consumed skbs to sk_receive_queue
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Mon, 16 Nov 2015 15:25:56 +0000 (16:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Dec 2015 05:40:55 +0000 (21:40 -0800)
commita78f42950a48ed4f4721b29eb228d709ac91af9b
treef1f57cc40c5560ecb471dcebe0ad697e2405b806
parent382c8e80e40bcadb90ba1a156f522f7b5a22109f
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>
net/unix/af_unix.c