From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: Danish Khateeb <danishkhateeb03@gmail.com>
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] pwm: Allow 32-bit tasks to use the character device
Date: Tue, 29 Sep 2026 16:11:24 +0200 [thread overview]
Message-ID: <arvFsimmYhZWcOIR@monoceros> (raw)
In-Reply-To: <20260928184422.380520-1-danishkhateeb03@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]
Hello,
On Mon, Sep 28, 2026 at 01:44:22PM -0500, Danish Khateeb wrote:
> pwm_cdev_fileops has no .compat_ioctl, so every ioctl on /dev/pwmchipN
> fails with -ENOTTY for 32-bit tasks on a 64-bit kernel, e.g. armhf
> userspace on arm64.
>
> struct pwmchip_waveform has the same layout for 32-bit and 64-bit tasks,
> so compat_ptr_ioctl() is enough. PWM_IOCTL_REQUEST and PWM_IOCTL_FREE
> take an integer rather than a pointer, which is fine too: compat_ptr()
> only changed the value on s390, which dropped compat support in v6.19.
>
> Fixes: 9c06f26ba5f5 ("pwm: Add support for pwmchip devices for faster and easier userspace access")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Danish Khateeb <danishkhateeb03@gmail.com>
> ---
>
> Notes:
> Tested on x86_64 in QEMU (pwm/for-next 17dbb6938d3a plus this patch,
> KASAN and lockdep) with a PCA9685 instantiated on i2c-stub, which gets
> /dev/pwmchip0. A test program runs all six ioctls, including the error
> cases (hwpwm out of range or not requested, __pad != 0, use after FREE,
> SETEXACTWF returning -EDOM):
>
> - before: every ioctl from the -m32 build fails with -ENOTTY, while the
> 64-bit build works
> - after: the -m32 output matches the 64-bit output line for line
>
> No splats. W=1 builds are clean for arm64 (COMPAT=y, LLVM=1) and for
> i386 (no COMPAT).
>
> drivers/pwm/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> index 2a050ff4608b..4c6d716e5fde 100644
> --- a/drivers/pwm/core.c
> +++ b/drivers/pwm/core.c
> @@ -2389,6 +2389,7 @@ static const struct file_operations pwm_cdev_fileops = {
> .release = pwm_cdev_release,
> .owner = THIS_MODULE,
> .unlocked_ioctl = pwm_cdev_ioctl,
> + .compat_ioctl = compat_ptr_ioctl,
> };
Not entirely sure about the stable backport, but the change looks fine.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
but dropped the Cc:.
Thanks
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-09-29 14:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 18:44 [PATCH] pwm: Allow 32-bit tasks to use the character device Danish Khateeb
2026-09-29 14:11 ` Uwe Kleine-König [this message]
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=arvFsimmYhZWcOIR@monoceros \
--to=ukleinek@kernel.org \
--cc=danishkhateeb03@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.