net: systemport: Free DMA coherent descriptors on errors
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 24 Aug 2017 23:01:13 +0000 (16:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Sep 2017 06:22:06 +0000 (08:22 +0200)
commit3f0204b0b7b5ea5fde64ee8197b2d1a281e2fe3a
treea66bd74271f6cacdd5977d2f44c6336b9e1ac8bf
parent71dd9ac555c50d4d233acd54f24d97c0f1541aa1
net: systemport: Free DMA coherent descriptors on errors

[ Upstream commit c2062ee3d9615828109ffe8089fbf69bed394d05 ]

In case bcm_sysport_init_tx_ring() is not able to allocate ring->cbs, we
would return with an error, and call bcm_sysport_fini_tx_ring() and it
would see that ring->cbs is NULL and do nothing. This would leak the
coherent DMA descriptor area, so we need to free it on error before
returning.

Reported-by: Eric Dumazet <edumazet@gmail.com>
Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bcmsysport.c