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 D72093F482E; Thu, 16 Jul 2026 13:42:38 +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=1784209361; cv=none; b=SyFqUKRDRGe4d559ddrnUq0soL2YqC1/2TI1bhs9v2p3bem9a+8Ey8sECssd56t48DYKN45yS/D/eoQfT7ooN78RuLbIIJNuCol4EvCR9WLCsjr30AjOOM6my94HdbzBv8vQKgyAFoqTlLysgSpaaLMAYErC48KIGZ00IONrBnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784209361; c=relaxed/simple; bh=VsEeFJIDLZj0MYnat3JlojBDmvjUyEIlqyekKbusfUY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=naNtRk4qFtZtbK4jIQEp3COUG6WaNnGxCaZ0GKUV8LHUu8viqzQtSVRFe/oaOMdX/7wDNvhqwtCGfNm1n7Kh+adW4CfkK+HXrQ7z8GywDd8nNx4JOAvrf/aaXtazVoHK5pXI/ivBnZ2YBZJLtH4Louw9GIFmv24H/YEen4sSYME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UgUmn2iu; 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="UgUmn2iu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD16D1F000E9; Thu, 16 Jul 2026 13:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784209358; bh=+GC/S5ZnkmdsQ05niBSeh5+ir6GvInCNit8+z+iN/Zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UgUmn2iu0P34S6+jCBMX5Iih4yQQIk7Ak3bTqh4/12TvXCO4KI2ydBhCAhFd25P2s tFTofk4DijJJ521yYf0kgPzE9ifgkZXDIDefpTdm3aZlEoz8mSPbTMv5oU37cBKdZS j/n/wa8ozu4r5BgIsbOqA4vzoAOs7KdhUDcHVKU0= 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 7.1 154/518] staging: vme_user: fix location monitor leak in fake bridge Date: Thu, 16 Jul 2026 15:27:02 +0200 Message-ID: <20260716133051.215861822@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133047.772246337@linuxfoundation.org> References: <20260716133047.772246337@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 7.1-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 @@ -1239,6 +1239,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; @@ -1269,6 +1270,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);