Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFSD/blocklayout: Fix minlength check in proc_layoutget

The extent returned by the file system may have a smaller offset than
the segment offset requested by the client. In this case, the minimum
segment length must be checked against the requested range. Otherwise,
the client may not be able to continue the read/write operation.

Fixes: 8650b8a05850 ("nfsd: pNFS block layout driver")
Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Sergey Bashirov and committed by
Chuck Lever
3524b021 566a4145

+3 -1
+3 -1
fs/nfsd/blocklayout.c
··· 23 23 { 24 24 struct nfsd4_layout_seg *seg = &args->lg_seg; 25 25 struct super_block *sb = inode->i_sb; 26 + u64 length; 26 27 u32 block_size = i_blocksize(inode); 27 28 struct pnfs_block_extent *bex; 28 29 struct iomap iomap; ··· 57 56 goto out_error; 58 57 } 59 58 60 - if (iomap.length < args->lg_minlength) { 59 + length = iomap.offset + iomap.length - seg->offset; 60 + if (length < args->lg_minlength) { 61 61 dprintk("pnfsd: extent smaller than minlength\n"); 62 62 goto out_layoutunavailable; 63 63 }