]> git.baikalelectronics.ru Git - kernel.git/commit
net: systemport: do not crash freeing an unitialized TX ring
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 31 Oct 2014 22:51:35 +0000 (15:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Nov 2014 19:13:56 +0000 (15:13 -0400)
commitbc1dedef7570c33fc053a2e65a2de78c0cb94f6e
treed5ffafa66836552fa4cc7c64163a31b4ad615590
parent2bf028841d0298728414ae14475fee1a7a9eca7c
net: systemport: do not crash freeing an unitialized TX ring

Callers of bcm_sysport_init_tx_ring() can currently fail, and will
always call bcm_sysport_fini_tx_ring() in a loop ending at the number of
TX queues (32) without checking if the TX ring was successfully
initialized or not.

Update bcm_sysport_fini_tx_ring() to return early and avoid a crash
de-referencing ring->cbs if the TX ring was not initialized, since
ring->cbs is the last part of the initialization done by
bcm_sysport_init_tx_ring() that could fail.

Fixes: 2912eb7400ef ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bcmsysport.c