Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2199508iof; Tue, 7 Jun 2022 23:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwid2JFvaoaUCkyBau3IDWbZRIfPAj5dJQYqZ+upKfJRtcyl2kGnxYjdEvAoX9HUdWX5CfD X-Received: by 2002:aa7:88cb:0:b0:51c:2627:2c03 with SMTP id k11-20020aa788cb000000b0051c26272c03mr12079125pff.63.1654668037384; Tue, 07 Jun 2022 23:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668037; cv=none; d=google.com; s=arc-20160816; b=edrxzRCkLTGvSTvMR5z6COI/zjfeREZl+Xw500Q3Ow90hyn71ztUX4LgnxH71UjTAI DgJffVyDO73Q054jAF+iIB3n0LE3lCw9mQ+KKjtZ/7qpdEP1oTlSvfXYFWIYU4P6Ynb5 T9+sJ0Zvd045aClNE3IcGXKWA0Mqog+MVnpP2tVWNsn9bI9xKEJEEhxvc5FUg1mBeCvh eD5DnwP/MZBw4Py7S8qXV+9JZTBOokwdndB2J+izunYt0pPaE2VJIo2JqQvtY+kGBm2q C1k+re5wUNZMnaTsLSxePCwfEGFnf98HhdrN3FcIlfKXJV+A00MHox63B8OGoAw9dhdw iYEw== 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=MiTN1nRm4+aSnCMZ+YxS8vru16CnNBZhIWcqhzGsCFI=; b=CeQ33C4vtdeXzqrHe+F+2SK9wfhkCCgfFI2x7vEy2NWiqMJfuQtDgG555xlpakbarj sk8i2JjBJtuzjYMUob0SogOnJOsryzDaK3rNefMxcqG9W+/6eyx50otn1jyRMQ780mfw 0v5vuCFqqCFh5GZfcefMhvOmuexHHixGKntAljkBX3MKrE7TFcEsyw2nvvoVDdU6xyhv iUkZQfhGKNfIyT1BQgrn/+hFAEba1QAB3GhWBi+F8P2RrREYqyeoXPehvl0cYiNkYCCs ZaQYNexulnRWAkrwRPCCaKt9PB8Jg1R11e7yxKefgk4TcdN+UCw5dHmjrR3J0jqVoLNu PMuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="s8C/adt6"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h132-20020a636c8a000000b003fd7e2174c3si14611460pgc.829.2022.06.07.23.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:00:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="s8C/adt6"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5230324DBE9; Tue, 7 Jun 2022 22:25:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392296AbiFHAwN (ORCPT + 99 others); Tue, 7 Jun 2022 20:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383064AbiFGWAz (ORCPT ); Tue, 7 Jun 2022 18:00:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D04EA24E1D0; Tue, 7 Jun 2022 12:14:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 22160B81F6D; Tue, 7 Jun 2022 19:14:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73996C385A2; Tue, 7 Jun 2022 19:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629263; bh=WGrOh8oTneCh4yZsr/62ESP2wLPNAlO/thr+y7vDFk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8C/adt6ly/ntqq4ab73acaNDJbKPLR52DUJjLmEjjkcrtAg2Opae1qOoHp0PLrPP Rzy++JvrpbZ/ArjznCyYAD4uh8c8C/DdY84ZwoICSw+n3p4nCHggih9DtXSkeX0KqL hLRir4jiSMYj8NTj8qUPmv05N+oXXFI6W9n7eJaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mina Almasry , Mike Kravetz , Andrew Morton , Sasha Levin Subject: [PATCH 5.18 626/879] hugetlbfs: fix hugetlbfs_statfs() locking Date: Tue, 7 Jun 2022 19:02:24 +0200 Message-Id: <20220607165021.019494554@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mina Almasry [ Upstream commit 4b25f030ae69ba710eff587cabb4c57cb7e7a8a1 ] After commit db71ef79b59b ("hugetlb: make free_huge_page irq safe"), the subpool lock should be locked with spin_lock_irq() and all call sites was modified as such, except for the ones in hugetlbfs_statfs(). Link: https://lkml.kernel.org/r/20220429202207.3045-1-almasrymina@google.com Fixes: db71ef79b59b ("hugetlb: make free_huge_page irq safe") Signed-off-by: Mina Almasry Reviewed-by: Mike Kravetz Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- fs/hugetlbfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index dd3a088db11d..591599829e2a 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1048,12 +1048,12 @@ static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) if (sbinfo->spool) { long free_pages; - spin_lock(&sbinfo->spool->lock); + spin_lock_irq(&sbinfo->spool->lock); buf->f_blocks = sbinfo->spool->max_hpages; free_pages = sbinfo->spool->max_hpages - sbinfo->spool->used_hpages; buf->f_bavail = buf->f_bfree = free_pages; - spin_unlock(&sbinfo->spool->lock); + spin_unlock_irq(&sbinfo->spool->lock); buf->f_files = sbinfo->max_inodes; buf->f_ffree = sbinfo->free_inodes; } -- 2.35.1