Messages in this thread Patch in this message | | | From | Andrew Duggan <> | Subject | [PATCH] Input: synaptics-rmi4 - validate that the rmi_dev pointer is set before dereferencing it | Date | Wed, 23 Oct 2019 01:24:05 +0000 |
| |
A bug in hid-rmi was causing rmi_unregister_transport_device() to be called even if the call to rmi_register_transport_device() failed to allocate the rmi device. A patch has been submitted to fix the issue in hid-rmi. This patch will ensure that should a simialr situation occur then the rmi driver will not dereference a NULL pointer.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com> --- drivers/input/rmi4/rmi_bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index af706a583656..6c3abae1e159 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -118,8 +118,10 @@ void rmi_unregister_transport_device(struct rmi_transport_dev *xport) { struct rmi_device *rmi_dev = xport->rmi_dev; - device_del(&rmi_dev->dev); - put_device(&rmi_dev->dev); + if (rmi_dev) { + device_del(&rmi_dev->dev); + put_device(&rmi_dev->dev); + } } EXPORT_SYMBOL(rmi_unregister_transport_device); -- 2.20.1
| |