Home / exploitsPDF  

Linux HID code NULL pointer dereference

Posted on 03 September 2013

<pre>I've found several issues in the Linux HID code. They are making their way into the Linux kernel via the linux-input tree now: http://marc.info/?l=linux-input&amp;m=137772180514608&amp;w=10001-HID-validate-HID-report-id-size.patch http://marc.info/?t=137772196600012&amp;r=1&amp;w=10014-HID-check-for-NULL-field-when-setting-values.patch Just a defensive change, since several drivers would have been less vulnerable with this check. Defensively check that the field to be worked on is not NULL. Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt; Cc: stable@kernel.org --- drivers/hid/hid-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 55798b2..192be6b 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1206,7 +1206,12 @@ EXPORT_SYMBOL_GPL(hid_output_report); int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) { - unsigned size = field-&gt;report_size; + unsigned size; + + if (!field) + return -1; + + size = field-&gt;report_size; hid_dump_input(field-&gt;report-&gt;device, field-&gt;usage + offset, value); </pre>

 

TOP