linux-stable/include/linux/gpio
Muchun Song 3555de57dc gpiolib: Fix possible use after free on label
[ Upstream commit 18534df419 ]

gpiod_request_commit() copies the pointer to the label passed as
an argument only to be used later. But there's a chance the caller
could immediately free the passed string(e.g., local variable).
This could trigger a use after free when we use gpio label(e.g.,
gpiochip_unlock_as_irq(), gpiochip_is_requested()).

To be on the safe side: duplicate the string with kstrdup_const()
so that if an unaware user passes an address to a stack-allocated
buffer, we won't get the arbitrary label.

Also fix gpiod_set_consumer_name().

Signed-off-by: Muchun Song <smuchun@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12 19:46:57 +01:00
..
aspeed.h gpio: aspeed: Add interfaces for co-processor to grab GPIOs 2018-07-02 16:10:15 +02:00
consumer.h gpiolib: Fix possible use after free on label 2019-02-12 19:46:57 +01:00
driver.h gpio: Assign gpio_irq_chip::parents to non-stack pointer 2018-10-10 14:03:27 +02:00
gpio-reg.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machine.h gpiolib: add hogs support for machine code 2018-05-16 14:35:24 +02:00