Re: [PATCH 1/8] pwm: tegra: Prevent 32-bit period truncation and division by zero

From: Lee Jones

Date: Wed Nov 18 2026 - 12:16:48 EST


On Thu, 05 Nov 2026, Uwe Kleine-König wrote:

> Hello Lee,
>
> On Thu, Nov 05, 2026 at 02:38:03PM +0000, Lee Jones wrote:
> > tegra_pwm_apply() passes the 64-bit state->duty_cycle and state->period
> > values into tegra_pwm_config(), which accepts signed 32-bit int
> > parameters and performs DIV_ROUND_CLOSEST_ULL(c, period_ns) before
> > validating period_ns against pc->min_period_ns. If a consumer requests
> > a period that is a non-zero multiple of 2^32 nanoseconds, period_ns
> > truncates to zero and triggers a divide-by-zero panic.
> >
> > Widen duty_ns and period_ns to u64 and validate that period_ns lies
> > within [pc->min_period_ns, U32_MAX] prior to dividing by period_ns.
> >
> > Fixes: 1d7796bdb63a ("pwm: tegra: Support dynamic clock frequency configuration")
> > Fixes: fd3ddd4355c0 ("pwm: tegra: Implement .apply() callback")
> > Closes: https://sashiko.dev/#/bug/linux-5c5b97d6-4da6-4d06-9dc7-957419dcd832
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
>
> This is already addressed in
> 9ad5602d4943 ("pwm: tegra: Fix value discarding for duty and period")
> which is next-20261102 and later.

Would you like me to resubmit the set without this or can you omit it?

--
Lee Jones