From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F1322DA76C; Tue, 21 Jul 2026 20:18:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665123; cv=none; b=mZV7C7GBz3bAmx04Zv6jXXufMgVl0JXoROjsd4sKQlw3gVJWg2D9CFiSqXvEr9ll4sH/9h9tRgEclAJMBnvR9zo+/Man2YrZd+ru1+dpT9POwOQ79lkh4zGsrtVyfH+7t1ctC8pzNqVViuA6MsZ6rQJpHaCUWnneQVVZYHzt3Do= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665123; c=relaxed/simple; bh=+ElwkosNM0pjRMFWNvDLEHmajgDBEipAIFMNgrRdWOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X6VffE5nPlrsz6oksaqrj0xLLvJXwIdxgcDKoz4ZvdCjI5k6um+SfOPakGAWPf74bW562lgWcgYbh9jLBoS3Z1kHtRvQxFuv1/NNewFPi/7WRkJE2+Y6VVB47GXm2x9gxaYzPZFEajHRZGxf33CfuDeZJUxnqnebB6NpJ97Rc6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OFp9rv5g; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OFp9rv5g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F2511F000E9; Tue, 21 Jul 2026 20:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665122; bh=i9GYgUnjjPFFYIpTHOyqAACp05OmA5v4UrhLccIdiiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OFp9rv5gObG59onghNq31m3Hc5IrsgFozjxAqIKxTJFn4R4UAvkPzZybZVipQZ5kx xvQFV9j5LQM1DYxbcfIBqXNVoJCWGIHz2PSjIIWESkle409njxASj5+ycF9HLq3nB0 sMe0h8pQmsNUN16iTmpQXVqYfd+K24LfDeJw+NXs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Martyn Welch , Hao-Qun Huang Subject: [PATCH 6.6 0142/1266] staging: vme_user: fix location monitor leak in fake bridge Date: Tue, 21 Jul 2026 17:09:39 +0200 Message-ID: <20260721152444.985027244@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hao-Qun Huang commit e8422d89e8af41d87f0e9db564be8e2634f4c602 upstream. fake_init() allocates a location monitor resource and links it into fake_bridge->lm_resources. The init error path frees this list, but fake_exit() only frees the slave and master resource lists. Loading and unloading the module therefore triggers a kmemleak warning: unreferenced object 0xffff8b8b82aebe40 (size 64): comm "init", pid 1, jiffies 4294894572 backtrace (crc c1e013ef): kmemleak_alloc+0x4e/0x90 __kmalloc_cache_noprof+0x338/0x430 0xffffffffc0602246 do_one_initcall+0x4f/0x320 do_init_module+0x68/0x270 load_module+0x2a3b/0x2d90 Free the lm_resources list in fake_exit() as well, before fake_bridge is freed. Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver") Cc: stable Cc: Martyn Welch Assisted-by: Claude:claude-fable-5 Signed-off-by: Hao-Qun Huang Link: https://patch.msgid.link/20260704065817.403111-1-alvinhuang0603@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_fake.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/staging/vme_user/vme_fake.c +++ b/drivers/staging/vme_user/vme_fake.c @@ -1244,6 +1244,7 @@ static void __exit fake_exit(void) { struct list_head *pos = NULL; struct list_head *tmplist; + struct vme_lm_resource *lm; struct vme_master_resource *master_image; struct vme_slave_resource *slave_image; int i; @@ -1274,6 +1275,13 @@ static void __exit fake_exit(void) fake_crcsr_exit(fake_bridge); /* resources are stored in link list */ + list_for_each_safe(pos, tmplist, &fake_bridge->lm_resources) { + lm = list_entry(pos, struct vme_lm_resource, list); + list_del(pos); + kfree(lm); + } + + /* resources are stored in link list */ list_for_each_safe(pos, tmplist, &fake_bridge->slave_resources) { slave_image = list_entry(pos, struct vme_slave_resource, list); list_del(pos);