]> git.baikalelectronics.ru Git - kernel.git/commit
gpiolib: cdev: fix null pointer dereference in linereq_free()
authorKent Gibson <warthog618@gmail.com>
Wed, 6 Jul 2022 08:45:07 +0000 (16:45 +0800)
committerBartosz Golaszewski <brgl@bgdev.pl>
Thu, 7 Jul 2022 10:18:18 +0000 (12:18 +0200)
commitc8f508f60e87118eda5c91ffab2a99befab4061f
tree76b9c9125ccfb8459b96efd4e84951ac978adc9e
parentc0bf56c61b5e3c4748f6c2c1201496923f0a0cd2
gpiolib: cdev: fix null pointer dereference in linereq_free()

Fix a kernel NULL pointer dereference reported by gpio kselftests.

linereq_free() can be called as part of the cleanup of a failed request,
at which time the desc for a line may not have been determined, so it
is unsafe to dereference without a check.

Add a check prior to dereferencing the line desc.

Fixes: de3d11d12aca ("gpiolib: cdev: Add hardware timestamp clock type")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpiolib-cdev.c