]> git.baikalelectronics.ru Git - kernel.git/commit
net: lan966x: Fix use of pointer after being freed
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Wed, 11 May 2022 20:40:59 +0000 (22:40 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 May 2022 23:21:56 +0000 (16:21 -0700)
commit4eedca1766728fb01ec48b17880aba67bc76459e
tree771336dd77f2b0cbe34b15b5b54ccce1c0ef2d5a
parent6801887977e3a962561ce383000ec70bc2dc647c
net: lan966x: Fix use of pointer after being freed

The smatch found the following warning:

drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c:736 lan966x_fdma_reload()
warn: 'rx_dcbs' was already freed.

This issue can happen when changing the MTU on one of the ports and once
the RX buffers are allocated and then the TX buffer allocation fails.
In that case the RX buffers should not be restore. This fix this issue
such that the RX buffers will not be restored if the TX buffers failed
to be allocated.

Fixes: 65404903eaa529 ("net: lan966x: Update FDMA to change MTU.")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20220511204059.2689199-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c