From: Christophe JAILLET Date: Thu, 21 Sep 2017 23:01:11 +0000 (+0200) Subject: cnic: Fix an error handling path in 'cnic_alloc_bnx2x_resc()' X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~6823^2~41 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=05cf97e7a619fc7ede81ee6bb8ebfa7531b633f5;p=mirror_ubuntu-focal-kernel.git cnic: Fix an error handling path in 'cnic_alloc_bnx2x_resc()' All the error handling paths 'goto error', except this one. We should also go to error in this case, or some resources will be leaking. Signed-off-by: Christophe JAILLET Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index cec94bbb2ea5..8bc126a156e8 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c @@ -1278,7 +1278,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev) ret = cnic_alloc_dma(dev, kwq_16_dma, pages, 0); if (ret) - return -ENOMEM; + goto error; n = CNIC_PAGE_SIZE / CNIC_KWQ16_DATA_SIZE; for (i = 0, j = 0; i < cp->max_cid_space; i++) {