Re: [patch] fix infinite loop in generic_file_splice_read()

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

 



Helló Miklós!
ez a patch szükséges a 2.6.22.y kernelhez? (2.6.22.y-ba első ránézésrehunk nélkül hozzáadható)vagy várjam meg, amig bekerül a mainline kernelbe?
On 4/9/08, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:> generic_file_splice_read() goes into an infinite loop if it races with> truncation.  I've found this with fsx-linux on NFS over fuse.>> Perhaps the whole while() loop is bogus, but I can't tell from a> cursory glance at __generic_file_splice_read() if it will return zero> only on EOF, or it can do that for other reasons as well.  In the> latter case the loop is obviously needed.>> This simplistic patch fixes the issue for me.>> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>> --->  fs/splice.c |   19 ++++++++++--------->  1 file changed, 10 insertions(+), 9 deletions(-)>> Index: linux/fs/splice.c> ===================================================================> --- linux.orig/fs/splice.c	2008-04-02 13:34:58.000000000 +0200> +++ linux/fs/splice.c	2008-04-09 17:35:06.000000000 +0200> @@ -481,19 +481,20 @@ ssize_t generic_file_splice_read(struct>  {>  	ssize_t spliced;>  	int ret;> -	loff_t isize, left;> -> -	isize = i_size_read(in->f_mapping->host);> -	if (unlikely(*ppos >= isize))> -		return 0;> -> -	left = isize - *ppos;> -	if (unlikely(left < len))> -		len = left;>>  	ret = 0;>  	spliced = 0;>  	while (len && !spliced) {> +		loff_t isize, left;> +> +		isize = i_size_read(in->f_mapping->host);> +		if (unlikely(*ppos >= isize))> +			return 0;> +> +		left = isize - *ppos;> +		if (unlikely(left < len))> +			len = left;> +>  		ret = __generic_file_splice_read(in, ppos, pipe, len, flags);>>  		if (ret < 0)> --> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in> the body of a message to majordomo@xxxxxxxxxxxxxxx> More majordomo info at  http://vger.kernel.org/majordomo-info.html> Please read the FAQ at  http://www.tux.org/lkml/>

-- Thanks,Oliver˙ôčş{.nÇ+?ˇ?Ž?­?+%?Ë˙ąéÝśĽ?w˙ş{.nÇ+?ˇĽ?{ąýűz÷Ľţ)í?ćčw*jgŹą¨ś????ݢj˙žŤţGŤ?é˙˘¸˘ˇŚj:+v?¨?wčjŘmś?˙ţřŻůŽwĽţ?ŕţfŁ˘ˇh??â?ú˙?ŮĽ


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux