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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1620472165-7960-1-git-send-email-wangyunjian@huawei.com>
Date:   Sat, 8 May 2021 19:09:25 +0800
From:   wangyunjian <wangyunjian@...wei.com>
To:     <kuba@...nel.org>, <davem@...emloft.net>
CC:     <luciano.coelho@...el.com>, <linux-wireless@...r.kernel.org>,
        <netdev@...r.kernel.org>, <dingxiaoxiong@...wei.com>,
        Yunjian Wang <wangyunjian@...wei.com>
Subject: [PATCH net] iwlwifi: pnvm: fix resource leaks in iwl_pnvm_get_from_fs

From: Yunjian Wang <wangyunjian@...wei.com>

Currently the error return path does not release the "pnvm" when
kmemdup fails and also the "pnvm" is not relased in the normal
path. These lead to a resource leak. Fix these by releasing "pnvm"
before return.

Addresses-Coverity: ("Resource leak")
Fixes: cdda18fbbefa ("iwlwifi: pnvm: move file loading code to a separate function")
Signed-off-by: Yunjian Wang <wangyunjian@...wei.com>
---
 drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
index 40f2109a097f..d4ac83848926 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
@@ -322,10 +322,13 @@ static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len)
 	}
 
 	*data = kmemdup(pnvm->data, pnvm->size, GFP_KERNEL);
-	if (!*data)
+	if (!*data) {
+		release_firmware(pnvm);
 		return -ENOMEM;
+	}
 
 	*len = pnvm->size;
+	release_firmware(pnvm);
 
 	return 0;
 }
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ