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


Groups > linux.kernel > #1213224 > unrolled thread

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

Started bySasha Levin <sasha.levin@oracle.com>
First post2015-08-25 20:30 +0200
Last post2015-08-26 12:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromSasha Levin <sasha.levin@oracle.com>
Date2015-08-25 20:30 +0200
Subject[PATCH] route: put lwstate before freeing dst to avoid use after free
Message-ID<q1r8S-68b-25@gated-at.bofh.it>
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/

[toc] | [next] | [standalone]


#1213227 — Re: [PATCH] route: put lwstate before freeing dst to avoid use after free

FromThomas Graf <tgraf@suug.ch>
Date2015-08-25 20:30 +0200
SubjectRe: [PATCH] route: put lwstate before freeing dst to avoid use after free
Message-ID<q1r8T-68b-59@gated-at.bofh.it>
In reply to#1213224
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>
--
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/

[toc] | [prev] | [next] | [standalone]


#1213722 — Re: [PATCH] route: put lwstate before freeing dst to avoid use after free

FromJiri Benc <jbenc@redhat.com>
Date2015-08-26 12:40 +0200
SubjectRe: [PATCH] route: put lwstate before freeing dst to avoid use after free
Message-ID<q1GhA-38h-21@gated-at.bofh.it>
In reply to#1213224
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
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web