[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120428.221832.360259077795872366.davem@davemloft.net>
Date: Sat, 28 Apr 2012 22:18:32 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: tom.leiming@...il.com
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
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.
>
> - 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:
Thanks.
--
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