[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140612.152219.1525707034580179174.davem@davemloft.net>
Date: Thu, 12 Jun 2014 15:22:19 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: zacharyw09264@...il.com
Cc: netdev@...r.kernel.org
Subject: Re: Very Minor Patch to loopback.c
From: Zachary <zacharyw09264@...il.com>
Date: Thu, 12 Jun 2014 16:24:03 -0400
> Updated due to Richard Weinberger's info in linux-kernel
>
> diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
> index bb96409..fc03883 100644
> --- a/drivers/net/loopback.c
> +++ b/drivers/net/loopback.c
> @@ -72,7 +72,6 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
> struct net_device *dev)
> {
> struct pcpu_lstats *lb_stats;
> - int len;
>
> skb_orphan(skb);
>
> @@ -86,10 +85,9 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
> /* it's OK to use per_cpu_ptr() because BHs are off */
> lb_stats = this_cpu_ptr(dev->lstats);
>
> - len = skb->len;
> if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
> u64_stats_update_begin(&lb_stats->syncp);
> - lb_stats->bytes += len;
> + lb_stats->bytes += skb->len;
> lb_stats->packets++;
> u64_stats_update_end(&lb_stats->syncp);
> }
After 'skb' is passed to netif_rx(), it can no longer be accessed because
that function can free 'skb'.
That is why we load skb->len into a local variable, before calling
netif_rx().
--
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