gpio: cdev: sanitize the label before requesting the interrupt
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 25 Mar 2024 09:02:42 +0000 (10:02 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 26 Mar 2024 11:43:35 +0000 (12:43 +0100)
commitb34490879baa847d16fc529c8ea6e6d34f004b38
tree31e2f3cbc1b7aed86d719f508c786b0f4cde9654
parent4cece764965020c22cff7665b18a012006359095
gpio: cdev: sanitize the label before requesting the interrupt

When an interrupt is requested, a procfs directory is created under
"/proc/irq/<irqnum>/<label>" where <label> is the string passed to one of
the request_irq() variants.

What follows is that the string must not contain the "/" character or
the procfs mkdir operation will fail. We don't have such constraints for
GPIO consumer labels which are used verbatim as interrupt labels for
GPIO irqs. We must therefore sanitize the consumer string before
requesting the interrupt.

Let's replace all "/" with ":".

Cc: stable@vger.kernel.org
Reported-by: Stefan Wahren <wahrenst@gmx.net>
Closes: https://lore.kernel.org/linux-gpio/39fe95cb-aa83-4b8b-8cab-63947a726754@gmx.net/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
drivers/gpio/gpiolib-cdev.c