From: Changli Gao <xiaosuo@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 4/4] u32: use get_unaligned_be32
Date: Tue, 3 Aug 2010 06:34:59 +0800 [thread overview]
Message-ID: <AANLkTimNBA4E0-iX6fesYPch-N1TDgg2kD0r-tK5Mq7A@mail.gmail.com> (raw)
In-Reply-To: <20100802220113.821018357@vyatta.com>
On Tue, Aug 3, 2010 at 6:00 AM, Stephen Hemminger <shemminger@vyatta.com> wrote:
> U32 classifier reads data from packet at a offset passed in from
> user space. The offset should be aligned, but it is unsafe practice
> to depend on values from userspace.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> --- a/net/sched/cls_u32.c 2010-08-01 11:21:06.945820852 -0700
> +++ b/net/sched/cls_u32.c 2010-08-01 11:24:55.257793848 -0700
> @@ -41,6 +41,7 @@
> #include <net/netlink.h>
> #include <net/act_api.h>
> #include <net/pkt_cls.h>
> +#include <asm/unaligned.h>
>
> struct tc_u_knode
> {
> @@ -140,7 +141,7 @@ next_knode:
> data = skb_header_pointer(skb, toff, 4, &_data);
> if (!data)
> goto out;
> - if ((*data ^ key->val) & key->mask) {
> + if ((get_unaligned_be32(data) ^ key->val) & key->mask) {
be32()? I think it may break configuration.
> n = n->next;
> goto next_knode;
> }
>
>
Please refer to the comment from David about get_unaligned()
http://www.spinics.net/lists/netdev/msg131765.html . And there are
more than one get_unaligned() needed. Thanks.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
next prev parent reply other threads:[~2010-08-02 22:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 22:00 [PATCH 0/4] u32 classifier fixes Stephen Hemminger
2010-08-02 22:00 ` [PATCH 1/4] net: check for reference outside of skb Stephen Hemminger
2010-08-02 22:59 ` David Miller
2010-08-02 23:11 ` Changli Gao
2010-08-02 23:21 ` Stephen Hemminger
2010-08-02 23:25 ` Changli Gao
2010-08-02 22:00 ` [PATCH 2/4] net: add likely/unlikely to skb_header_pointer Stephen Hemminger
2010-08-02 22:00 ` [PATCH 3/4] u32: allow negative offset Stephen Hemminger
2010-08-02 22:00 ` [PATCH 4/4] u32: use get_unaligned_be32 Stephen Hemminger
2010-08-02 22:34 ` Changli Gao [this message]
2010-08-02 22:45 ` Stephen Hemminger
2010-08-02 22:55 ` Ben Hutchings
2010-08-02 23:01 ` Changli Gao
2010-08-02 23:44 ` [PATCH] u32: negative offset fix Stephen Hemminger
2010-08-03 5:08 ` 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=AANLkTimNBA4E0-iX6fesYPch-N1TDgg2kD0r-tK5Mq7A@mail.gmail.com \
--to=xiaosuo@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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).