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: <20220112020329.692004-1-jiasheng@iscas.ac.cn>
Date:   Wed, 12 Jan 2022 10:03:29 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     hverkuil@...all.nl, dwlsalmeida@...il.com, mchehab@...nel.org
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] media: vidtv: Add the missing kfree to avoid the memory leak

Since kstrdup() allocate a space for e->name and will not automatically
free.
If kzalloc() fails, we just kfree e without e->name.
Then we cannot get the pointer 'e->name' and cause the memory leak.

Fixes: 3d1387b3b8f6 ("media: vidtv: fix some warnings")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/media/test-drivers/vidtv/vidtv_s302m.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/test-drivers/vidtv/vidtv_s302m.c b/drivers/media/test-drivers/vidtv/vidtv_s302m.c
index ddaff46c440f..433fc0c7fdfa 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_s302m.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_s302m.c
@@ -474,6 +474,7 @@ struct vidtv_encoder
 
 	ctx = kzalloc(priv_sz, GFP_KERNEL);
 	if (!ctx) {
+		kfree(e->name);
 		kfree(e);
 		return NULL;
 	}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ