linux-kernel.vger.kernel.org archive mirror
 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

* Re: [PATCH] route: put lwstate before freeing dst to avoid use after free
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Graf @ 2015-08-25 18:28 UTC (permalink / raw)
  To: Sasha Levin; +Cc: davem, jbenc, roopa, netdev, linux-kernel

On 08/25/15 at 02:25pm, Sasha Levin wrote:
> 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>

Acked-by: Thomas Graf <tgraf@suug.ch>

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

* Re: [PATCH] route: put lwstate before freeing dst to avoid use after free
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Benc @ 2015-08-26 10:35 UTC (permalink / raw)
  To: Sasha Levin; +Cc: davem, roopa, tgraf, netdev, linux-kernel

On Tue, 25 Aug 2015 14:25:14 -0400, Sasha Levin wrote:
> 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>

Already fixed by e252b3d1a174 in net-next.

 Jiri

-- 
Jiri Benc

^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).