Skip to contentSkip to conversation

Patch "net/llc: avoid BUG_ON() in skb_orphan()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Feb 23, 2017

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

net/llc: avoid BUG_ON() in skb_orphan()

to the 4.4-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:
net-llc-avoid-bug_on-in-skb_orphan.patch
and it can be found in the queue-4.4 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 Thu Feb 23 21:13:19 CET 2017

From: Eric Dumazet <[email protected]>
Date: Sun, 12 Feb 2017 14:03:52 -0800
Subject: net/llc: avoid BUG_ON() in skb_orphan()

From: Eric Dumazet <[email protected]>

[ Upstream commit 8b74d439e1697110c5e5c600643e823eb1dd0762 ]

It seems nobody used LLC since linux-3.12.

Fortunately fuzzers like syzkaller still know how to run this code, otherwise it would be no fun.

Setting skb->sk without skb->destructor leads to all kinds of bugs, we now prefer to be very strict about it.

Ideally here we would use skb_set_owner() but this helper does not exist yet, only CAN seems to have a private helper for that.

Fixes 376c7311bdb6 ("net: add a temporary sanity check in skb_orphan()")
---
 net/llc/llc_conn.c |    3 +++
 net/llc/llc_sap.c  |    3 +++
 2 files changed, 6 insertions(+)
net/llc/llc_conn.c +3 -0
@@ -821,7 +821,10 @@ void llc_conn_handler(struct llc_sap *sa
 		 * another trick required to cope with how the PROCOM state
 		 * machine works. -acme
 		 */
+		skb_orphan(skb);
+		sock_hold(sk);
 		skb->sk = sk;
+		skb->destructor = sock_efree;
 	}
 	if (!sock_owned_by_user(sk))
 		llc_conn_rcv(sk, skb);
net/llc/llc_sap.c +3 -0
@@ -290,7 +290,10 @@ static void llc_sap_rcv(struct llc_sap *
 
 	ev->type   = LLC_SAP_EV_TYPE_PDU;
 	ev->reason = 0;
+	skb_orphan(skb);
+	sock_hold(sk);
 	skb->sk = sk;
+	skb->destructor = sock_efree;
 	llc_sap_state_process(sap, skb);
 }
 

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

queue-4.4/dccp-fix-freeing-skb-too-early-for-ipv6_recvpktinfo.patch queue-4.4/ip-fix-ip_checksum-handling.patch queue-4.4/packet-fix-races-in-fanout_add.patch queue-4.4/packet-do-not-call-fanout_release-from-atomic-contexts.patch queue-4.4/net-llc-avoid-bug_on-in-skb_orphan.patch