From: Simon Horman <horms@kernel.org>
To: Chengyu Liu <19290937@qq.com>
Cc: khc@pm.waw.pl, netdev@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net 1/2] hdlc_cisco: shut down the keepalive timer on ->detach
Date: Sat, 31 Oct 2026 17:28:49 +0000 [thread overview]
Message-ID: <20261031172849.GQ257209@horms.kernel.org> (raw)
In-Reply-To: <tencent_9E404EEA5DDD9E37C7F105470FDA49E36708@qq.com>
On Wed, Oct 28, 2026 at 11:23:09AM +0800, Chengyu Liu wrote:
> cisco_start() arms st->timer unconditionally and cisco_timer() re-arms
> itself on every fire. The only deletion lives in cisco_stop(), which is
> unreachable on the protocol-detach path: detach_hdlc_protocol() calls
> only ->detach() (never ->stop()) and then kfree()s hdlc->state. The
> cisco hdlc_proto has no ->detach at all, so unregistering an up cisco
> device leaves the keepalive timer armed on top of freed memory; it fires
> within one keepalive interval and cisco_timer() writes through the dead
> cisco_state (st->lock, st->txseq++, cisco_keepalive_send()).
>
> Add a ->detach callback that shuts the timer down permanently before the
> state is freed, mirroring the CVE-2026-63803 ppp fix
> (timer_shutdown_sync() in ppp_timer_release()).
>
> Initialize the timer in cisco_ioctl() when the protocol is attached and
> drop the timer_setup() from cisco_start(), so the timer is initialized
> exactly once at attach time: attach_hdlc_protocol() uses kmalloc() (not
> kzalloc), so st->timer is uninitialized garbage until the first
> timer_setup() and ->detach() must never run timer_shutdown_sync() on it.
>
> This bug was found by static analysis and confirmed with a KASAN
> reproducer: slab-use-after-free write in __run_timer_base() within one
> keepalive interval after rmmod of an up cisco HDLC device (allocated by
> attach_hdlc_protocol() via cisco_ioctl(), freed by
> detach_hdlc_protocol() via unregister_hdlc_device()).
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chengyu Liu <19290937@qq.com>
Reviewed-by: Simon Horman <horms@kernel.org>
...
next prev parent reply other threads:[~2026-10-31 17:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261028032310.2832307-1-19290937@qq.com>
2026-10-28 3:23 ` [PATCH net 1/2] hdlc_cisco: shut down the keepalive timer on ->detach Chengyu Liu
2026-10-31 17:28 ` Simon Horman [this message]
2026-10-28 3:23 ` [PATCH net 2/2] hdlc_fr: shut down the LMI timer in fr_destroy() Chengyu Liu
2026-10-31 17:29 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261031172849.GQ257209@horms.kernel.org \
--to=horms@kernel.org \
--cc=19290937@qq.com \
--cc=khc@pm.waw.pl \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox