From: "Timo Teräs" <timo.teras@iki.fi>
To: netdev@vger.kernel.org,
"Justin P. Mattock" <justinmattock@gmail.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
"John W.Linville" <linville@tuxdriver.com>,
Linux Kernel Mailing List <l
Cc: "Timo Teräs" <timo.teras@iki.fi>
Subject: [PATCH] xfrm: check bundle policy existance before dereferencing it
Date: Thu, 24 Jun 2010 08:45:19 +0300 [thread overview]
Message-ID: <1277358319-9868-1-git-send-email-timo.teras@iki.fi> (raw)
In-Reply-To: <4C22805A.3080307@gmail.com>
Fix the bundle validation code to not assume having a valid policy.
When we have multiple transformations for a xfrm policy, the bundle
instance will be a chain of bundles with only the first one having
the policy reference. When policy_genid is bumped it will expire the
first bundle in the chain which is equivalent of expiring the whole
chain.
Reported-bisected-and-tested-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
net/xfrm/xfrm_policy.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4bf27d9..af1c173 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2300,7 +2300,8 @@ int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
return 0;
if (xdst->xfrm_genid != dst->xfrm->genid)
return 0;
- if (xdst->policy_genid != atomic_read(&xdst->pols[0]->genid))
+ if (xdst->num_pols > 0 &&
+ xdst->policy_genid != atomic_read(&xdst->pols[0]->genid))
return 0;
if (strict && fl &&
--
1.7.0.4
next prev parent reply other threads:[~2010-06-24 5:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTilf41JrFwN1veRDifNA78S2LQ6SO0g3YLOONd2W@mail.gmail.com>
[not found] ` <20100623141622.GC15205@tuxdriver.com>
2010-06-23 14:41 ` BUG: unable to handle kernel NULL pointer dereference at 00000000000000a0 Justin P. Mattock
2010-06-23 17:00 ` Justin P. Mattock
2010-06-23 17:29 ` Eric Dumazet
2010-06-23 18:10 ` Timo Teräs
2010-06-23 18:20 ` Justin P. Mattock
2010-06-23 20:34 ` Timo Teräs
2010-06-23 21:44 ` Justin P. Mattock
2010-06-24 5:45 ` Timo Teräs [this message]
2010-06-24 21:35 ` [PATCH] xfrm: check bundle policy existance before dereferencing it David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1277358319-9868-1-git-send-email-timo.teras@iki.fi \
--to=timo.teras@iki.fi \
--cc=eric.dumazet@gmail.com \
--cc=justinmattock@gmail.com \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).