mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
pwm: Two fixes and a maintainer update
Included here are three changes:
- pwm: Ensure ioctl() returns a negative errno on error
This affects two ioctls on /dev/pwmchipX where the return value of
copy_to_user() was passed to userspace. This is fixed to return
-EFAULT now instead.
You might argue that this is an ABI change, but I still think it's
sensible to be fixed because a) other exit paths already return
-EFAULT so userspace must be aware of this return value; b) the
interface is somewhat new (commit v6.17-rc1~181^2~35 ("pwm: Add
support for pwmchip devices for faster and easier userspace access"))
and the only known user is libpwm which relies on the fixed
semantics (and uses the ioctl correctly and thus doesn't trigger that
problematic error path); and c) it's very unlikely that
copy_to_user() fails if a moment before copy_from_user() on the same
memory chunk succeeded.
- pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops
This fixes an oversight in commit v6.18-rc1~168^2~3^2~6 which added
support for the max7360 driver. There is no user-visible effect
because the .sizeof_wfhw member is just a safe guard that the memory
provided by the core is big enough. While it currently is big enough
and there is no reason to assume that will change, doing that
correctly is necessary.
- MAINTAINERS: Add myself as reviewer for PWM rust drivers
"Myself" here is Michal Wilczynski who cares for the Rust parts of
the pwm subsystem. Several of the patches sent recently for the (for
now) only Rust pwm driver did not add Michal to Cc which resulted in
the patches waiting for review as I thought Michal would care but he
wasn't aware of them.
-----BEGIN PGP SIGNATURE-----
iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmlvR/AACgkQj4D7WH0S
/k6KoQgAmUmnCVrIcqdzSlC1drxdzhV9kAqTaVUi317xC3AtSquuUojrfwEiGnBq
v/p9we57m4jcRjt56Qrg6g23bt8U7F4OSiFKifXgCDrpoX5qdN/iCchOQ1SfR7fA
o0F4KSBZHCOCHBwUgfEQmXPMkEj5VaJ20xh6yLlyrIgkTlaMQ3TMyD39+uHk68Pm
hyaiCyYNOfu+UkYX2BbjNCCzAxTmdZim1vQ6iZsRrSY97+Fp+WDKvAErZUuPgzJQ
aqvBleJXMCS+y0w6hcoTAuf/g8YXAeNo+kYNANfzO1UKoXsyG0+feHbohKFA46L7
xKi/5Y1vd058EiNh12AW7MJ/u1GNwg==
=txwU
-----END PGP SIGNATURE-----
Merge tag 'pwm/for-6.19-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm fixes and a maintainer update from Uwe Kleine-König:
- pwm: Ensure ioctl() returns a negative errno on error
This affects two ioctls on /dev/pwmchipX where the return value of
copy_to_user() was passed to userspace. This is fixed to return
-EFAULT now instead.
- pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops
This fixes an oversight in the original commit that added support for
the max7360 driver (d93a75d94b: "pwm: max7360: Add MAX7360 PWM
support"). There is no user-visible effect because the .sizeof_wfhw
member is just a safe guard that the memory provided by the core is
big enough. While it currently is big enough and there is no reason
to assume that will change, doing that correctly is necessary.
- MAINTAINERS: Add Michal Wilczynski as reviewer for PWM rust drivers
Michal cares for the Rust parts of the pwm subsystem. Several of the
patches sent recently for the (for now) only Rust pwm driver did not
add Michal to Cc which resulted in the patches waiting for review as
I thought Michal would care but he wasn't aware of them.
* tag 'pwm/for-6.19-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
MAINTAINERS: Add myself as reviewer for PWM rust drivers
pwm: max7360: Populate missing .sizeof_wfhw in max7360_pwm_ops
pwm: Ensure ioctl() returns a negative errno on error
This commit is contained in:
commit
8f7537efbe
3 changed files with 11 additions and 4 deletions
|
|
@ -21103,6 +21103,10 @@ S: Maintained
|
|||
F: rust/helpers/pwm.c
|
||||
F: rust/kernel/pwm.rs
|
||||
|
||||
PWM SUBSYSTEM DRIVERS [RUST]
|
||||
R: Michal Wilczynski <m.wilczynski@samsung.com>
|
||||
F: drivers/pwm/*.rs
|
||||
|
||||
PXA GPIO DRIVER
|
||||
M: Robert Jarzmik <robert.jarzmik@free.fr>
|
||||
L: linux-gpio@vger.kernel.org
|
||||
|
|
|
|||
|
|
@ -2295,8 +2295,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
|
|||
.duty_offset_ns = wf.duty_offset_ns,
|
||||
};
|
||||
|
||||
return copy_to_user((struct pwmchip_waveform __user *)arg,
|
||||
&cwf, sizeof(cwf));
|
||||
ret = copy_to_user((struct pwmchip_waveform __user *)arg,
|
||||
&cwf, sizeof(cwf));
|
||||
return ret ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
case PWM_IOCTL_GETWF:
|
||||
|
|
@ -2329,8 +2330,9 @@ static long pwm_cdev_ioctl(struct file *file, unsigned int cmd, unsigned long ar
|
|||
.duty_offset_ns = wf.duty_offset_ns,
|
||||
};
|
||||
|
||||
return copy_to_user((struct pwmchip_waveform __user *)arg,
|
||||
&cwf, sizeof(cwf));
|
||||
ret = copy_to_user((struct pwmchip_waveform __user *)arg,
|
||||
&cwf, sizeof(cwf));
|
||||
return ret ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
case PWM_IOCTL_SETROUNDEDWF:
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ static int max7360_pwm_read_waveform(struct pwm_chip *chip,
|
|||
}
|
||||
|
||||
static const struct pwm_ops max7360_pwm_ops = {
|
||||
.sizeof_wfhw = sizeof(struct max7360_pwm_waveform),
|
||||
.request = max7360_pwm_request,
|
||||
.round_waveform_tohw = max7360_pwm_round_waveform_tohw,
|
||||
.round_waveform_fromhw = max7360_pwm_round_waveform_fromhw,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue