Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp574379pxj; Thu, 20 May 2021 16:39:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw73C7KUYDzoIyexeDGx7ISHmFu2dSwQg4q/pnQvy7xOQOkV8N/y6NQXLa0eHCIFJzzBdcv X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr7924198edw.162.1621553976944; Thu, 20 May 2021 16:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621553976; cv=none; d=google.com; s=arc-20160816; b=0Yb15XsYWKPSpvUoc/OKMh9HZsPon2iJ9b1ID18JzreitTRU8eIzxVXdd+iU25oIe6 ZyB+OOpKxunSHSpUim8iyZ3s5GhhS/RRztH7+P8F/cneR6mnjR3mk15JkfUTcXuuc3px m0zsKoaEEMoX4KFZ18H9ljwj5cNSPHfRp7Ig9Pfoh+uK5y8QlmUzPLO+bbAw4smx1Q3c iDmlWt5sB6/J+A3kXIWQz5267jkNhw82Yj4JK0xWuGdihG2xaraht4UG9HEgcfF7H5sP RJqZ9tO771/P8uRggkEtQ9fYcNSrPDlfeANwuUPgAn1ie2YW93pKS6fiPpqP4XTwnmO+ PUyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K1n6gzPAZ7i6ZBOjtaEXwiT1dSwKIQdoqFajDPjtFDQ=; b=g5257WSjr1eebGJqndciPMx8NrpCShgSX1g9CgsH1aOMTQjjppJQz5HNvKYxPyBjWu tbz9hvQTTkq8jJ8gAnZQ8Mu5uBzwIoqVKEJYmj1hY762aA7Nf7My0o1bSmR7RymFrGIV Lh2Ck4bcqIuPZmVPvqM60UYO2zC4sjd8Rmaj6z2c4atf1WK9NTNKm0973bOFvL6oQLSC CZPbP/axgq1pz2V3GelDWNUvQ6+uxt0WX889xfGGiAffCBlgW6hyHelJnBnH1S75SOCg W+xOgZH9ucNQxCCdnRuRBSMYpA4szcGThmrygVqy6vt1VNRP+BBZDsklxb/w7rf40b7Z /82g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WGufJpq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si3457689edt.321.2021.05.20.16.39.13; Thu, 20 May 2021 16:39:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WGufJpq7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240821AbhETLcN (ORCPT + 99 others); Thu, 20 May 2021 07:32:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:56406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239723AbhETLL3 (ORCPT ); Thu, 20 May 2021 07:11:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F1FB461D4F; Thu, 20 May 2021 10:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505256; bh=6qMJiWZ3pEETEodCSZjOD1Yryzg/jRm6fKQC5tedRcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WGufJpq78mDM1krK0IMl8v/IzxlMSi+xh1rb3UnZsn6VXePddCQIEGDRHa9gZgURW UJeNcqtpUWBVXXBBeBpUxm4LLGHTNBuLk+UBXoweQQfpFbqal27twVafiVQGfa7zkq JHfK+K71WabQh4coJefRl5h4nsxNYMOv2f8GWvJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Thornber , Ming-Hung Tsai , Mike Snitzer Subject: [PATCH 4.4 053/190] dm space map common: fix division bug in sm_ll_find_free_block() Date: Thu, 20 May 2021 11:21:57 +0200 Message-Id: <20210520092103.929066752@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Thornber commit 5208692e80a1f3c8ce2063a22b675dd5589d1d80 upstream. This division bug meant the search for free metadata space could skip the final allocation bitmap's worth of entries. Fix affects DM thinp, cache and era targets. Cc: stable@vger.kernel.org Signed-off-by: Joe Thornber Tested-by: Ming-Hung Tsai Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/persistent-data/dm-space-map-common.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c @@ -337,6 +337,8 @@ int sm_ll_find_free_block(struct ll_disk */ begin = do_div(index_begin, ll->entries_per_block); end = do_div(end, ll->entries_per_block); + if (end == 0) + end = ll->entries_per_block; for (i = index_begin; i < index_end; i++, begin = 0) { struct dm_block *blk;