Search Linux Wireless

Re: [PATCH 2/2] rt2x00: Fix panic on frame padding for rt2800 usb devices (due to not enough skb tailroom)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> Signed-off-by: Ismael Luceno <ismael.luceno@xxxxxxxxx>

Please add a short description why this change is needed,
I only know why because of a discussion over private mail...

> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
> index 85185de..d284e1e 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -369,7 +369,8 @@ static void rt2800usb_write_tx_desc(struct queue_entry *entry,
>  static void rt2800usb_write_tx_data(struct queue_entry *entry,
>                                        struct txentry_desc *txdesc)
>  {
> -       u8 padding_len;
> +       unsigned int padding_len;
> +       int err;
>
>        /*
>         * pad(1~3 bytes) is added after each 802.11 payload.
> @@ -379,8 +380,14 @@ static void rt2800usb_write_tx_data(struct queue_entry *entry,
>         *                 |<------------- tx_pkt_len ------------->|
>         */
>        padding_len = roundup(entry->skb->len + 4, 4) - entry->skb->len;
> -       memset(skb_put(entry->skb, padding_len), 0, padding_len);
>
> +       err = skb_pad(entry->skb, padding_len);
> +       if (unlikely(err)) {
> +               WARNING(entry->queue->rt2x00dev, "TX SKB padding error, out of memory\n");
> +               return;
> +       }

Please use skb_padto instead, that will actually check if the padding
is needed or not...

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


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux