mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-12 05:48:39 +08:00
gpio fixes for v5.12-rc8
- do not allow exporting GPIO lines which were marked invalid by the driver -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmB4RdwACgkQEacuoBRx 13ItChAAydlxfHgcH0GFnOHOy6Ezp1hgxZF9Chu+YniFM7tNGRmA+Kty4J3o1dp7 j7d0+wZ7Ju3CJ6bO2Eun2NW7BN3UlFOpl0At2UjN6xybY+IrCZBq3w4RrmhI+xrJ Xbx0GuJKKqtCj8SRg6fAwLMopiHzO7UYd95NOEVpl3zAfHoxMi1dIxUs6vjxWL9f Hem/QcuMHZtYI62LAPHlNGUCxDavj1jWD7UNmLPLHJ1NagVqdXxhRhCuFCwt7nq/ ss0HvIATRoKKS6e28hNTOQTdI4FJViqflCleeGnXTEKK4DcwltcC3Ka+4Qsm3/Uz vIFAvi9FKctPCzc1JajyrQTd2oabTJ+bvv8AkxeDYYwdXZHCxIku/s4cmg7ioKn6 xLXM9OOpzc5x4nRksK6hPo/Q6iKh2Iy9lRYu2I9bgaJiL3tig3aSSOQLgin0dr4p E7Rr6yXCvQxyVQyyakgznFFTahaA61x2UdgPKM+Z6qjSbCLhS3yxZDaEaOxk0JyL OrFctItSkgtQoNecjS9pQ6msfJDFjS7qFuvwMZ+Tk91sOnseLCfD4HfxIjpiPJjh DeQ6+/dxnU8OGg7VQwI4DfATBc0g+2v5MlUUKPGrDdy3jAo9SlLqo9HFZ6HImEZZ Z0w4Vb8Q1vC6TlS7n+N2CAyrN2EaIRENG9/WBXv0lMggK58wz5A= =GnR0 -----END PGP SIGNATURE----- Merge tag 'gpio-fixes-for-v5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio fix from Bartosz Golaszewski: "A single fix for an older problem with the sysfs interface: do not allow exporting GPIO lines which were marked invalid by the driver" * tag 'gpio-fixes-for-v5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: sysfs: Obey valid_mask
This commit is contained in:
commit
33f0d9d94a
@ -458,6 +458,8 @@ static ssize_t export_store(struct class *class,
|
||||
long gpio;
|
||||
struct gpio_desc *desc;
|
||||
int status;
|
||||
struct gpio_chip *gc;
|
||||
int offset;
|
||||
|
||||
status = kstrtol(buf, 0, &gpio);
|
||||
if (status < 0)
|
||||
@ -469,6 +471,12 @@ static ssize_t export_store(struct class *class,
|
||||
pr_warn("%s: invalid GPIO %ld\n", __func__, gpio);
|
||||
return -EINVAL;
|
||||
}
|
||||
gc = desc->gdev->chip;
|
||||
offset = gpio_chip_hwgpio(desc);
|
||||
if (!gpiochip_line_is_valid(gc, offset)) {
|
||||
pr_warn("%s: GPIO %ld masked\n", __func__, gpio);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* No extra locking here; FLAG_SYSFS just signifies that the
|
||||
* request and export were done by on behalf of userspace, so
|
||||
|
Loading…
Reference in New Issue
Block a user