diff mbox

rt2x00: Use addr_mask to catch invalid MAC addresses

Message ID 1354031236-8191-1-git-send-email-helmut.schaa@googlemail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Helmut Schaa Nov. 27, 2012, 3:47 p.m. UTC
This ensures that a user cannot accidentally set up a virtual interface
with a MAC address the rt2800 hw cannot handle.

Reported-by: Petr Stetiar <ynezz@true.cz>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Helmut Schaa Nov. 27, 2012, 5 p.m. UTC | #1
Hi Ivo,

On Tue, Nov 27, 2012 at 4:56 PM, Ivo Van Doorn <ivdoorn@gmail.com> wrote:
> Hi,
>
>> This ensures that a user cannot accidentally set up a virtual interface
>> with a MAC address the rt2800 hw cannot handle.
>>
>> Reported-by: Petr Stetiar <ynezz@true.cz>
>> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
>> ---
>>  drivers/net/wireless/rt2x00/rt2800lib.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c
>> b/drivers/net/wireless/rt2x00/rt2800lib.c
>> index c0441a7..7f0df12 100644
>> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
>> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
>> @@ -5108,6 +5108,9 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev
>> *rt2x00dev)
>>                                 rt2x00_eeprom_addr(rt2x00dev,
>>                                                    EEPROM_MAC_ADDR_0));
>>
>> +       /* Only the last three bits are variable in rt2800 devices. */
>> +       rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = 0x7;
>
>
> Shouldn't this be added for rt61pci and rt73usb as well?

I'm not 100% sure if the same is true in rt61pci and rt73usb. Are they
also using an
address mask?

Thanks,
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Helmut Schaa Nov. 27, 2012, 5:09 p.m. UTC | #2
On Tue, Nov 27, 2012 at 6:00 PM, Helmut Schaa
<helmut.schaa@googlemail.com> wrote:
>> Shouldn't this be added for rt61pci and rt73usb as well?
>
> I'm not 100% sure if the same is true in rt61pci and rt73usb. Are they
> also using an
> address mask?

Hmm, I think Ivo is right. We should add the same for rt61pci and rt73usb
but they only support the last two bits to be used. Hence an address mask
of 0x3.

I'll send a follow-up.

Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index c0441a7..7f0df12 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -5108,6 +5108,9 @@  static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 				rt2x00_eeprom_addr(rt2x00dev,
 						   EEPROM_MAC_ADDR_0));
 
+	/* Only the last three bits are variable in rt2800 devices. */
+	rt2x00dev->hw->wiphy->addr_mask[ETH_ALEN - 1] = 0x7;
+
 	/*
 	 * As rt2800 has a global fallback table we cannot specify
 	 * more then one tx rate per frame but since the hw will