<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers, branch v3.10.106</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.106</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.106'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-06-07T22:47:12Z</updated>
<entry>
<title>char: lp: fix possible integer overflow in lp_setup()</title>
<updated>2017-06-07T22:47:12Z</updated>
<author>
<name>Willy Tarreau</name>
<email>w@1wt.eu</email>
</author>
<published>2017-05-16T17:18:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=66cb32401b6041356f0be44a302cdb42c20de6c2'/>
<id>urn:sha1:66cb32401b6041356f0be44a302cdb42c20de6c2</id>
<content type='text'>
commit 3e21f4af170bebf47c187c1ff8bf155583c9f3b1 upstream.

The lp_setup() code doesn't apply any bounds checking when passing
"lp=none", and only in this case, resulting in an overflow of the
parport_nr[] array. All versions in Git history are affected.

Reported-By: Roee Hay &lt;roee.hay@hcl.com&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>tty: n_hdlc: get rid of racy n_hdlc.tbuf</title>
<updated>2017-06-07T22:47:11Z</updated>
<author>
<name>Alexander Popov</name>
<email>alex.popov@linux.com</email>
</author>
<published>2017-02-28T16:54:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=030e0b58183ab3d7260e5246589427139067c3c4'/>
<id>urn:sha1:030e0b58183ab3d7260e5246589427139067c3c4</id>
<content type='text'>
commit 82f2341c94d270421f383641b7cd670e474db56b upstream.

Currently N_HDLC line discipline uses a self-made singly linked list for
data buffers and has n_hdlc.tbuf pointer for buffer retransmitting after
an error.

The commit be10eb7589337e5defbe214dae038a53dd21add8
("tty: n_hdlc add buffer flushing") introduced racy access to n_hdlc.tbuf.
After tx error concurrent flush_tx_queue() and n_hdlc_send_frames() can put
one data buffer to tx_free_buf_list twice. That causes double free in
n_hdlc_release().

Let's use standard kernel linked list and get rid of n_hdlc.tbuf:
in case of tx error put current data buffer after the head of tx_buf_list.

Signed-off-by: Alexander Popov &lt;alex.popov@linux.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>TTY: n_hdlc, fix lockdep false positive</title>
<updated>2017-06-07T22:47:11Z</updated>
<author>
<name>Jiri Slaby</name>
<email>jslaby@suse.cz</email>
</author>
<published>2015-11-26T18:28:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a9511e79f774fb01c4e06722d375059f1f7431e1'/>
<id>urn:sha1:a9511e79f774fb01c4e06722d375059f1f7431e1</id>
<content type='text'>
commit e9b736d88af1a143530565929390cadf036dc799 upstream.

The class of 4 n_hdls buf locks is the same because a single function
n_hdlc_buf_list_init is used to init all the locks. But since
flush_tx_queue takes n_hdlc-&gt;tx_buf_list.spinlock and then calls
n_hdlc_buf_put which takes n_hdlc-&gt;tx_free_buf_list.spinlock, lockdep
emits a warning:
=============================================
[ INFO: possible recursive locking detected ]
4.3.0-25.g91e30a7-default #1 Not tainted
---------------------------------------------
a.out/1248 is trying to acquire lock:
 (&amp;(&amp;list-&gt;spinlock)-&gt;rlock){......}, at: [&lt;ffffffffa01fd020&gt;] n_hdlc_buf_put+0x20/0x60 [n_hdlc]

but task is already holding lock:
 (&amp;(&amp;list-&gt;spinlock)-&gt;rlock){......}, at: [&lt;ffffffffa01fdc07&gt;] n_hdlc_tty_ioctl+0x127/0x1d0 [n_hdlc]

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&amp;(&amp;list-&gt;spinlock)-&gt;rlock);
  lock(&amp;(&amp;list-&gt;spinlock)-&gt;rlock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by a.out/1248:
 #0:  (&amp;tty-&gt;ldisc_sem){++++++}, at: [&lt;ffffffff814c9eb0&gt;] tty_ldisc_ref_wait+0x20/0x50
 #1:  (&amp;(&amp;list-&gt;spinlock)-&gt;rlock){......}, at: [&lt;ffffffffa01fdc07&gt;] n_hdlc_tty_ioctl+0x127/0x1d0 [n_hdlc]
...
Call Trace:
...
 [&lt;ffffffff81738fd0&gt;] _raw_spin_lock_irqsave+0x50/0x70
 [&lt;ffffffffa01fd020&gt;] n_hdlc_buf_put+0x20/0x60 [n_hdlc]
 [&lt;ffffffffa01fdc24&gt;] n_hdlc_tty_ioctl+0x144/0x1d0 [n_hdlc]
 [&lt;ffffffff814c25c1&gt;] tty_ioctl+0x3f1/0xe40
...

Fix it by initializing the spin_locks separately. This removes also
reduntand memset of a freshly kzallocated space.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>xc2028: Fix use-after-free bug properly</title>
<updated>2017-06-07T22:47:10Z</updated>
<author>
<name>Takashi Iwai</name>
<email>tiwai@suse.de</email>
</author>
<published>2016-11-17T09:49:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3bdb157105639fdcdff744432760c3f25c545678'/>
<id>urn:sha1:3bdb157105639fdcdff744432760c3f25c545678</id>
<content type='text'>
commit 22a1e7783e173ab3d86018eb590107d68df46c11 upstream.

The commit 8dfbcc4351a0 ("[media] xc2028: avoid use after free") tried
to address the reported use-after-free by clearing the reference.

However, it's clearing the wrong pointer; it sets NULL to
priv-&gt;ctrl.fname, but it's anyway overwritten by the next line
memcpy(&amp;priv-&gt;ctrl, p, sizeof(priv-&gt;ctrl)).

OTOH, the actual code accessing the freed string is the strcmp() call
with priv-&gt;fname:
	if (!firmware_name[0] &amp;&amp; p-&gt;fname &amp;&amp;
	    priv-&gt;fname &amp;&amp; strcmp(p-&gt;fname, priv-&gt;fname))
		free_firmware(priv);

where priv-&gt;fname points to the previous file name, and this was
already freed by kfree().

For fixing the bug properly, this patch does the following:

- Keep the copy of firmware file name in only priv-&gt;fname,
  priv-&gt;ctrl.fname isn't changed;
- The allocation is done only when the firmware gets loaded;
- The kfree() is called in free_firmware() commonly

Fixes: commit 8dfbcc4351a0 ('[media] xc2028: avoid use after free')
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>xc2028: unlock on error in xc2028_set_config()</title>
<updated>2017-06-07T22:47:10Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2016-02-03T15:34:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d9a854e53bed006a57a64d67888486d57f3490d0'/>
<id>urn:sha1:d9a854e53bed006a57a64d67888486d57f3490d0</id>
<content type='text'>
commit 210bd104c6acd31c3c6b8b075b3f12d4a9f6b60d upstream.

We have to unlock before returning -ENOMEM.

Fixes: 8dfbcc4351a0 ('[media] xc2028: avoid use after free')

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>xc2028: avoid use after free</title>
<updated>2017-06-07T22:47:10Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2016-01-28T11:22:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bb4884f2eee5e7acae86541578210bb6802797ae'/>
<id>urn:sha1:bb4884f2eee5e7acae86541578210bb6802797ae</id>
<content type='text'>
commit 8dfbcc4351a0b6d2f2d77f367552f48ffefafe18 upstream.

If struct xc2028_config is passed without a firmware name,
the following trouble may happen:

[11009.907205] xc2028 5-0061: type set to XCeive xc2028/xc3028 tuner
[11009.907491] ==================================================================
[11009.907750] BUG: KASAN: use-after-free in strcmp+0x96/0xb0 at addr ffff8803bd78ab40
[11009.907992] Read of size 1 by task modprobe/28992
[11009.907994] =============================================================================
[11009.907997] BUG kmalloc-16 (Tainted: G        W      ): kasan: bad access detected
[11009.907999] -----------------------------------------------------------------------------

[11009.908008] INFO: Allocated in xhci_urb_enqueue+0x214/0x14c0 [xhci_hcd] age=0 cpu=3 pid=28992
[11009.908012] 	___slab_alloc+0x581/0x5b0
[11009.908014] 	__slab_alloc+0x51/0x90
[11009.908017] 	__kmalloc+0x27b/0x350
[11009.908022] 	xhci_urb_enqueue+0x214/0x14c0 [xhci_hcd]
[11009.908026] 	usb_hcd_submit_urb+0x1e8/0x1c60
[11009.908029] 	usb_submit_urb+0xb0e/0x1200
[11009.908032] 	usb_serial_generic_write_start+0xb6/0x4c0
[11009.908035] 	usb_serial_generic_write+0x92/0xc0
[11009.908039] 	usb_console_write+0x38a/0x560
[11009.908045] 	call_console_drivers.constprop.14+0x1ee/0x2c0
[11009.908051] 	console_unlock+0x40d/0x900
[11009.908056] 	vprintk_emit+0x4b4/0x830
[11009.908061] 	vprintk_default+0x1f/0x30
[11009.908064] 	printk+0x99/0xb5
[11009.908067] 	kasan_report_error+0x10a/0x550
[11009.908070] 	__asan_report_load1_noabort+0x43/0x50
[11009.908074] INFO: Freed in xc2028_set_config+0x90/0x630 [tuner_xc2028] age=1 cpu=3 pid=28992
[11009.908077] 	__slab_free+0x2ec/0x460
[11009.908080] 	kfree+0x266/0x280
[11009.908083] 	xc2028_set_config+0x90/0x630 [tuner_xc2028]
[11009.908086] 	xc2028_attach+0x310/0x8a0 [tuner_xc2028]
[11009.908090] 	em28xx_attach_xc3028.constprop.7+0x1f9/0x30d [em28xx_dvb]
[11009.908094] 	em28xx_dvb_init.part.3+0x8e4/0x5cf4 [em28xx_dvb]
[11009.908098] 	em28xx_dvb_init+0x81/0x8a [em28xx_dvb]
[11009.908101] 	em28xx_register_extension+0xd9/0x190 [em28xx]
[11009.908105] 	em28xx_dvb_register+0x10/0x1000 [em28xx_dvb]
[11009.908108] 	do_one_initcall+0x141/0x300
[11009.908111] 	do_init_module+0x1d0/0x5ad
[11009.908114] 	load_module+0x6666/0x9ba0
[11009.908117] 	SyS_finit_module+0x108/0x130
[11009.908120] 	entry_SYSCALL_64_fastpath+0x16/0x76
[11009.908123] INFO: Slab 0xffffea000ef5e280 objects=25 used=25 fp=0x          (null) flags=0x2ffff8000004080
[11009.908126] INFO: Object 0xffff8803bd78ab40 @offset=2880 fp=0x0000000000000001

[11009.908130] Bytes b4 ffff8803bd78ab30: 01 00 00 00 2a 07 00 00 9d 28 00 00 01 00 00 00  ....*....(......
[11009.908133] Object ffff8803bd78ab40: 01 00 00 00 00 00 00 00 b0 1d c3 6a 00 88 ff ff  ...........j....
[11009.908137] CPU: 3 PID: 28992 Comm: modprobe Tainted: G    B   W       4.5.0-rc1+ #43
[11009.908140] Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
[11009.908142]  ffff8803bd78a000 ffff8802c273f1b8 ffffffff81932007 ffff8803c6407a80
[11009.908148]  ffff8802c273f1e8 ffffffff81556759 ffff8803c6407a80 ffffea000ef5e280
[11009.908153]  ffff8803bd78ab40 dffffc0000000000 ffff8802c273f210 ffffffff8155ccb4
[11009.908158] Call Trace:
[11009.908162]  [&lt;ffffffff81932007&gt;] dump_stack+0x4b/0x64
[11009.908165]  [&lt;ffffffff81556759&gt;] print_trailer+0xf9/0x150
[11009.908168]  [&lt;ffffffff8155ccb4&gt;] object_err+0x34/0x40
[11009.908171]  [&lt;ffffffff8155f260&gt;] kasan_report_error+0x230/0x550
[11009.908175]  [&lt;ffffffff81237d71&gt;] ? trace_hardirqs_off_caller+0x21/0x290
[11009.908179]  [&lt;ffffffff8155e926&gt;] ? kasan_unpoison_shadow+0x36/0x50
[11009.908182]  [&lt;ffffffff8155f5c3&gt;] __asan_report_load1_noabort+0x43/0x50
[11009.908185]  [&lt;ffffffff8155ea00&gt;] ? __asan_register_globals+0x50/0xa0
[11009.908189]  [&lt;ffffffff8194cea6&gt;] ? strcmp+0x96/0xb0
[11009.908192]  [&lt;ffffffff8194cea6&gt;] strcmp+0x96/0xb0
[11009.908196]  [&lt;ffffffffa13ba4ac&gt;] xc2028_set_config+0x15c/0x630 [tuner_xc2028]
[11009.908200]  [&lt;ffffffffa13bac90&gt;] xc2028_attach+0x310/0x8a0 [tuner_xc2028]
[11009.908203]  [&lt;ffffffff8155ea78&gt;] ? memset+0x28/0x30
[11009.908206]  [&lt;ffffffffa13ba980&gt;] ? xc2028_set_config+0x630/0x630 [tuner_xc2028]
[11009.908211]  [&lt;ffffffffa157a59a&gt;] em28xx_attach_xc3028.constprop.7+0x1f9/0x30d [em28xx_dvb]
[11009.908215]  [&lt;ffffffffa157aa2a&gt;] ? em28xx_dvb_init.part.3+0x37c/0x5cf4 [em28xx_dvb]
[11009.908219]  [&lt;ffffffffa157a3a1&gt;] ? hauppauge_hvr930c_init+0x487/0x487 [em28xx_dvb]
[11009.908222]  [&lt;ffffffffa01795ac&gt;] ? lgdt330x_attach+0x1cc/0x370 [lgdt330x]
[11009.908226]  [&lt;ffffffffa01793e0&gt;] ? i2c_read_demod_bytes.isra.2+0x210/0x210 [lgdt330x]
[11009.908230]  [&lt;ffffffff812e87d0&gt;] ? ref_module.part.15+0x10/0x10
[11009.908233]  [&lt;ffffffff812e56e0&gt;] ? module_assert_mutex_or_preempt+0x80/0x80
[11009.908238]  [&lt;ffffffffa157af92&gt;] em28xx_dvb_init.part.3+0x8e4/0x5cf4 [em28xx_dvb]
[11009.908242]  [&lt;ffffffffa157a6ae&gt;] ? em28xx_attach_xc3028.constprop.7+0x30d/0x30d [em28xx_dvb]
[11009.908245]  [&lt;ffffffff8195222d&gt;] ? string+0x14d/0x1f0
[11009.908249]  [&lt;ffffffff8195381f&gt;] ? symbol_string+0xff/0x1a0
[11009.908253]  [&lt;ffffffff81953720&gt;] ? uuid_string+0x6f0/0x6f0
[11009.908257]  [&lt;ffffffff811a775e&gt;] ? __kernel_text_address+0x7e/0xa0
[11009.908260]  [&lt;ffffffff8104b02f&gt;] ? print_context_stack+0x7f/0xf0
[11009.908264]  [&lt;ffffffff812e9846&gt;] ? __module_address+0xb6/0x360
[11009.908268]  [&lt;ffffffff8137fdc9&gt;] ? is_ftrace_trampoline+0x99/0xe0
[11009.908271]  [&lt;ffffffff811a775e&gt;] ? __kernel_text_address+0x7e/0xa0
[11009.908275]  [&lt;ffffffff81240a70&gt;] ? debug_check_no_locks_freed+0x290/0x290
[11009.908278]  [&lt;ffffffff8104a24b&gt;] ? dump_trace+0x11b/0x300
[11009.908282]  [&lt;ffffffffa13e8143&gt;] ? em28xx_register_extension+0x23/0x190 [em28xx]
[11009.908285]  [&lt;ffffffff81237d71&gt;] ? trace_hardirqs_off_caller+0x21/0x290
[11009.908289]  [&lt;ffffffff8123ff56&gt;] ? trace_hardirqs_on_caller+0x16/0x590
[11009.908292]  [&lt;ffffffff812404dd&gt;] ? trace_hardirqs_on+0xd/0x10
[11009.908296]  [&lt;ffffffffa13e8143&gt;] ? em28xx_register_extension+0x23/0x190 [em28xx]
[11009.908299]  [&lt;ffffffff822dcbb0&gt;] ? mutex_trylock+0x400/0x400
[11009.908302]  [&lt;ffffffff810021a1&gt;] ? do_one_initcall+0x131/0x300
[11009.908306]  [&lt;ffffffff81296dc7&gt;] ? call_rcu_sched+0x17/0x20
[11009.908309]  [&lt;ffffffff8159e708&gt;] ? put_object+0x48/0x70
[11009.908314]  [&lt;ffffffffa1579f11&gt;] em28xx_dvb_init+0x81/0x8a [em28xx_dvb]
[11009.908317]  [&lt;ffffffffa13e81f9&gt;] em28xx_register_extension+0xd9/0x190 [em28xx]
[11009.908320]  [&lt;ffffffffa0150000&gt;] ? 0xffffffffa0150000
[11009.908324]  [&lt;ffffffffa0150010&gt;] em28xx_dvb_register+0x10/0x1000 [em28xx_dvb]
[11009.908327]  [&lt;ffffffff810021b1&gt;] do_one_initcall+0x141/0x300
[11009.908330]  [&lt;ffffffff81002070&gt;] ? try_to_run_init_process+0x40/0x40
[11009.908333]  [&lt;ffffffff8123ff56&gt;] ? trace_hardirqs_on_caller+0x16/0x590
[11009.908337]  [&lt;ffffffff8155e926&gt;] ? kasan_unpoison_shadow+0x36/0x50
[11009.908340]  [&lt;ffffffff8155e926&gt;] ? kasan_unpoison_shadow+0x36/0x50
[11009.908343]  [&lt;ffffffff8155e926&gt;] ? kasan_unpoison_shadow+0x36/0x50
[11009.908346]  [&lt;ffffffff8155ea37&gt;] ? __asan_register_globals+0x87/0xa0
[11009.908350]  [&lt;ffffffff8144da7b&gt;] do_init_module+0x1d0/0x5ad
[11009.908353]  [&lt;ffffffff812f2626&gt;] load_module+0x6666/0x9ba0
[11009.908356]  [&lt;ffffffff812e9c90&gt;] ? symbol_put_addr+0x50/0x50
[11009.908361]  [&lt;ffffffffa1580037&gt;] ? em28xx_dvb_init.part.3+0x5989/0x5cf4 [em28xx_dvb]
[11009.908366]  [&lt;ffffffff812ebfc0&gt;] ? module_frob_arch_sections+0x20/0x20
[11009.908369]  [&lt;ffffffff815bc940&gt;] ? open_exec+0x50/0x50
[11009.908374]  [&lt;ffffffff811671bb&gt;] ? ns_capable+0x5b/0xd0
[11009.908377]  [&lt;ffffffff812f5e58&gt;] SyS_finit_module+0x108/0x130
[11009.908379]  [&lt;ffffffff812f5d50&gt;] ? SyS_init_module+0x1f0/0x1f0
[11009.908383]  [&lt;ffffffff81004044&gt;] ? lockdep_sys_exit_thunk+0x12/0x14
[11009.908394]  [&lt;ffffffff822e6936&gt;] entry_SYSCALL_64_fastpath+0x16/0x76
[11009.908396] Memory state around the buggy address:
[11009.908398]  ffff8803bd78aa00: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[11009.908401]  ffff8803bd78aa80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[11009.908403] &gt;ffff8803bd78ab00: fc fc fc fc fc fc fc fc 00 00 fc fc fc fc fc fc
[11009.908405]                                            ^
[11009.908407]  ffff8803bd78ab80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[11009.908409]  ffff8803bd78ac00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[11009.908411] ==================================================================

In order to avoid it, let's set the cached value of the firmware
name to NULL after freeing it. While here, return an error if
the memory allocation fails.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: avoid vfree() on crash</title>
<updated>2017-06-07T22:47:10Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
<email>vkuznets@redhat.com</email>
</author>
<published>2016-06-04T00:09:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9391c802ff00fc5873e91ce26dd08c9f4e2a8e92'/>
<id>urn:sha1:9391c802ff00fc5873e91ce26dd08c9f4e2a8e92</id>
<content type='text'>
commit a9f61ca793becabdefab03b77568d6c6f8c1bc79 upstream.

When we crash from NMI context (e.g. after NMI injection from host when
'sysctl -w kernel.unknown_nmi_panic=1' is set) we hit

    kernel BUG at mm/vmalloc.c:1530!

as vfree() is denied. While the issue could be solved with in_nmi() check
instead I opted for skipping vfree on all sorts of crashes to reduce the
amount of work which can cause consequent crashes. We don't really need to
free anything on crash.

[js] no tsc and kexec in 3.12 yet

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Signed-off-by: K. Y. Srinivasan &lt;kys@microsoft.com&gt;
Cc: Sumit Semwal &lt;sumit.semwal@linaro.org&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>USB: dummy-hcd: fix bug in stop_activity (handle ep0)</title>
<updated>2017-06-07T22:47:09Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2016-12-14T19:55:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5765ee44877fbc13bc112878a807048b0e66a8ad'/>
<id>urn:sha1:5765ee44877fbc13bc112878a807048b0e66a8ad</id>
<content type='text'>
commit bcdbeb844773333d2d1c08004f3b3e25921040e5 upstream.

The stop_activity() routine in dummy-hcd is supposed to unlink all
active requests for every endpoint, among other things.  But it
doesn't handle ep0.  As a result, fuzz testing can generate a WARNING
like the following:

WARNING: CPU: 0 PID: 4410 at drivers/usb/gadget/udc/dummy_hcd.c:672 dummy_free_request+0x153/0x170
Modules linked in:
CPU: 0 PID: 4410 Comm: syz-executor Not tainted 4.9.0-rc7+ #32
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffff88006a64ed10 ffffffff81f96b8a ffffffff41b58ab3 1ffff1000d4c9d35
 ffffed000d4c9d2d ffff880065f8ac00 0000000041b58ab3 ffffffff8598b510
 ffffffff81f968f8 0000000041b58ab3 ffffffff859410e0 ffffffff813f0590
Call Trace:
 [&lt;     inline     &gt;] __dump_stack lib/dump_stack.c:15
 [&lt;ffffffff81f96b8a&gt;] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [&lt;ffffffff812b808f&gt;] __warn+0x19f/0x1e0 kernel/panic.c:550
 [&lt;ffffffff812b831c&gt;] warn_slowpath_null+0x2c/0x40 kernel/panic.c:585
 [&lt;ffffffff830fcb13&gt;] dummy_free_request+0x153/0x170 drivers/usb/gadget/udc/dummy_hcd.c:672
 [&lt;ffffffff830ed1b0&gt;] usb_ep_free_request+0xc0/0x420 drivers/usb/gadget/udc/core.c:195
 [&lt;ffffffff83225031&gt;] gadgetfs_unbind+0x131/0x190 drivers/usb/gadget/legacy/inode.c:1612
 [&lt;ffffffff830ebd8f&gt;] usb_gadget_remove_driver+0x10f/0x2b0 drivers/usb/gadget/udc/core.c:1228
 [&lt;ffffffff830ec084&gt;] usb_gadget_unregister_driver+0x154/0x240 drivers/usb/gadget/udc/core.c:1357

This patch fixes the problem by iterating over all the endpoints in
the driver's ep array instead of iterating over the gadget's ep_list,
which explicitly leaves out ep0.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>USB: fix problems with duplicate endpoint addresses</title>
<updated>2017-06-07T22:47:09Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2016-12-19T17:03:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=15668b4354b38b41b316571deed2763d631b2977'/>
<id>urn:sha1:15668b4354b38b41b316571deed2763d631b2977</id>
<content type='text'>
commit 0a8fd1346254974c3a852338508e4a4cddbb35f1 upstream.

When checking a new device's descriptors, the USB core does not check
for duplicate endpoint addresses.  This can cause a problem when the
sysfs files for those endpoints are created; trying to create multiple
files with the same name will provoke a WARNING:

WARNING: CPU: 2 PID: 865 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x8a/0xa0
sysfs: cannot create duplicate filename
'/devices/platform/dummy_hcd.0/usb2/2-1/2-1:64.0/ep_05'
Kernel panic - not syncing: panic_on_warn set ...

CPU: 2 PID: 865 Comm: kworker/2:1 Not tainted 4.9.0-rc7+ #34
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
 ffff88006bee64c8 ffffffff81f96b8a ffffffff00000001 1ffff1000d7dcc2c
 ffffed000d7dcc24 0000000000000001 0000000041b58ab3 ffffffff8598b510
 ffffffff81f968f8 ffffffff850fee20 ffffffff85cff020 dffffc0000000000
Call Trace:
 [&lt;     inline     &gt;] __dump_stack lib/dump_stack.c:15
 [&lt;ffffffff81f96b8a&gt;] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [&lt;ffffffff8168c88e&gt;] panic+0x1cb/0x3a9 kernel/panic.c:179
 [&lt;ffffffff812b80b4&gt;] __warn+0x1c4/0x1e0 kernel/panic.c:542
 [&lt;ffffffff812b8195&gt;] warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:565
 [&lt;ffffffff819e70ca&gt;] sysfs_warn_dup+0x8a/0xa0 fs/sysfs/dir.c:30
 [&lt;ffffffff819e7308&gt;] sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:59
 [&lt;     inline     &gt;] create_dir lib/kobject.c:71
 [&lt;ffffffff81fa1b07&gt;] kobject_add_internal+0x227/0xa60 lib/kobject.c:229
 [&lt;     inline     &gt;] kobject_add_varg lib/kobject.c:366
 [&lt;ffffffff81fa2479&gt;] kobject_add+0x139/0x220 lib/kobject.c:411
 [&lt;ffffffff82737a63&gt;] device_add+0x353/0x1660 drivers/base/core.c:1088
 [&lt;ffffffff82738d8d&gt;] device_register+0x1d/0x20 drivers/base/core.c:1206
 [&lt;ffffffff82cb77d3&gt;] usb_create_ep_devs+0x163/0x260 drivers/usb/core/endpoint.c:195
 [&lt;ffffffff82c9f27b&gt;] create_intf_ep_devs+0x13b/0x200 drivers/usb/core/message.c:1030
 [&lt;ffffffff82ca39d3&gt;] usb_set_configuration+0x1083/0x18d0 drivers/usb/core/message.c:1937
 [&lt;ffffffff82cc9e2e&gt;] generic_probe+0x6e/0xe0 drivers/usb/core/generic.c:172
 [&lt;ffffffff82caa7fa&gt;] usb_probe_device+0xaa/0xe0 drivers/usb/core/driver.c:263

This patch prevents the problem by checking for duplicate endpoint
addresses during enumeration and skipping any duplicates.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Tested-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>USB: usbtmc: add missing endpoint sanity check</title>
<updated>2017-06-07T22:47:09Z</updated>
<author>
<name>Johan Hovold</name>
<email>johan@kernel.org</email>
</author>
<published>2017-03-14T16:55:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3d46433da69cf192317c0368082caa33177a3939'/>
<id>urn:sha1:3d46433da69cf192317c0368082caa33177a3939</id>
<content type='text'>
commit 687e0687f71ec00e0132a21fef802dee88c2f1ad upstream.

USBTMC devices are required to have a bulk-in and a bulk-out endpoint,
but the driver failed to verify this, something which could lead to the
endpoint addresses being taken from uninitialised memory.

Make sure to zero all private data as part of allocation, and add the
missing endpoint sanity check.

Note that this also addresses a more recently introduced issue, where
the interrupt-in-presence flag would also be uninitialised whenever the
optional interrupt-in endpoint is not present. This in turn could lead
to an interrupt urb being allocated, initialised and submitted based on
uninitialised values.

Fixes: dbf3e7f654c0 ("Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.")
Fixes: 5b775f672cc9 ("USB: add USB test and measurement class driver")
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
[ johan: backport to v4.4 ]
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
</feed>
