Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213224

[PATCH] route: put lwstate before freeing dst to avoid use after free

From Sasha Levin <sasha.levin@oracle.com>
Newsgroups linux.kernel
Subject [PATCH] route: put lwstate before freeing dst to avoid use after free
Date 2015-08-25 20:30 +0200
Message-ID <q1r8S-68b-25@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] route: put lwstate before freeing dst to avoid use after free Sasha Levin <sasha.levin@oracle.com> - 2015-08-25 20:30 +0200
  Re: [PATCH] route: put lwstate before freeing dst to avoid use after  free Thomas Graf <tgraf@suug.ch> - 2015-08-25 20:30 +0200
  Re: [PATCH] route: put lwstate before freeing dst to avoid use  after free Jiri Benc <jbenc@redhat.com> - 2015-08-26 12:40 +0200

csiph-web