[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191023012344.20998-2-aduggan@synaptics.com>
Date: Wed, 23 Oct 2019 01:24:05 +0000
From: Andrew Duggan <aduggan@...aptics.com>
To: "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Andrew Duggan <aduggan@...aptics.com>,
Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Federico Cerutti <federico@...es-c.it>,
Christopher Heiny <Cheiny@...aptics.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>
Subject: [PATCH] Input: synaptics-rmi4 - validate that the rmi_dev pointer is
set before dereferencing it
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@...aptics.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
Powered by blists - more mailing lists