Re: [PATCH 4/4] block: memory allocations in bounce_clone_bio must not fail

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

 



On Wed, Feb 24, 2021 at 05:12:36PM +0100, Christoph Hellwig wrote:
> On Wed, Feb 24, 2021 at 07:19:52PM +0800, Ming Lei wrote:
> > >  	if (bio_is_passthrough(bio_src))
> > > -		bio = bio_kmalloc(GFP_NOIO, bio_segments(bio_src));
> > > +		bio = bio_kmalloc(GFP_NOIO | __GFP_NOFAIL,
> > > +				  bio_segments(bio_src));
> > 
> > bio_kmalloc() still may fail if bio_segments(bio_src) is > UIO_MAXIOV.
> 
> Yes, but bio_kmalloc is what is used to allocate the passthrough
> requests to start with, so we'd not even make it here.

The original bio_kmalloc() may start with allowed nr_iovecs , but
later more pages are retrieved from iov_iter and added to the bio,
see bio_map_user_iov(). Then bounce_clone_bio() will see too big
bio_segments(bio_src) to be held in UIO_MAXIOV vecs.

This behavior is similar with blkdev_direct_IO().

-- 
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