From: jamal <hadi@cyberus.ca>
To: Changli Gao <xiaosuo@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] cls_rsvp: add sanity check for the packet length
Date: Wed, 04 Aug 2010 09:42:07 -0400 [thread overview]
Message-ID: <1280929327.5669.10.camel@bigi> (raw)
In-Reply-To: <1280912124-30374-1-git-send-email-xiaosuo@gmail.com>
On Wed, 2010-08-04 at 16:55 +0800, Changli Gao wrote:
> The packet length should be checked before the packet data is dereferenced.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
> net/sched/cls_rsvp.h | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
> index dd9414e..4fa119d 100644
> --- a/net/sched/cls_rsvp.h
> +++ b/net/sched/cls_rsvp.h
> @@ -143,9 +143,17 @@ static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
> u8 tunnelid = 0;
> u8 *xprt;
> #if RSVP_DST_LEN == 4
> - struct ipv6hdr *nhptr = ipv6_hdr(skb);
> + struct ipv6hdr *nhptr;
> +
> + if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*nhptr)))
> + return -1;
> + nhptr = ipv6_hdr(skb);
> #else
> struct iphdr *nhptr = ip_hdr(skb);
> +
> + if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*nhptr)))
> + return -1;
> + nhptr = ip_hdr(skb);
> #endif
Maybe a good time to move nhptr declaration outside #if since it is used
in #else as well.
Otherwise:
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
cheers,
jamal
next prev parent reply other threads:[~2010-08-04 13:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 8:55 [PATCH] cls_rsvp: add sanity check for the packet length Changli Gao
2010-08-04 13:42 ` jamal [this message]
2010-08-04 13:44 ` Changli Gao
2010-08-04 13:52 ` Changli Gao
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=1280929327.5669.10.camel@bigi \
--to=hadi@cyberus.ca \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xiaosuo@gmail.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).