]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Fix thinko in iov_iter_single_seg_count
authorPaul Mackerras <paulus@samba.org>
Thu, 13 Nov 2014 09:15:23 +0000 (20:15 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2014 17:23:11 +0000 (09:23 -0800)
commit0c883ddfde0b06e27a2d3007cb1e8e0e188f92bd
tree4066ceb3fbc33c1fb0800bc97c2ef11c98333ad0
parent97c0bb6a458cc8937a3ca5d01bd8647da37c761c
Fix thinko in iov_iter_single_seg_count

commit ad0eab9293485d1c06237e9249f6d4dfa3d93d4d upstream.

The branches of the if (i->type & ITER_BVEC) statement in
iov_iter_single_seg_count() are the wrong way around; if ITER_BVEC is
clear then we use i->bvec, when we should be using i->iov.  This fixes
it.

In my case, the symptom that this caused was that a KVM guest doing
filesystem operations on a virtual disk would result in one of qemu's
threads on the host going into an infinite loop in
generic_perform_write().  The loop would hit the copied == 0 case and
call iov_iter_single_seg_count() to reduce the number of bytes to try
to process, but because of the error, iov_iter_single_seg_count()
would just return i->count and the loop made no progress and continued
forever.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/iov_iter.c