]> git.baikalelectronics.ru Git - kernel.git/commit
net: atlantic: fix use after free kasan warn
authorPavel Belous <pbelous@marvell.com>
Fri, 14 Feb 2020 15:44:55 +0000 (18:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Feb 2020 03:03:39 +0000 (19:03 -0800)
commitea2f646b8da14239ffb5629d9f5f9be155272593
tree2fc1dcc333357d750d8ec3ac935ba97b5f030b90
parent914eb499f8d2041c8f1522a316e29f0a93ec95d7
net: atlantic: fix use after free kasan warn

skb->len is used to calculate statistics after xmit invocation.

Under a stress load it may happen that skb will be xmited,
rx interrupt will come and skb will be freed, all before xmit function
is even returned.

Eventually, skb->len will access unallocated area.

Moving stats calculation into tx_clean routine.

Fixes: 87a722383388 ("net: ethernet: aquantia: Add ring support code")
Reported-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Pavel Belous <pbelous@marvell.com>
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/aq_ring.c