浏览代码

can: ti_heccn: don't touch skb after netif_rx()

There is no guarantee that the skb is in the same state after calling
net_receive_skb() or netif_rx(). It might be freed or reused. Not really
harmful as its a read access, except you turn on the proper debugging options
which catch a use after free.

Cc: Anant Gole <anantgole@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Marc Kleine-Budde 10 年之前
父节点
当前提交
05c4456538
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/net/can/ti_hecc.c

+ 1 - 1
drivers/net/can/ti_hecc.c

@@ -747,9 +747,9 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
 		}
 		}
 	}
 	}
 
 
-	netif_rx(skb);
 	stats->rx_packets++;
 	stats->rx_packets++;
 	stats->rx_bytes += cf->can_dlc;
 	stats->rx_bytes += cf->can_dlc;
+	netif_rx(skb);
 
 
 	return 0;
 	return 0;
 }
 }