lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACVXFVPzZF1BTN+0frDh5EyQnpAvkPSbMEAhWmUw2OgaTEwF1g@mail.gmail.com>
Date:	Mon, 30 Apr 2012 16:13:40 +0800
From:	Ming Lei <tom.leiming@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	gregkh@...uxfoundation.org, netdev@...r.kernel.org,
	linux-usb@...r.kernel.org, huajun.li.lee@...il.com,
	oneukum@...e.de, stable@...nel.org
Subject: Re: [PATCH] usbnet: fix skb traversing races during unlink

On Sun, Apr 29, 2012 at 10:18 AM, David Miller <davem@...emloft.net> wrote:
> From: Ming Lei <tom.leiming@...il.com>
> Date: Fri, 27 Apr 2012 18:21:35 +0800
>
>> +/*The caller must hold list->lock*/
>
> Please put spaces in your comments, like this:
>
> /* The caller must hold list->lock */
>
>> +
>> +             /*speedup unlink by blocking resubmit*/
>
> Same here.

OK, will do it.

>>
>> -             entry = (struct skb_data *) skb->cb;
>> +             skb_queue_walk(q, skb) {
>> +                     entry = (struct skb_data *) skb->cb;
>> +                     if (entry->state != unlink_start)
>> +                             break;
>> +             }
>> +             if (skb == (struct sk_buff *)q)
>> +                     break;
>
> Please do not expose the internal details of SKB lists
> with a test like this.  Eventually this will all be
> converted to struct list_head and this kind of test
> will cause unnecessary pain for such a conversion.
>
> Instead, code it like this, as you would for a loop
> using list_for_each*() or similar:
>
>        skb_queue_walk(q, skb) {
>                if (condition)
>                        goto found;
>        }
>        /* No matching entry. */
>        break;
> found:

Good suggestion, will do it.


Thanks,
-- 
Ming Lei
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ