]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpio: cdev: check for NULL labels when sanitizing them for irqs
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 4 Apr 2024 09:33:27 +0000 (11:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:15 +0000 (16:38 +0200)
commit78d014644630fbaf4a35f15b7f49080205973e2d
treec284869f58cd407a3979c90799b50dbe38a380b7
parent0dab75b433ed2480d57ae4f8f725186a46223e42
gpio: cdev: check for NULL labels when sanitizing them for irqs

commit b3b95964590a3d756d69ea8604c856de805479ad upstream.

We need to take into account that a line's consumer label may be NULL
and not try to kstrdup() it in that case but rather pass the NULL
pointer up the stack to the interrupt request function.

To that end: let make_irq_label() return NULL as a valid return value
and use ERR_PTR() instead to signal an allocation failure to callers.

Cc: stable@vger.kernel.org
Fixes: b34490879baa ("gpio: cdev: sanitize the label before requesting the interrupt")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/lkml/20240402093534.212283-1-naresh.kamboju@linaro.org/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib-cdev.c