From: Paul Moore <paul@paul-moore.com>
To: Seif Mazareeb <seif@marvell.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"thomas.petazzoni@free-electrons.com"
<thomas.petazzoni@free-electrons.com>,
Dmitri Epshtein <dima@marvell.com>
Subject: Re: [PATCH 1/1] net: fix cipso packet validation when !NETLABEL
Date: Sat, 12 Oct 2013 07:57:27 -0400 [thread overview]
Message-ID: <2291823.ee0I8c00DA@olly> (raw)
In-Reply-To: <0DB595A2CB707F458400BE9663B6A72269C0047841@SC-VEXCH2.marvell.com>
On Friday, October 11, 2013 2:04:10 PM Seif Mazareeb wrote:
> When CONFIG_NETLABEL is disabled, the cipso_v4_validate() function could
> loop forever in the main loop if opt[opt_iter +1] == 0, this will causing a
> kernel crash in an SMP system, since the CPU executing this function will
> stall /not respond to IPIs.
>
> This problem can be reproduced by running the IP Stack Integrity Checker
> (http://isic.sourceforge.net) using the following command on a Linux machine
> connected to DUT:
>
> "icmpsic -s rand -d <DUT IP address> -r 123456"
> wait (1-2 min)
>
> Signed-off-by: Seif Mazareeb <seif@marvell.com>
> ---
> include/net/cipso_ipv4.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
> index a7a683e..286b7da 100644
> --- a/include/net/cipso_ipv4.h
> +++ b/include/net/cipso_ipv4.h
> @@ -290,6 +290,7 @@ static inline int cipso_v4_validate(const struct sk_buff
> *skb, unsigned char err_offset = 0;
> u8 opt_len = opt[1];
> u8 opt_iter;
> + u8 tag_len;
>
> if (opt_len < 8) {
> err_offset = 1;
> @@ -302,7 +303,8 @@ static inline int cipso_v4_validate(const struct sk_buff
> *skb, }
>
> for (opt_iter = 6; opt_iter < opt_len;) {
> - if (opt[opt_iter + 1] > (opt_len - opt_iter)) {
> + tag_len = opt[opt_iter + 1];
> + if ((tag_len == 0) || (opt[opt_iter + 1] > (opt_len -
> opt_iter))) { err_offset = opt_iter + 1;
> goto out;
> }
You should also use 'tag_len' inside the for-loop, and after the if-block,
where we increment 'opt_iter'. See my original reply for an example.
--
paul moore
www.paul-moore.com
next prev parent reply other threads:[~2013-10-12 11:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 17:58 [PATCH 1/1] net: fix cipso packet validation when !NETLABEL Seif Mazareeb
2013-10-11 19:02 ` Paul Moore
2013-10-11 21:04 ` Seif Mazareeb
2013-10-12 11:57 ` Paul Moore [this message]
2013-10-13 5:21 ` Seif Mazareeb
2013-10-14 15:12 ` Paul Moore
2013-10-17 19:47 ` David Miller
2013-10-18 1:20 ` Paul Moore
-- strict thread matches above, loose matches on Subject: below --
2013-10-18 3:33 Seif Mazareeb
2013-10-18 21:01 ` Paul Moore
2013-10-19 22:56 ` David Miller
[not found] <0DB595A2CB707F458400BE9663B6A72269C004777F@SC-VEXCH2.marvell.com>
2013-10-11 17:53 ` 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=2291823.ee0I8c00DA@olly \
--to=paul@paul-moore.com \
--cc=davem@davemloft.net \
--cc=dima@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=seif@marvell.com \
--cc=thomas.petazzoni@free-electrons.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).