lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210915103559.GA7060@kili>
Date:   Wed, 15 Sep 2021 13:35:59 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     M Chetan Kumar <m.chetan.kumar@...el.com>
Cc:     Intel Corporation <linuxwwan@...el.com>,
        Loic Poulain <loic.poulain@...aro.org>,
        Sergey Ryazanov <ryazanov.s.a@...il.com>,
        Johannes Berg <johannes@...solutions.net>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] net: wwan: iosm: fix memory leak in
 ipc_devlink_create_region()

This doesn't free the first region in devlink->cd_regions[0] so it's a
memory leak.

Fixes: 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump collection")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 drivers/net/wwan/iosm/iosm_ipc_devlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.c b/drivers/net/wwan/iosm/iosm_ipc_devlink.c
index 592792c277fe..6d4f592ba0b6 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_devlink.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_devlink.c
@@ -231,7 +231,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink)
 {
 	struct devlink_region_ops *mdm_coredump;
 	int rc = 0;
-	u8 i;
+	int i;
 
 	mdm_coredump = devlink->iosm_devlink_mdm_coredump;
 	for (i = 0; i < IOSM_NOF_CD_REGION; i++) {
@@ -247,7 +247,7 @@ static int ipc_devlink_create_region(struct iosm_devlink *devlink)
 			rc = PTR_ERR(devlink->cd_regions[i]);
 			dev_err(devlink->dev, "Devlink region fail,err %d", rc);
 			/* Delete previously created regions */
-			for ( ; i > 0; i--)
+			for ( ; i >= 0; i--)
 				devlink_region_destroy(devlink->cd_regions[i]);
 			goto region_create_fail;
 		}
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ