public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] USB: ldusb: fix ring-buffer bugs
@ 2019-10-18 14:17 Johan Hovold
  2019-10-18 14:17 ` [PATCH 1/2] USB: ldusb: fix read info leaks Johan Hovold
  2019-10-18 14:17 ` [PATCH RFC 2/2] USB: ldusb: fix ring-buffer locking Johan Hovold
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Hovold @ 2019-10-18 14:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Stern, Oliver Neukum, Paul E . McKenney, linux-usb,
	linux-kernel, Johan Hovold

Syzbot has been reporting a slab-out-of-bound/bad user copy in ldusb for
some time now.

This turned out to due to a bug in the read() implementation, which
would have read() access the uninitialised ring buffer and leak huge
amounts of slab data on URB completion errors (e.g. disconnect).

The first patch plugs the info leaks.

The second patch fixes a couple of issues in the custom ring-buffer
implementation, which before the first patch also could have led to
info leaks.

In an attempt to avoid copying the ring-buffer entry to a temporary
buffer while holding the spinlock, I added an smp_rmb() before
copy_to_user() which I think will suffice, but I'd appreciate if you
could help me verify that. Hence the RFC on that one.

The first commit could go to Linus meanwhile.

Johan


Johan Hovold (2):
  USB: ldusb: fix read info leaks
  USB: ldusb: fix ring-buffer locking

 drivers/usb/misc/ldusb.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

-- 
2.23.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-18 14:17 [PATCH 0/2] USB: ldusb: fix ring-buffer bugs Johan Hovold
2019-10-18 14:17 ` [PATCH 1/2] USB: ldusb: fix read info leaks Johan Hovold
2019-10-18 15:03   ` Johan Hovold
2019-10-18 14:17 ` [PATCH RFC 2/2] USB: ldusb: fix ring-buffer locking Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox