mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-26 21:54:11 +08:00
gpio: fixes for v5.4
- fix a memory leak in gpio-mockup - fix two flag validation bugs in gpiolib's character device ioctl()'s -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl13XhUACgkQEacuoBRx 13IzaBAAzrC+i1GShEq9tBy6kBT0CQ6DsTZIwjFm3OHR2zcPTu4SjPTQle6a3zWu 9xE3efY6hmHaIaFEz+zHy9kIccWVYpjyGr1YHUXtQUXlgnLaRNHKcFg2SBpABErM qIOrZRn2OG59ln3f3DYAU8BPgJ7GPj3NfYpKQV4GgMnJMrpQ9lPlReCOEfFIqDaI WzBTNDKyBmVMsAljd7zMuSDgLM/1plhl35sUVhID5dmUYGmRAfM+Wd1nQhdBKw9L jJJs6Qkb5J5ELL/RvLvQKr+wGifddr2t11ycyFM6cX5p77V3/RgS22MBsDnqFy1B HdwP6Td50mYq4XiIlNXhrAilLLnnVozlHU0jQGptks+LZnnZxjxUwSljwNHXfASI vAc+9uo1AYdlh/3+oZIwKpH/9po7ugLyek9YET++RvdMxNlYqioa0ON/GrEVZAg5 3lOaOu5UUOzqSMl4TntHlmXZ3Y/L6vCrFXNYczaDJyiec8CT/X2Txqzao0uJfGp8 hu13t0TI4fLKWSxtoACalAmDNeITLQidJiQ82Nwi6MzkLYYyjbYEFhF9vyd1lW9t riyOEZ2ycyqtc9GOY3hAX9hwyDMURlrhrdfmkMedvfYzALeBXNodA28QQySeBjKg oLYC5nF7gflSgrRrQjIq3VFtMfy00hmBxhBmFQazZB55lb67PtE= =Tdo8 -----END PGP SIGNATURE----- Merge tag 'gpio-v5.4-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes gpio: fixes for v5.4 - fix a memory leak in gpio-mockup - fix two flag validation bugs in gpiolib's character device ioctl()'s
This commit is contained in:
commit
aefde297da
@ -309,6 +309,7 @@ static const struct file_operations gpio_mockup_debugfs_ops = {
|
||||
.read = gpio_mockup_debugfs_read,
|
||||
.write = gpio_mockup_debugfs_write,
|
||||
.llseek = no_llseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static void gpio_mockup_debugfs_setup(struct device *dev,
|
||||
|
@ -535,6 +535,14 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
|
||||
if (lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Do not allow both INPUT & OUTPUT flags to be set as they are
|
||||
* contradictory.
|
||||
*/
|
||||
if ((lflags & GPIOHANDLE_REQUEST_INPUT) &&
|
||||
(lflags & GPIOHANDLE_REQUEST_OUTPUT))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Do not allow OPEN_SOURCE & OPEN_DRAIN flags in a single request. If
|
||||
* the hardware actually supports enabling both at the same time the
|
||||
@ -926,7 +934,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
}
|
||||
|
||||
/* This is just wrong: we don't look for events on output lines */
|
||||
if (lflags & GPIOHANDLE_REQUEST_OUTPUT) {
|
||||
if ((lflags & GPIOHANDLE_REQUEST_OUTPUT) ||
|
||||
(lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) ||
|
||||
(lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)) {
|
||||
ret = -EINVAL;
|
||||
goto out_free_label;
|
||||
}
|
||||
@ -940,10 +950,6 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
|
||||
if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
|
||||
set_bit(FLAG_ACTIVE_LOW, &desc->flags);
|
||||
if (lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN)
|
||||
set_bit(FLAG_OPEN_DRAIN, &desc->flags);
|
||||
if (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)
|
||||
set_bit(FLAG_OPEN_SOURCE, &desc->flags);
|
||||
|
||||
ret = gpiod_direction_input(desc);
|
||||
if (ret)
|
||||
|
Loading…
Reference in New Issue
Block a user