From: Sasha Levin Date: Mon, 11 Jun 2012 15:18:13 +0000 (-0500) Subject: 9p: BUG before corrupting memory X-Git-Tag: upstream/snapshot3+hdmi~7204^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fcb08befaf57faa1b00e514915c1660252b8c26;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 9p: BUG before corrupting memory The BUG_ON() in pack_sg_list() would get triggered only one time after we've corrupted some memory by sg_set_buf() into an invalid sg buffer. I'm still working on figuring out why I manage to trigger that bug... Signed-off-by: Sasha Levin Signed-off-by: Eric Van Hensbergen --- diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 5af18d1..2a16765 100644 --- a/net/9p/trans_virtio.c +++ b/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;