Messages in this thread | | | Date | Fri, 13 Jul 2018 10:31:54 +0200 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH] staging: speakup: fix wraparound in uaccess length check |
| |
On Thu, Jul 12, 2018 at 04:12:39PM -0700, Jann Horn wrote: > On Thu, Jul 12, 2018 at 3:47 PM Al Viro <viro@zeniv.linux.org.uk> wrote: > > > > On Fri, Jul 13, 2018 at 12:29:36AM +0200, Jann Horn wrote: > > > From: Samuel Thibault <samuel.thibault@ens-lyon.org> > > > > > > From: Samuel Thibault <samuel.thibault@ens-lyon.org> > > > > > > If softsynthx_read() is called with `count < 3`, `count - 3` wraps, causing > > > the loop to copy as much data as available to the provided buffer. If > > > softsynthx_read() is invoked through sys_splice(), this causes an > > > unbounded kernel write; but even when userspace just reads from it > > > normally, a small size could cause userspace crashes. > > > > Or you could try this (completely untested, though): > > I think this has the same problem as my original buggy patch: At the > point where you notice that you'd overflow the buffer, you've already > consumed a character from the synth buffer. You'd have to put it back, > and since the spinlock protecting it has been dropped, that's a bit > weird. > > Also, I'm not sure whether Greg prefers fixes for stable kernels that > don't also contain cleanup?
For staging code, I really don't care, as long as it's fixing an issue :)
thanks,
greg k-h
| |