From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795051607; b=VpookWwWT0j0UWKGSYki7ly4K3vVChiBtEWRqKtJQHZrr88nmTjwF1nGVZ2epR8FHNRO 7Gdn2n5B1xRDIIxOAPp89SSG8qbhsJynLg/xXP+ur9cFQBCIJsBDXp5u6lruSbyYqdso2 CKpXD2yVPNj2fuVlGSej/MoLJNACrGHdSRDTRNTnwqy5Jwqccci4XSigA3CzMOeyS0W9K 11ptpMuhF/uLgjziPBuL6y7m183cclSEZj3EVa17o4a5UJuRJod3Xc1GNU+lt+rGT+FHd JkhmbffO8k4KsNPmThuMpLjDNpyDdL3/Cbcz46LImyS5OxCmDyuNybq3JcRe0/wPUMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795051607; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=JtDD+8SBoiBrBqRp61hwv/CSdT2nHHs/o8uFPXFluqk=; b=Zwcdzr73mGrkd5Gtf5Nk6/QR2I+tS/nuLxhk/ZNoqnW6y6HiywOoS/VIg5xb1enWaSU8 uvxMeVyPgc8GlwvLrW1F4hc8uwO7Je/UD8vACjq69r5KvZnAlikMP2z6fJwHSeBIo2jmj wsgHjIKutWy9sFME3SuArTTP2E4/Cmi+xsLg31f5I1sQQ4sbMWPikC4d0liyKv7t7Jlun 8sz1JojoF8H/1FgbQj4xnR6zEBDpaqEsT3Yo9wuJ2PiNxqDZ7OsT9V5ZFVAfp3mb6LwXK ndyKxUevBHLs2auAmmt0TIZzwuscnBu3UCxy/DzJcekIjVimxN1DbtpE8kEj0qgDGsw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cL6KRnTe; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31B43606A31C; Thu, 19 Nov 2026 01:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cL6KRnTe Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85FB91F000C4; Thu, 19 Nov 2026 01:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795051607; bh=JtDD+8SBoiBrBqRp61hwv/CSdT2nHHs/o8uFPXFluqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cL6KRnTeQta9FLXffAH0JHRNHr/j3fxOjmI1aiv9Rr8XPyhQWIedvKXMz6IYCOFCv QEvkgjPqFTtq/HPMXBWw93TQeDWd74DvHScrIGhQgDRpTd8Hf4ZJ2f2HwY+cgU7EuF WPfemuIH0MNViRlGf8dtjvWMP8d/9pz+8vfhEa/k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bui Viet Dung , Loic Poulain , Paolo Abeni Subject: [PATCH 5.15 0269/2214] wwan: wwan_hwsim: Pin module for debugfs file operations Date: Wed, 18 Nov 2026 15:32:25 +0100 Message-ID: <20261118150020.845993702@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bui Viet Dung commit a388f17e23b7e305cb306aafd73bb10d6b8ca452 upstream. An open debugfs file retains its file_operations pointer in the debugfs proxy state. However, wwan_hwsim_debugfs_portdestroy_fops, wwan_hwsim_debugfs_portcreate_fops, wwan_hwsim_debugfs_devdestroy_fops, and wwan_hwsim_debugfs_devcreate_fops in wwan_hwsim.c have no .owner set to THIS_MODULE. As a result, full_proxy_open_regular() calls fops_get() which succeeds without taking a reference to the wwan_hwsim module. When a userspace process opens any of these debugfs files, a subsequent module unload (rmmod wwan_hwsim) can succeed while the file descriptor remains open. When the userspace process subsequently closes the descriptor, full_proxy_release() accesses the already unmapped file_operations structure, triggering a kernel oops in full_proxy_release(): BUG: unable to handle page fault for address: fffffbfff84f90ef Oops: 0000 [#2] SMP KASAN NOPTI RIP: 0010:full_proxy_release+0x8e/0x140 Call Trace: __fput+0x357/0xaa0 fput_close_sync+0xe6/0x1a0 file_close_fd_locked+0x17e/0x2f0 do_close+0x33/0x70 __x64_sys_close+0x44/0x80 do_syscall_64+0xc3/0x590 entry_SYSCALL_64_after_hwframe+0x76/0x7e The issue was discovered via manual code audit of wwan_hwsim.c and reproduced on a Linux 7.3-rc6 test VM with CONFIG_WWAN_HWSIM=m. Set .owner = THIS_MODULE on all four debugfs file_operations structures in wwan_hwsim.c so that debugfs pins the module until close has completed. Fixes: 9ee23f48f670 ("wwan_hwsim: add debugfs management interface") Cc: stable@vger.kernel.org Signed-off-by: Bui Viet Dung Reviewed-by: Loic Poulain Link: https://patch.msgid.link/20261008130753.313875-1-dungvn2345@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/wwan/wwan_hwsim.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/wwan/wwan_hwsim.c +++ b/drivers/net/wwan/wwan_hwsim.c @@ -377,6 +377,7 @@ static ssize_t wwan_hwsim_debugfs_portde } static const struct file_operations wwan_hwsim_debugfs_portdestroy_fops = { + .owner = THIS_MODULE, .write = wwan_hwsim_debugfs_portdestroy_write, .open = simple_open, .llseek = noop_llseek, @@ -401,6 +402,7 @@ static ssize_t wwan_hwsim_debugfs_portcr } static const struct file_operations wwan_hwsim_debugfs_portcreate_fops = { + .owner = THIS_MODULE, .write = wwan_hwsim_debugfs_portcreate_write, .open = simple_open, .llseek = noop_llseek, @@ -422,6 +424,7 @@ static ssize_t wwan_hwsim_debugfs_devdes } static const struct file_operations wwan_hwsim_debugfs_devdestroy_fops = { + .owner = THIS_MODULE, .write = wwan_hwsim_debugfs_devdestroy_write, .open = simple_open, .llseek = noop_llseek, @@ -445,6 +448,7 @@ static ssize_t wwan_hwsim_debugfs_devcre } static const struct file_operations wwan_hwsim_debugfs_devcreate_fops = { + .owner = THIS_MODULE, .write = wwan_hwsim_debugfs_devcreate_write, .open = simple_open, .llseek = noop_llseek,