Explorar o código

Merge branch 'v9fs-devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

Pull a 9p bugfix from Eric Van Hensbergen.

* 'v9fs-devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: BUG before corrupting memory
Linus Torvalds %!s(int64=13) %!d(string=hai) anos
pai
achega
67f5d06d73
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      net/9p/trans_virtio.c

+ 1 - 1
net/9p/trans_virtio.c

@@ -192,10 +192,10 @@ static int pack_sg_list(struct scatterlist *sg, int start,
 		s = rest_of_page(data);
 		if (s > count)
 			s = count;
+		BUG_ON(index > limit);
 		sg_set_buf(&sg[index++], data, s);
 		count -= s;
 		data += s;
-		BUG_ON(index > limit);
 	}
 
 	return index-start;