<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/hid/hidraw.c, branch linux-3.7.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>HID: hidraw: put old deallocation mechanism in place</title>
<updated>2012-11-01T10:33:26+00:00</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2012-11-01T10:33:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=df0cfd6990347c20ae031f3f34137cba274f1972'/>
<id>df0cfd6990347c20ae031f3f34137cba274f1972</id>
<content type='text'>
This basically reverts commit 4fe9f8e203fda. It causes multiple problems,
namely:

- after rmmod/modprobe cycle of bus driver, the input is not claimed any
  more. This is likely because of misplaced hid_hw_close()
- it causes memory corruption on hidraw_list

As original patch author is not responding to requests to fix his patch,
and the original deallocation mechanism is not exposing any problems, I
am reverting back to it.

Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This basically reverts commit 4fe9f8e203fda. It causes multiple problems,
namely:

- after rmmod/modprobe cycle of bus driver, the input is not claimed any
  more. This is likely because of misplaced hid_hw_close()
- it causes memory corruption on hidraw_list

As original patch author is not responding to requests to fix his patch,
and the original deallocation mechanism is not exposing any problems, I
am reverting back to it.

Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'upstream' into for-linus</title>
<updated>2012-10-01T12:37:51+00:00</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2012-10-01T12:37:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a3cbe10e474ac8c2c30a151a7812e15e4cfa2775'/>
<id>a3cbe10e474ac8c2c30a151a7812e15e4cfa2775</id>
<content type='text'>
Conflicts:
	drivers/hid/usbhid/hid-quirks.c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	drivers/hid/usbhid/hid-quirks.c
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: don't deallocate memory when it is in use</title>
<updated>2012-10-01T08:27:36+00:00</updated>
<author>
<name>Ratan Nalumasu</name>
<email>ratan@google.com</email>
</author>
<published>2012-09-22T18:46:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4fe9f8e203fdad1524c04beb390f3c6099781ed9'/>
<id>4fe9f8e203fdad1524c04beb390f3c6099781ed9</id>
<content type='text'>
When a device is unplugged, wait for all processes that have opened the device
to close before deallocating the device.

Signed-off-by: Ratan Nalumasu &lt;ratan@google.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a device is unplugged, wait for all processes that have opened the device
to close before deallocating the device.

Signed-off-by: Ratan Nalumasu &lt;ratan@google.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: improve error handling in hidraw_init()</title>
<updated>2012-08-15T19:37:09+00:00</updated>
<author>
<name>Alexey Khoroshilov</name>
<email>khoroshilov@ispras.ru</email>
</author>
<published>2012-08-15T19:31:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bcb4a75bde3821cecb17a71d287abfd6ef9bd68d'/>
<id>bcb4a75bde3821cecb17a71d287abfd6ef9bd68d</id>
<content type='text'>
Several improvements in error handling:
- do not report success if alloc_chrdev_region() failed
- check for error code of cdev_add()
- use unregister_chrdev_region() instead of unregister_chrdev()
  if class_create() failed

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov &lt;khoroshilov@ispras.ru&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Several improvements in error handling:
- do not report success if alloc_chrdev_region() failed
- check for error code of cdev_add()
- use unregister_chrdev_region() instead of unregister_chrdev()
  if class_create() failed

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov &lt;khoroshilov@ispras.ru&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: fix list-&gt;buffer memleak</title>
<updated>2012-07-20T08:02:23+00:00</updated>
<author>
<name>Matthieu CASTET</name>
<email>matthieu.castet@parrot.com</email>
</author>
<published>2012-06-28T14:51:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4c7b417ecb756e85dfc955b0e7a04fd45585533e'/>
<id>4c7b417ecb756e85dfc955b0e7a04fd45585533e</id>
<content type='text'>
If we don't read fast enough hidraw device, hidraw_report_event
will cycle and we will leak list-&gt;buffer.
Also list-&gt;buffer are not free on release.
After this patch, kmemleak report nothing.

Signed-off-by: Matthieu CASTET &lt;matthieu.castet@parrot.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we don't read fast enough hidraw device, hidraw_report_event
will cycle and we will leak list-&gt;buffer.
Also list-&gt;buffer are not free on release.
After this patch, kmemleak report nothing.

Signed-off-by: Matthieu CASTET &lt;matthieu.castet@parrot.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: add proper error handling to raw event reporting</title>
<updated>2012-04-27T18:10:09+00:00</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2012-04-26T22:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b6787242f32700377d3da3b8d788ab3928bab849'/>
<id>b6787242f32700377d3da3b8d788ab3928bab849</id>
<content type='text'>
If kmemdup() in hidraw_report_event() fails, we are not propagating
this fact properly.

Let hidraw_report_event() and hid_report_raw_event() return an error
value to the caller.

Reported-by: Oliver Neukum &lt;oneukum@suse.de&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If kmemdup() in hidraw_report_event() fails, we are not propagating
this fact properly.

Let hidraw_report_event() and hid_report_raw_event() return an error
value to the caller.

Reported-by: Oliver Neukum &lt;oneukum@suse.de&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'upstream' into for-linus</title>
<updated>2011-10-25T07:59:04+00:00</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2011-10-25T07:59:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b3aec7b686329e6bb65aa08c7f9458f7fd512f06'/>
<id>b3aec7b686329e6bb65aa08c7f9458f7fd512f06</id>
<content type='text'>
Conflicts:
	drivers/hid/hid-core.c
	drivers/hid/hid-ids.h
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	drivers/hid/hid-core.c
	drivers/hid/hid-ids.h
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: open count should not increase if error</title>
<updated>2011-09-27T16:42:22+00:00</updated>
<author>
<name>Amit Nagal</name>
<email>helloin.amit@gmail.com</email>
</author>
<published>2011-09-27T17:41:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f554ff80339b4005856e6a86454d6ea2bb962ee5'/>
<id>f554ff80339b4005856e6a86454d6ea2bb962ee5</id>
<content type='text'>
In hidraw_open, if hid_hw_power returns with error, hidraw device open count
should not increase.

Signed-off-by: Amit Nagal &lt;helloin.amit@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In hidraw_open, if hid_hw_power returns with error, hidraw device open count
should not increase.

Signed-off-by: Amit Nagal &lt;helloin.amit@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: protect hidraw_disconnect() better</title>
<updated>2011-09-20T13:23:46+00:00</updated>
<author>
<name>James Hogan</name>
<email>james.hogan@imgtec.com</email>
</author>
<published>2011-09-20T13:23:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=65b01bd561dc995aab116aa784f97a37f7c49a65'/>
<id>65b01bd561dc995aab116aa784f97a37f7c49a65</id>
<content type='text'>
The function hidraw_disconnect() only acquires the hidraw minors_lock
when clearing the entry in hidraw_table. However the device_destroy()
call can cause a userland read/write to return with an error. It may
cause the program to release the file descripter before the disconnect
is finished. hidraw_disconnect() has already set hidraw-&gt;exist to 0,
which makes hidraw_release() kfree the hidraw structure, which
hidraw_disconnect() continues to access and even tries to kfree again.
Similarly if a hidraw_release() occurs after setting hidraw-&gt;exist to 0,
the same thing can happen.

This is fixed by expanding the mutex critical section to cover the whole
function from setting hidraw-&gt;exist to 0 to freeing the hidraw
structure, preventing a hidraw_release() from interfering.

Signed-off-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Tested-by: David Herrmann &lt;dh.herrmann@googlemail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function hidraw_disconnect() only acquires the hidraw minors_lock
when clearing the entry in hidraw_table. However the device_destroy()
call can cause a userland read/write to return with an error. It may
cause the program to release the file descripter before the disconnect
is finished. hidraw_disconnect() has already set hidraw-&gt;exist to 0,
which makes hidraw_release() kfree the hidraw structure, which
hidraw_disconnect() continues to access and even tries to kfree again.
Similarly if a hidraw_release() occurs after setting hidraw-&gt;exist to 0,
the same thing can happen.

This is fixed by expanding the mutex critical section to cover the whole
function from setting hidraw-&gt;exist to 0 to freeing the hidraw
structure, preventing a hidraw_release() from interfering.

Signed-off-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Tested-by: David Herrmann &lt;dh.herrmann@googlemail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HID: hidraw: free list for all error in hidraw_open</title>
<updated>2011-09-07T11:48:47+00:00</updated>
<author>
<name>Amit Nagal</name>
<email>helloin.amit@gmail.com</email>
</author>
<published>2011-09-07T11:48:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1a8962317f494ad858971fc08ba035eff658a5c9'/>
<id>1a8962317f494ad858971fc08ba035eff658a5c9</id>
<content type='text'>
In function hidraw_open struct hidraw_list *list should be freed for
all error conditions.

Signed-off-by: Amit Nagal &lt;helloin.amit@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In function hidraw_open struct hidraw_list *list should be freed for
all error conditions.

Signed-off-by: Amit Nagal &lt;helloin.amit@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</pre>
</div>
</content>
</entry>
</feed>
