Re: [PATCH 2/2] iov_iter: fix iov_iter_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 26, 2019 at 05:44:35AM -0700, Christoph Hellwig wrote:
> On Fri, Apr 26, 2019 at 06:45:21PM +0800, Ming Lei wrote:
> >  static inline enum iter_type iov_iter_type(const struct iov_iter *i)
> >  {
> > -	return i->type & ~(READ | WRITE);
> > +	return i->type & ~(READ | WRITE | ITER_BVEC_FLAG_NO_REF);
> 
> The way we handle i->type is a complete mess.  I think we need
> three different values:
> 
>    .rw (can be READ or WRITE)
>    .type (ITER_IOVEC, ITER_KVEC, ITER_BVEC, ITER_PIPE, ITER_DISCARD)
>    .flags (ITER_BVEC_FLAG_NO_REF)
> 
> .type seems to be worth an u8 on its own.  And at least as long
> as we have space rw and flags should probably be their own u8 aswell,
> although we could use accessors to fold them.

I agree we need a cleanup, which might be a bit bigger change. It should
be clean to convert them into bit fields.

This issue is quite serious, system ram can easily be leaked completely,
so could we fix the issue by the easy way first?

Thanks, 
Ming



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux