From: Steffen Klassert <steffen.klassert@secunet.com>
To: Fan Du <fan.du@windriver.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCHv2 net-next 2/3] xfrm: export verify_userspi_info for pkfey and netlink interface
Date: Mon, 16 Dec 2013 10:39:59 +0100 [thread overview]
Message-ID: <20131216093958.GE31491@secunet.com> (raw)
In-Reply-To: <1387099194-18540-3-git-send-email-fan.du@windriver.com>
On Sun, Dec 15, 2013 at 05:19:53PM +0800, Fan Du wrote:
> diff --git a/net/key/af_key.c b/net/key/af_key.c
> index 545f047..7605d51 100644
> --- a/net/key/af_key.c
> +++ b/net/key/af_key.c
> @@ -1340,6 +1340,12 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, const struct sadb_
> max_spi = range->sadb_spirange_max;
> }
>
> + err = verify_spi_info(x->id.proto, min_spi, max_spi);
> + if (err) {
> + xfrm_state_put(x);
> + return err;
This line adds a trailing whitespace.
> + }
> +
> err = xfrm_alloc_spi(x, min_spi, max_spi);
> resp_skb = err ? ERR_PTR(err) : pfkey_xfrm_state2msg(x);
>
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index 68c2f35..d953639 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -1496,6 +1496,30 @@ u32 xfrm_get_acqseq(void)
> }
> EXPORT_SYMBOL(xfrm_get_acqseq);
>
> +int verify_spi_info(u8 proto, u32 min, u32 max)
> +{
> + switch (proto) {
> + case IPPROTO_AH:
> + case IPPROTO_ESP:
> + break;
> +
> + case IPPROTO_COMP:
> + /* IPCOMP spi is 16-bits. */
> + if (max >= 0x10000)
> + return -EINVAL;
> + break;
> +
> + default:
> + return -EINVAL;
> + }
This one too.
next prev parent reply other threads:[~2013-12-16 9:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-15 9:19 [PATCHv2 net-next 0/3] IPComp fixes Fan Du
2013-12-15 9:19 ` [PATCHv2 net-next 1/3] xfrm: check user specified spi for IPComp Fan Du
2013-12-15 9:19 ` [PATCHv2 net-next 2/3] xfrm: export verify_userspi_info for pkfey and netlink interface Fan Du
2013-12-16 9:39 ` Steffen Klassert [this message]
2013-12-15 9:19 ` [PATCHv2 net-next 3/3] xfrm: Add file to document IPsec corner case Fan Du
2013-12-16 9:46 ` Steffen Klassert
2013-12-16 9:58 ` Fan Du
2013-12-16 10:06 ` Steffen Klassert
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=20131216093958.GE31491@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=fan.du@windriver.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 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.