From: baker.kernel@gmail.com
To: davem@davemloft.net, herbert@gondor.hengli.com.au,
steffen.klassert@secunet.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Baker Zhang <Baker.kernel@gmail.com>
Subject: [PATCH v3 net-next] xfrm: Add check to prevent un-complete key manager
Date: Mon, 11 Nov 2013 14:39:11 +0800 [thread overview]
Message-ID: <1384151951-13549-1-git-send-email-baker.kernel@gmail.com> (raw)
In-Reply-To: <1384093556-8987-1-git-send-email-baker.kernel@gmail.com>
From: Baker Zhang <Baker.kernel@gmail.com>
"acquire" and "compile_policy" callbacks are necessary for a key manager.
Signed-off-by: Baker Zhang <Baker.kernel@gmail.com>
---
Thanks for all reply.
V1:
For current kernel source, there is no problem.
In our vpn product, we need a xfrm_km in kernel module
to monitor the xfrm state change.
thus, the 'acquire' and 'compile_policy' may be NULL.
So I think we should do the check before use it.
V2:
Align the continuation line according the networking coding style.
V3:
Add check to prevent un-complete key manager at register time.
net/xfrm/xfrm_state.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index b9c3f9e..178283e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1806,6 +1806,9 @@ static DEFINE_SPINLOCK(xfrm_km_lock);
int xfrm_register_km(struct xfrm_mgr *km)
{
+ if (km->acquire == NULL || km->compile_policy == NULL)
+ return -EINVAL;
+
spin_lock_bh(&xfrm_km_lock);
list_add_tail_rcu(&km->list, &xfrm_km_list);
spin_unlock_bh(&xfrm_km_lock);
--
1.8.3.2
WARNING: multiple messages have this Message-ID (diff)
From: baker.kernel@gmail.com
To: davem@davemloft.net, herbert@gondor.apana.org.au,
steffen.klassert@secunet.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Baker Zhang <Baker.kernel@gmail.com>
Subject: [PATCH v3 net-next] xfrm: Add check to prevent un-complete key manager
Date: Mon, 11 Nov 2013 14:39:11 +0800 [thread overview]
Message-ID: <1384151951-13549-1-git-send-email-baker.kernel@gmail.com> (raw)
In-Reply-To: <1384093556-8987-1-git-send-email-baker.kernel@gmail.com>
From: Baker Zhang <Baker.kernel@gmail.com>
"acquire" and "compile_policy" callbacks are necessary for a key manager.
Signed-off-by: Baker Zhang <Baker.kernel@gmail.com>
---
Thanks for all reply.
V1:
For current kernel source, there is no problem.
In our vpn product, we need a xfrm_km in kernel module
to monitor the xfrm state change.
thus, the 'acquire' and 'compile_policy' may be NULL.
So I think we should do the check before use it.
V2:
Align the continuation line according the networking coding style.
V3:
Add check to prevent un-complete key manager at register time.
net/xfrm/xfrm_state.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index b9c3f9e..178283e 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1806,6 +1806,9 @@ static DEFINE_SPINLOCK(xfrm_km_lock);
int xfrm_register_km(struct xfrm_mgr *km)
{
+ if (km->acquire == NULL || km->compile_policy == NULL)
+ return -EINVAL;
+
spin_lock_bh(&xfrm_km_lock);
list_add_tail_rcu(&km->list, &xfrm_km_list);
spin_unlock_bh(&xfrm_km_lock);
--
1.8.3.2
next prev parent reply other threads:[~2013-11-11 6:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-10 14:25 [PATCH net-next] xfrm: check function pointer of xfrm_mgr before use it baker.kernel
2013-11-10 19:03 ` Sergei Shtylyov
2013-11-10 23:31 ` [PATCH V2 " baker.kernel
2013-11-11 5:09 ` David Miller
2013-11-11 6:39 ` baker.kernel [this message]
2013-11-11 6:39 ` [PATCH v3 net-next] xfrm: Add check to prevent un-complete key manager baker.kernel
2013-11-11 7:11 ` Fan Du
2013-11-11 19:04 ` David Miller
2013-11-11 19:04 ` David Miller
2013-11-11 18:52 ` [PATCH net-next] xfrm: check function pointer of xfrm_mgr before use it Stephen Hemminger
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=1384151951-13549-1-git-send-email-baker.kernel@gmail.com \
--to=baker.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.