From: Jiri Pirko <jpirko-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
tcpdump-workers-YE1jQ5a0g24KACXWX4p+q9i2O/JbrIOy@public.gmane.org,
proski-mXXj517/zsQ@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
Date: Wed, 3 Mar 2010 10:05:13 +0100 [thread overview]
Message-ID: <20100303090512.GB2961@psychotron.lab.eng.brq.redhat.com> (raw)
In-Reply-To: <20100303064001.GB2648-YzwxZg+R7et1/kRsl7OVgNvLeJWuRmrY@public.gmane.org>
Wed, Mar 03, 2010 at 07:40:01AM CET, jpirko-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
>Subject: [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del]
Dave please apply this against net-next-2.6. I see that 914c8ad2d18b is still not in
net-2.6.
Thanks a lot
Jirka
>
>My previous patch 914c8ad2d18b62ad1420f518c0cab0b0b90ab308 incorrectly changed
>the length check in packet_mc_add to be more strict. The problem is that
>userspace is not filling this field (and it stays zeroed) in case of setting
>PACKET_MR_PROMISC or PACKET_MR_ALLMULTI. So move the strict check to the point
>in path where the addr_len must be set correctly.
>
>Signed-off-by: Jiri Pirko <jpirko-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
>diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>index 031a5e6..1612d41 100644
>--- a/net/packet/af_packet.c
>+++ b/net/packet/af_packet.c
>@@ -1688,6 +1688,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
> {
> switch (i->type) {
> case PACKET_MR_MULTICAST:
>+ if (i->alen != dev->addr_len)
>+ return -EINVAL;
> if (what > 0)
> return dev_mc_add(dev, i->addr, i->alen, 0);
> else
>@@ -1700,6 +1702,8 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
> return dev_set_allmulti(dev, what);
> break;
> case PACKET_MR_UNICAST:
>+ if (i->alen != dev->addr_len)
>+ return -EINVAL;
> if (what > 0)
> return dev_unicast_add(dev, i->addr);
> else
>@@ -1734,7 +1738,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq)
> goto done;
>
> err = -EINVAL;
>- if (mreq->mr_alen != dev->addr_len)
>+ if (mreq->mr_alen > dev->addr_len)
> goto done;
>
> err = -ENOBUFS;
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-03-03 9:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 1:00 Current wireless-testing breaks libpcap: mr_alen should be set Pavel Roskin
2010-03-03 2:36 ` John W. Linville
2010-03-03 6:24 ` Jiri Pirko
2010-03-03 6:57 ` Pavel Roskin
2010-03-03 6:40 ` [net-2.6 PATCH] af_packet: move strict addr_len check right before dev_[mc/unicast]_[add/del] Jiri Pirko
2010-03-03 7:01 ` Pavel Roskin
2010-03-03 7:36 ` Jiri Pirko
[not found] ` <20100303064001.GB2648-YzwxZg+R7et1/kRsl7OVgNvLeJWuRmrY@public.gmane.org>
2010-03-03 6:57 ` Eric Dumazet
2010-03-03 9:05 ` Jiri Pirko [this message]
[not found] ` <20100303090512.GB2961-YzwxZg+R7evMbnheQZGK0N5OCZ2W11yPFxja6HXR22MAvxtiuMwx3w@public.gmane.org>
2010-03-03 9:06 ` David Miller
2010-03-03 9:06 ` David Miller
2010-03-03 15:31 ` Current wireless-testing breaks libpcap: mr_alen should be set Frank W. Miller
2010-03-03 15:54 ` [tcpdump-workers] " Jiri Pirko
2010-03-06 21:23 ` Guy Harris
2010-03-08 8:11 ` Jiri Pirko
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=20100303090512.GB2961@psychotron.lab.eng.brq.redhat.com \
--to=jpirko-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=proski-mXXj517/zsQ@public.gmane.org \
--cc=tcpdump-workers-YE1jQ5a0g24KACXWX4p+q9i2O/JbrIOy@public.gmane.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 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).