Skip to content
Commit f7e4c977 authored by Jesper Juhl's avatar Jesper Juhl Committed by David S. Miller
Browse files

Broadcom CNIC core network driver: fix mem leak on allocation failures in cnic_alloc_uio_rings()



We are leaking memory in drivers/net/cnic.c::cnic_alloc_uio_rings() if
either of the calls to dma_alloc_coherent() fail. This patch fixes it by
freeing both the memory allocated with kzalloc() and memory allocated with
previous calls to dma_alloc_coherent() when there's a failure.

Thanks to  Joe Perches <joe@perches.com>  for suggesting a better
implementation than my initial version.

Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
Acked-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2393c944
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment