From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: baker.kernel@gmail.com, herbert@gondor.apana.org.au,
davem@davemloft.net, steffen.klassert@secunet.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] xfrm: check function pointer of xfrm_mgr before use it
Date: Sun, 10 Nov 2013 23:03:19 +0400 [thread overview]
Message-ID: <527FD877.70909@cogentembedded.com> (raw)
In-Reply-To: <1384093556-8987-1-git-send-email-baker.kernel@gmail.com>
Hello.
On 10-11-2013 18:25, baker.kernel@gmail.com wrote:
> From: "baker.zhang" <baker.kernel@gmail.com>
> Signed-off-by: baker.zhang <baker.kernel@gmail.com>
> ---
> 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.
> net/xfrm/xfrm_state.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index b9c3f9e..541f684 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
[...]
> @@ -1783,10 +1785,12 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen
> err = -EINVAL;
> rcu_read_lock();
> list_for_each_entry_rcu(km, &xfrm_km_list, list) {
> - pol = km->compile_policy(sk, optname, data,
> - optlen, &err);
> - if (err >= 0)
> - break;
> + if (km->compile_policy) {
> + pol = km->compile_policy(sk, optname, data,
> + optlen, &err);
According the networking coding style, the continuation line should start
right under 'sk' on the previous line.
WBR, Sergei
next prev parent reply other threads:[~2013-11-10 19:03 UTC|newest]
Thread overview: 8+ 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 [this message]
2013-11-10 23:31 ` [PATCH V2 " baker.kernel
2013-11-11 5:09 ` David Miller
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 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=527FD877.70909@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=baker.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--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 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).