Skip to contentSkip to conversation

Patch "net: possible use after free in dst_release" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Jan 27, 2016

Subsystems (2)
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: possible use after free in dst_release

to the 3.14-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-possible-use-after-free-in-dst_release.patch
and it can be found in the queue-3.14 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 Tue Jan 26 22:23:35 PST 2016

From: Francesco Ruggeri <[email protected]>
Date: Wed, 6 Jan 2016 00:18:48 -0800
Subject: net: possible use after free in dst_release
Status: RO
Content-Length: 1116
Lines: 36

From: Francesco Ruggeri <[email protected]>

[ Upstream commit 07a5d38453599052aff0877b16bb9c1585f08609 ]

dst_release should not access dst->flags after decrementing __refcnt to 0. The dst_entry may be in dst_busy_list and dst_gc_task may dst_destroy it before dst_release gets a chance to access dst->flags.

Fixes d69bbf88c8d0 ("net: fix a race in dst_release()")
Fixes 27b75c95f10d ("net: avoid RCU for NOCACHE dst")
---
 net/core/dst.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/dst.c +2 -1
@@ -280,10 +280,11 @@ void dst_release(struct dst_entry *dst)
 {
 	if (dst) {
 		int newrefcnt;
+		unsigned short nocache = dst->flags & DST_NOCACHE;
 
 		newrefcnt = atomic_dec_return(&dst->__refcnt);
 		WARN_ON(newrefcnt < 0);
-		if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE))
+		if (!newrefcnt && unlikely(nocache))
 			call_rcu(&dst->rcu_head, dst_destroy_rcu);
 	}
 }

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

queue-3.14/net-possible-use-after-free-in-dst_release.patch