Skip to contentSkip to conversation

Patch "af_unix: don't append consumed skbs to sk_receive_queue" has been added to the 4.3-stable tree

PATCH [email protected] 1 participant 1 message Dec 11, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

af_unix: don't append consumed skbs to sk_receive_queue

to the 4.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
af_unix-don-t-append-consumed-skbs-to-sk_receive_queue.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Dec 11 11:38:06 EST 2015

From: Hannes Frederic Sowa <[email protected]>
Date: Mon, 16 Nov 2015 16:25:56 +0100
Subject: af_unix: don't append consumed skbs to sk_receive_queue

From: Hannes Frederic Sowa <[email protected]>

[ 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")
Cc Dmitry Vyukov <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 net/unix/af_unix.c |    1 +
 1 file changed, 1 insertion(+)
net/unix/af_unix.c +1 -0
@@ -1799,6 +1799,7 @@ alloc_skb:
 		 * this - does no harm
 		 */
 		consume_skb(newskb);
+		newskb = NULL;
 	}
 
 	if (skb_append_pagefrags(skb, page, offset, size)) {

Patches currently in stable-queue which might be from [email protected] are

queue-4.3/ipv6-add-complete-rcu-protection-around-np-opt.patch queue-4.3/ipv6-check-rt-dst.from-for-the-dst_nocache-route.patch queue-4.3/af-unix-passcred-support-for-sendpage.patch queue-4.3/af_unix-don-t-append-consumed-skbs-to-sk_receive_queue.patch queue-4.3/ipv6-avoid-creating-rtf_cache-from-a-rt-that-is-not-managed-by-fib6-tree.patch queue-4.3/net-scm-fix-pax-detected-msg_controllen-overflow-in-scm_detach_fds.patch queue-4.3/ipv6-check-expire-on-dst_nocache-route.patch queue-4.3/af-unix-fix-use-after-free-with-concurrent-readers-while-splicing.patch queue-4.3/ip_tunnel-disable-preemption-when-updating-per-cpu-tstats.patch queue-4.3/af_unix-take-receive-queue-lock-while-appending-new-skb.patch