Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2520005pxj; Mon, 10 May 2021 05:05:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmCEEzH2K/y5L/WWogdAO9Z8l8sTwZ0t8MoBCOS6qPkAEYLJ35+KD5BRY31OeFyGHAFwIj X-Received: by 2002:aa7:c896:: with SMTP id p22mr29034002eds.225.1620648340490; Mon, 10 May 2021 05:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620648340; cv=none; d=google.com; s=arc-20160816; b=WKU0KS7o/jqKgl5Jt6ywG5ovpKka4CcBKzkLxTtKkT+bd3d7QyNufgTILZZfNBXMGH 2tzo4IcDf/hBigcZaa3nCkcO8sMnAa1kO9UxBi8BI8pWTYW6EaUjQOsP/MGvlkxJwEOO DtHVSycb4d076UVEwP4weiLLWnP4iHfnnXTujpZahq/ZsNNngcdD94AA63cYxHRwbmyR vQ6K6ojTycWzrYmzbRtTRAnqrG+01Qd+Bq2224hB8a2Bkz42SKa9KQ8Zq5rKRAGs9WbQ ZUIJAkHheGfUUKftloHQxK/Pc8JT3JeBFVXvMwZZfjOqjbGnEP43XKZgm9GVWuSDFUuA WL5g== 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=S92ug/NRVgRxTDd21nqChYTrvNodej+jcy90dih87V8=; b=caIpPc4Upico9v1IWxEA6//TKJIXVMlA/4PwVacC/ZjBSWioZepToVRN0hMXKVbpZo ORFj+fWS303OSa3hvPwU5lGzQedht0TLtAJeK17RCX5JyYGe9VNh749VokJ2hc1SOhvr hF1bpc1PNfzbfM9ncUTCm5sf/7FjzniaVWs+HOHJJcJ0G1+ehc+Jtf2KfSyhboCIpF3F U6JgjDVM/lil3iyKrAw4fx9fzUfo7SRZGPpBo+vQIcblgW2BsugXfrA8/R1EOVVwVoon WhAbfopjg2xvsEnpkrv5HkiCZGLUSRNPbKG9IGnXtCBYBWiUho/fah/Kc29PaaZCJpXE 8auw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Di59WkPf; 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 h5si13176361edz.533.2021.05.10.05.05.14; Mon, 10 May 2021 05:05:40 -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=Di59WkPf; 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 S244137AbhEJL6a (ORCPT + 99 others); Mon, 10 May 2021 07:58:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:37324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235812AbhEJLGN (ORCPT ); Mon, 10 May 2021 07:06:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F96161574; Mon, 10 May 2021 10:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644189; bh=NtnVhsCrJlwc9ibb08GT/mVphPR7+AFmpmECtR6zvYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Di59WkPfNAu3CjoFpV6pz4A0tsNcOFvBKerGLbwNsBm2GnMyR/8ruubPWZFTFQYbg VLi6lSZjoytbCg5FQdaz5WuYKqCGcFWB1Jn73wO+uWPJn8Q5fowX+1qOVz+JK8nHNy B3nkN1nmJm4Idvyybi/a16AJS6AkDA1tJihAlLJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyeongseok Kim , Sungjong Seo , Namjae Jeon Subject: [PATCH 5.11 289/342] exfat: fix erroneous discard when clear cluster bit Date: Mon, 10 May 2021 12:21:19 +0200 Message-Id: <20210510102019.663806438@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102010.096403571@linuxfoundation.org> References: <20210510102010.096403571@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: Hyeongseok Kim commit 77edfc6e51055b61cae2f54c8e6c3bb7c762e4fe upstream. If mounted with discard option, exFAT issues discard command when clear cluster bit to remove file. But the input parameter of cluster-to-sector calculation is abnormally added by reserved cluster size which is 2, leading to discard unrelated sectors included in target+2 cluster. With fixing this, remove the wrong comments in set/clear/find bitmap functions. Fixes: 1e49a94cf707 ("exfat: add bitmap operations") Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Hyeongseok Kim Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon Signed-off-by: Greg Kroah-Hartman --- fs/exfat/balloc.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) --- a/fs/exfat/balloc.c +++ b/fs/exfat/balloc.c @@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_i kfree(sbi->vol_amap); } -/* - * If the value of "clu" is 0, it means cluster 2 which is the first cluster of - * the cluster heap. - */ int exfat_set_bitmap(struct inode *inode, unsigned int clu) { int i, b; @@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode return 0; } -/* - * If the value of "clu" is 0, it means cluster 2 which is the first cluster of - * the cluster heap. - */ void exfat_clear_bitmap(struct inode *inode, unsigned int clu) { int i, b; @@ -186,8 +178,7 @@ void exfat_clear_bitmap(struct inode *in int ret_discard; ret_discard = sb_issue_discard(sb, - exfat_cluster_to_sector(sbi, clu + - EXFAT_RESERVED_CLUSTERS), + exfat_cluster_to_sector(sbi, clu), (1 << sbi->sect_per_clus_bits), GFP_NOFS, 0); if (ret_discard == -EOPNOTSUPP) {