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=1795042457; b=XteVukSZr56fW3MN1gPoa0t7RWKI3DDGAUVVgz5gk1d15+0zjcM8O4R2zBa+r6VJlI+d jyWgkXZLoFs8fwvgINTsJjEQXun9V0s6APK9FIXQrVPhm5BtuMN6xE+H70FQ5W4xP7sVR mK3zxzr4bfHxmmQaYbK9YAinTbZt+pqkHsBaZuXKcJyFqpXzIqCIZjo+aDb0dZ3d4XVox f4zIUnEfCEN6J6tIcX6EJppv5pHvlmfPyoXnpTnBqKbClcmI33t2+NxU2taG+mUZaFuSP d9bcMPyHDj2fY+k61jNnCZPFSC2eH1FzY4CDX6mH7H/53Mcq7Q6Uc8m3oNiFshMpb3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795042457; 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=4kWpMAyJoV7i5COWG7dRosRv59nMep4Eho03MXrlnIc=; b=CTJ9x3uLg9H49Yo2gXeOD7z6EhjZg7jmZShZSH0CGjFeOmlr5o7P1gZHG/wOgfOsxhRj uI3U9vPpxfHbMtDfzswaCeNU1WXJMvFkLyuU7eJcnWjglqDngvKMejpLR97D1Ar94WkyG m60Hbh5eR8VYKM3GJrKw1GcH0Hu9Ns6K5KYgJdgFCRGnH0KRSWeO3B9Vp1f+Gglk8tKF1 FAKS1mhliO6nCvFcQFaepOjTpsI3CHVW0SKLA9NiaDNwQETF9dQqeEfdGxrofMO98Ynfb 0pJxtYXHvcSMuJk2yWPbwspV606PX1qhSmtcZ3PihZv0kAYjCw/aChvwdrwSzGiy58w== 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=paPPyYya; 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 3D571606A320; Wed, 18 Nov 2026 22:54:16 +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=paPPyYya Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8DA1F000C5; Wed, 18 Nov 2026 22:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795042456; bh=4kWpMAyJoV7i5COWG7dRosRv59nMep4Eho03MXrlnIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=paPPyYyazwg0+Qer97sPpG51ZJ5byvx8+CFJdt5QCzfzwkLtc1YXBdZJ40bR3/uTc kZWvLMbDGPA5PbFN6apCvTwBUoK3wQcEXPNl+gd7hkqVgWFEodE4b0APH1qc63EWwj vPrZCmXmk8REKp9Te/f2Qy8MO+VZztowhhsZJWsE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dudu Lu , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 3177/3318] net/sched: taprio: unwind the netdevice notifier if register_qdisc() fails Date: Wed, 18 Nov 2026 16:03:19 +0100 Message-ID: <20261118150455.135851767@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dudu Lu [ Upstream commit c5234f89d7cb311880ef218cb7a969794a106678 ] taprio_module_init() registers taprio_device_notifier and then returns register_qdisc()'s error directly. When register_qdisc() fails the notifier stays registered, but the loader's failure path frees the module image without ever calling the __exit function, so netdev_chain is left pointing at taprio_device_notifier.notifier_call -- a function pointer that lives in text that has just been freed. register_qdisc() has two failure returns: -EEXIST (duplicate .id) and -EINVAL (malformed cl_ops). taprio_class_ops satisfies every checked implication, so -EINVAL is unreachable and -EEXIST is the only reachable failure; it needs a pre-existing "taprio" entry in qdisc_base. In-tree that is reachable only through bpf_qdisc_reg() (CONFIG_NET_SCH_BPF); a module calling the exported register_qdisc() reaches it as well. Once the notifier is left dangling, the next netdevice event that walks netdev_chain calls through the stale pointer: BUG: KASAN: vmalloc-out-of-bounds in notifier_call_chain+0x650/0xb5c Read of size 8 at addr ffff80001fc5ab08 by task ip/110 notifier_call_chain+0x650/0xb5c raw_notifier_call_chain+0x34/0x64 call_netdevice_notifiers_info+0xa8/0x198 __dev_close_many+0xe0/0x800 ... >ffff80001fc5ab00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 The shadow row is all f8 (KASAN_VMALLOC_INVALID): the read lands in vmalloc memory that was poisoned when the module image was freed, and the indirect call is unguarded because the only check, func_ptr_is_kernel_text(), is compiled out unless CONFIG_DEBUG_NOTIFIERS. Mirror the sibling sch_cbs.c and act_mirred.c, which unwind the notifier on this failure path. Fixes: 7b9eba7ba0c1 ("net/sched: taprio: fix picos_per_byte miscalculation") Signed-off-by: Dudu Lu Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261021155417.66254-1-phx0fer@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_taprio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c845a07e0c6ec..95124fd0846db 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -2595,7 +2595,11 @@ static int __init taprio_module_init(void) if (err) return err; - return register_qdisc(&taprio_qdisc_ops); + err = register_qdisc(&taprio_qdisc_ops); + if (err) + unregister_netdevice_notifier(&taprio_device_notifier); + + return err; } static void __exit taprio_module_exit(void) -- 2.53.0