From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E8BAC43387 for ; Fri, 11 Jan 2019 14:44:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4121221841 for ; Fri, 11 Jan 2019 14:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217849; bh=p0HcT2UTNZVTQY7pTc8FF5T6l2SMhd3UKSaZhQZN4E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ozND5JsTVlCxmE/G9q/nMbE2Ci87rkOfbLacXfbjyEhh7h2ZrYX+Y14FsGI7d98hM y2NWLKXPiyWSD8/3Ftq8imJLDyqQ7Yg3BclwyLdyOn3rl3m+MiHAyS0INgojczCg/S hDpz03dW2ZvHSXKpv6DvcsLsQTJLtTPowg7oHnrc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404549AbfAKOoI (ORCPT ); Fri, 11 Jan 2019 09:44:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:37002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404527AbfAKOoC (ORCPT ); Fri, 11 Jan 2019 09:44:02 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E4B052063F; Fri, 11 Jan 2019 14:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547217842; bh=p0HcT2UTNZVTQY7pTc8FF5T6l2SMhd3UKSaZhQZN4E8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgsts8GLRwCapOMF+1L7doZHY3wQuHQA+ao5BJqKpzVMGn01sRq4y+RIC02rjk+ys 6vMzYqGQ9wSnUpuigRYx2oczTKCTc9xkJZeyU1BEKuVaZo7aq5JyPmGrIf++H64pZ+ UhSJ1WXA2BgB87s7LcfP4gHWapuDGqIN3GFJZj5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher , Bob Peterson Subject: [PATCH 4.20 34/65] gfs2: Fix loop in gfs2_rbm_find Date: Fri, 11 Jan 2019 15:15:20 +0100 Message-Id: <20190111131101.050023821@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131055.331350141@linuxfoundation.org> References: <20190111131055.331350141@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Gruenbacher commit 2d29f6b96d8f80322ed2dd895bca590491c38d34 upstream. Fix the resource group wrap-around logic in gfs2_rbm_find that commit e579ed4f44 broke. The bug can lead to unnecessary repeated scanning of the same bitmaps; there is a risk that future changes will turn this into an endless loop. Fixes: e579ed4f44 ("GFS2: Introduce rbm field bii") Cc: stable@vger.kernel.org # v3.13+ Signed-off-by: Andreas Gruenbacher Signed-off-by: Bob Peterson Signed-off-by: Greg Kroah-Hartman --- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm goto next_iter; } if (ret == -E2BIG) { + n += rbm->bii - initial_bii; rbm->bii = 0; rbm->offset = 0; - n += (rbm->bii - initial_bii); goto res_covered_end_of_rgrp; } return ret;