[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200823062743.6860-1-dinghao.liu@zju.edu.cn>
Date: Sun, 23 Aug 2020 14:27:40 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: Martyn Welch <martyn@...chs.me.uk>,
Manohar Vanga <manohar.vanga@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] vme: ca91cx42: fix memleak in ca91cx42_dma_list_add
When we encounter invalid data width or address space,
entry should be freed just like what we've done in the
previous error paths.
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
drivers/vme/bridges/vme_ca91cx42.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index ea938dc29c5e..1c464afd9d4e 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -1100,7 +1100,8 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
break;
default:
dev_err(dev, "Invalid data width\n");
- return -EINVAL;
+ retval = -EINVAL;
+ goto err_cycle;
}
/* Setup address space */
@@ -1122,8 +1123,8 @@ static int ca91cx42_dma_list_add(struct vme_dma_list *list,
break;
default:
dev_err(dev, "Invalid address space\n");
- return -EINVAL;
- break;
+ retval = -EINVAL;
+ goto err_cycle;
}
if (vme_attr->cycle & VME_SUPER)
--
2.17.1
Powered by blists - more mailing lists