mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hui Peng <benquike@gmail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] char: hpet: prevent hard-IRQ divide-by-zero in hpet_interrupt() via HPET_IRQFREQ
Date: Sun, 20 Sep 2026 06:19:44 +0100	[thread overview]
Message-ID: <2026092022-thesis-kinswoman-19aa@gregkh> (raw)
In-Reply-To: <20260919203515.2581203-1-benquike@gmail.com>

On Sat, Sep 19, 2026 at 08:35:15PM +0000, Hui Peng wrote:
> In hpet_ioctl_common(), HPET_IRQFREQ sets:
> 
>         devp->hd_ireqfreq = hpet_time_div(hpetp, arg);
> 
> where hpet_time_div() computes (hpetp->hp_tick_freq + (arg >> 1)) / arg.
> Whenever arg > 2 * hpetp->hp_tick_freq, integer division yields 0 and
> sets devp->hd_ireqfreq = 0. In addition, HPET_IRQFREQ allows updating
> devp->hd_ireqfreq while timer interrupts (HPET_IE) are already enabled.
> 
> When the armed HPET timer interrupt fires, hpet_interrupt() executes:
> 
>         base = mc % devp->hd_ireqfreq;
> 
> in hard-IRQ context with devp->hd_ireqfreq == 0, triggering an immediate
> divide error (#DE) kernel Oops.
> 
> Reject HPET_IRQFREQ with -EBUSY when HPET_IE is already enabled, and
> reject arg values where hpet_time_div(hpetp, arg) == 0 with -EINVAL.
> 
> Fixes: ba3f213f8a31 ("[PATCH] HPET: make frequency calculations 32 bit safe")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---


How was this tested?

Why no cc: stable?

Please slow down.

greg k-h

  reply	other threads:[~2026-09-20  5:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 20:35 Hui Peng
2026-09-20  5:19 ` Greg Kroah-Hartman [this message]
2026-09-21  2:20 ` [PATCH v2] " Hui Peng
2026-09-21 15:10   ` krzk

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=2026092022-thesis-kinswoman-19aa@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=benquike@gmail.com \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®