Re: [PATCH v5] Input: Add userio module

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2015-09-19 17:39:29
Also in
linux-input, lkml
Reply to
unknown sender, 2015-09-17
Hi Stephen,

On Thu, Sep 17, 2015 at 07:00:10PM -0400, cpaul@redhat.com wrote:
				   Responses
* Re: if (!userio) in userio_device_write(): it happens if we close the file
  descriptor while the input driver is trying to talk to the device, since we
  can't immediately bring down the driver. Removing the condition breaks the
  driver
...
quoted hunk ↗ jump to hunk
+/**
+ * userio_device_write - Write data from serio to a userio device in userspace
+ * @id: The serio port for the userio device
+ * @val: The data to write to the device
+ */
+static int userio_device_write(struct serio *id, unsigned char val)
+{
+	struct userio_device *userio = id->port_data;
+
+	if (!userio)
+		return -1;
1. I do not see where we reset port data.
2. I do not see what prevents object to which you now have a pointer to
from disappearing at any moment past your check.
+
+	mutex_lock(&userio->lock);
serio_write() must allow to be called from interrupt context, so you
can't use mutex here.

Thanks.

-- 
Dmitry
Thread (19 messages) 19 messages, 4 authors, last reply 2015-10-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help