Re: [PATCH] usbnet: fix skb traversing races during unlink

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

 



From: Ming Lei <tom.leiming@xxxxxxxxx>
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 linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux