Re: [PATCH] Convert filldir() from __put_user() to unsafe_put_user()
From: Al Viro
Date: Tue Oct 08 2019 - 13:06:58 EST
On Tue, Oct 08, 2019 at 05:38:31PM +0200, Greg KH wrote:
> On Tue, Oct 08, 2019 at 04:29:00PM +0100, Al Viro wrote:
> > On Tue, Oct 08, 2019 at 03:14:16PM +0200, Greg KH wrote:
> > > On Tue, Oct 08, 2019 at 05:57:12AM +0100, Al Viro wrote:
> > > >
> > > > OK... BTW, do you agree that the use of access_ok() in
> > > > drivers/tty/n_hdlc.c:n_hdlc_tty_read() is wrong? It's used as an early
> > > > cutoff, so we don't bother waiting if user has passed an obviously bogus
> > > > address. copy_to_user() is used for actual copying there...
> > >
> > > Yes, it's wrong, and not needed. I'll go rip it out unless you want to?
> > I'll throw it into misc queue for now; it has no prereqs and nothing is going
> > to depend upon it.
> Great, thanks.
> > While looking for more of the same pattern: usb_device_read(). Frankly,
> > usb_device_dump() calling conventions look ugly - it smells like it
> > would be much happier as seq_file. Iterator would take some massage,
> > but that seems to be doable. Anyway, that's a separate story...
> That's just a debugfs file, and yes, it should be moved to seq_file. I
> think I tried it a long time ago, but given it's just a debugging thing,
> I gave up as it wasn't worth it.
> But yes, the access_ok() there also seems odd, and should be dropped.
I'm almost tempted to keep it there as a reminder/grep fodder ;-)
Seriously, though, it might be useful to have a way of marking the places
in need of gentle repair of retrocranial inversions _without_ attracting
the "checkpatch warning of the week" crowd...