[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D3458F7.5070209@ru.mvista.com>
Date: Mon, 17 Jan 2011 17:57:59 +0300
From: Sergei Shtylyov <sshtylyov@...sta.com>
To: Alexey Orishko <alexey.orishko@...il.com>
CC: linux-usb@...r.kernel.org, netdev@...r.kernel.org,
davem@...emloft.net, gregkh@...e.de, yauheni.kaliuta@...ia.com,
Alexey Orishko <alexey.orishko@...ricsson.com>
Subject: Re: [PATCH] USB CDC NCM: tx_fixup() race condition fix
Hello.
Alexey Orishko wrote:
> - tx_fixup() call be called from either timer callback or from xmit()
s/call/can/?
> in usbnet, so spinlock is added to avoid concurrency-related problem.
> - minor correction due checkpatch warning for some line over 80 chars
Due to?
> after previous patch was applied.
> Signed-off-by: Alexey Orishko <alexey.orishko@...ricsson.com>
> ---
> drivers/net/usb/cdc_ncm.c | 13 ++++++++-----
> 1 files changed, 8 insertions(+), 5 deletions(-)
> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
> index d776c4a..bf13fa6 100644
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -54,7 +54,7 @@
> #include <linux/usb/usbnet.h>
> #include <linux/usb/cdc.h>
>
> -#define DRIVER_VERSION "30-Nov-2010"
> +#define DRIVER_VERSION "17-Jan-2011"
>
> /* CDC NCM subclass 3.2.1 */
> #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
> @@ -873,9 +873,11 @@ static void cdc_ncm_tx_timeout(unsigned long arg)
>
> spin_unlock(&ctx->mtx);
>
> - if (restart)
> + if (restart) {
> + spin_lock(&ctx->mtx);
> cdc_ncm_tx_timeout_start(ctx);
> - else if (ctx->netdev != NULL)
> + spin_unlock(&ctx->mtx);
> + } else if (ctx->netdev != NULL)
The 'else' branch should now also have {}, according to
Documentation/CodingStyle.
> usbnet_start_xmit(NULL, ctx->netdev);
> }
>
> @@ -1021,7 +1024,7 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
> (temp > CDC_NCM_MAX_DATAGRAM_SIZE) || (temp < ETH_HLEN)) {
> pr_debug("invalid frame detected (ignored)"
> "offset[%u]=%u, length=%u, skb=%p\n",
> - x, offset, temp, skb_in);
> + x, offset, temp, skb_in);
Would be good to align uniformly with the previous line...
WBR, Sergei
--
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