From: Bob Peterson Date: Wed, 12 Sep 2012 13:40:31 +0000 (-0400) Subject: GFS2: Fix infinite loop in rbm_find X-Git-Tag: next-20120913~103^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a8b7d6cb4f01ddffb9e34b5e6dbd029577dc844f;p=karo-tx-linux.git GFS2: Fix infinite loop in rbm_find This patch fixes an infinite loop in gfs2_rbm_find that was introduced by the previous patch. The problem occurred when the length was less than 3 but the rbm block was byte-aligned, causing it to improperly return a extent length of zero, which caused it to spin. Signed-off-by: Bob Peterson Signed-off-by: Steven Whitehouse Tested-by: Bob Peterson Tested-by: Barry Marson --- diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index b933cdcda7f4..3cc402ce6fea 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -329,6 +329,7 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len) gfs2_unaligned_extlen(&rbm, 4 - n_unaligned, &len)) goto out; + n_unaligned = len & 3; /* Start is now byte aligned */ while (len > 3) { start = rbm.bi->bi_bh->b_data;