[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimNBA4E0-iX6fesYPch-N1TDgg2kD0r-tK5Mq7A@mail.gmail.com>
Date: Tue, 3 Aug 2010 06:34:59 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 4/4] u32: use get_unaligned_be32
On Tue, Aug 3, 2010 at 6:00 AM, Stephen Hemminger <shemminger@...tta.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@...tta.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@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists