public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH] route: put lwstate before freeing dst to avoid use after free
@ 2015-08-25 18:25 Sasha Levin
  2015-08-25 18:28 ` Thomas Graf
  2015-08-26 10:35 ` Jiri Benc
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2015-08-25 18:25 UTC (permalink / raw)
  To: davem; +Cc: jbenc, roopa, tgraf, netdev, linux-kernel, Sasha Levin

Commit 61adedf3 ("route: move lwtunnel state to dst_entry") is trying to
release lwstate after getting rid of dst, which causes a use-after-free
trying to access dst->lwstate.

Fixes: 61adedf3 ("route: move lwtunnel state to dst_entry")
Signed-off-by: Sasha Levin <sasha.levin@oracle•com>
---
 net/core/dst.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index 50dcdbb..477035e 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -262,11 +262,12 @@ again:
 	if (dst->dev)
 		dev_put(dst->dev);
 
+	lwtstate_put(dst->lwtstate);
+
 	if (dst->flags & DST_METADATA)
 		kfree(dst);
 	else
 		kmem_cache_free(dst->ops->kmem_cachep, dst);
-	lwtstate_put(dst->lwtstate);
 
 	dst = child;
 	if (dst) {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-26 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 18:25 [PATCH] route: put lwstate before freeing dst to avoid use after free Sasha Levin
2015-08-25 18:28 ` Thomas Graf
2015-08-26 10:35 ` Jiri Benc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox