Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp906492lqj; Mon, 3 Jun 2024 04:50:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUizox1ZOlFsm3seKThTS86ryBQpcxPp+oIc4HQ1sCZ9A3ESLH4vBV2aB+Ud+w3aSfd8z+Dx2fooL13R7ClT0gPEPL4jSEgQwlBilNVjw== X-Google-Smtp-Source: AGHT+IGOj+mh4zp56GEpkuxZ92Ahnfk+z7ML335NsYM4xPiF79b1UWkg477IUYjBtkNNoUWXDMTu X-Received: by 2002:a05:6a20:975a:b0:1af:f64c:b795 with SMTP id adf61e73a8af0-1b26f20f5b8mr8088923637.30.1717415450800; Mon, 03 Jun 2024 04:50:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717415450; cv=pass; d=google.com; s=arc-20160816; b=wewtZt12iBlQZC8hxp6Exc3PuUuyrQM8YoUZrf3oB/2ISm/faY21jEdq3iLEeFbgLt E3sCH8txwRJN2fuULblKsmzCGKLArdeoGsLQlTcVVyaCUw5oy3G5WGqk26EUMXsCyIRi mO3k7ez0IRLfYptZyEdq4Ch/2eKeTg7ktbibO/mkf3V8ULrkaIjyNyudKiGYTNBrda9C VOgi2w+DF8Hs9JF6qMwM/UEXNKN7CpvW4KKMlXl5HS8KOqBoKM9yPDiVV/T1vK+S16OD W+E1ZVCMJFgyJ7yFbirxic+htV/Jipi6HCLkOqZteR618x0H8KNLSGhhg8b9c0vG5LmG 8MMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=dp6Arq2AGne0LS2K8gNmojna8e/iBUqSKfBQII4R3bc=; fh=4PIiVjT7WChsN7P86Lk0DC8JwQpxwelLhIas6XhAoBM=; b=D2own52BxJk6IPEtz7ThI+9fIGXTuh16bH7gtpU4CdckVK2DtuWUNq5bNimU4UuFbp epU99sbHTojNfuAhc5oPnYzEs1oOchQvWwPeyeALhXyaIh8CnXc8AwnExtCmtK2/4Cpr C27ymM/CaxENVyCkwkRoG6jtJ0QIZk/rYj98F4iJlNjyzyu7thJZASvrvPhEndSUi0cY BtnImTxUTLgrY+warXQEiy+JLH4UFZkC9bvR1qyCjwVHPGC8KWkvpmOd4fuJXeFAqrrD YzGccbwJc/oeWeA+yroQH8be+CuRs5KnnGzeLL24JgoOT3GsCS9B+SjKJi/6E9CAzN5X YWtg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGGuuZCj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7026ed68fabsi1621229b3a.151.2024.06.03.04.50.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 04:50:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGGuuZCj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-199067-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6C503283F5D for ; Mon, 3 Jun 2024 11:50:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E1A38595C; Mon, 3 Jun 2024 11:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rGGuuZCj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 530C985935; Mon, 3 Jun 2024 11:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717415441; cv=none; b=drEWYsApDuhI3VIR2jewYCyxYyATOhym+eWNSBtR6veTXUiM311ficQxfb2yOzbtLDUrbZTjE0daq9uT4zIsMrVSnDOSk6t8QID/dzC7zXMcekHdZX/fgNFv0jaJxOE0LDGuT56iBLLUQAmVzq9FhciPDUNkB9lDIC2fL6zjsV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717415441; c=relaxed/simple; bh=Ef8601AvoIDfPOriBRG7eHg2z8rWNV2l2tKH9n1+nkU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=XNKNWdiSYAZaLgwbD64HyhDAw51HxRjOTW9IrX9C+yfBBSU4PL/G6ILrEQwtmOOsRpRw9E1RjjHRMts2onyzeAiSrq//y85FvrJRiBUSJ2kxZSLa7VPJUELhLZsDPJi0ibYhcTqvP8CQyDLFGmF5F7PO0+AZrwOnusePetPahUA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rGGuuZCj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34071C4AF09; Mon, 3 Jun 2024 11:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717415441; bh=Ef8601AvoIDfPOriBRG7eHg2z8rWNV2l2tKH9n1+nkU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rGGuuZCjBWkOzFHWhQXRwV36Mj4e4i5FxTV7SwMhE+KE20CD5WunE9VNRIwbnz5IM U3VHwvOsXPRXHyUclA77b1dsD0IgeVcB3TFATjcDFoMxJIbR5dWVb3N+kCdzwyEENr FpSi3ysnrsSBtdS8uGozEhjYDQMYpnigcYwUSX9TnnUAYUFs9pcBy1cJPbmOtZZP2F vm7OK2EUYX85CdEw4NkvxyU3fdfWV5mnuimRl/Jil8d6TqPHZxHJMxIvVcrVdOjUuE tyByeebh+IBSzKIxMjr1g37IVnDnN+sy03sFVdIauixcjDciYWW4N0ani4fTt6F2rA zR2To+gOuWMiA== Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5b96a78639aso1861003eaf.1; Mon, 03 Jun 2024 04:50:41 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXZS19iaD+qYER19b7o2hQdpKVMkGno5BbLiWK70Vuo4l4gu4rEkIC3DbYeGR8W6CpNjbq08p9SieqAszSYOdbLufASqUCYViTEf5NbTziFAU/ezCPPs76yMlsLpEV1UnH+FeSW X-Gm-Message-State: AOJu0YyjC0SIjg4MWffgnkgqufR7n5xYgRco9wnwt44FsPujaohNN4RI FFMU8jRXweWOZXpLIAEB+x59gFBO3eRQgzRX5xNcB5SR3YRuJiKFFlBoZ8I0wjqpn9pFL6cTAqD 6qjNngufPmoHwr09sjoo3wi68jiI= X-Received: by 2002:a05:6820:1607:b0:5b9:fc9f:6a55 with SMTP id 006d021491bc7-5ba05e00201mr8257945eaf.7.1717415440275; Mon, 03 Jun 2024 04:50:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240531101444.1874926-1-sj1557.seo@samsung.com> In-Reply-To: <20240531101444.1874926-1-sj1557.seo@samsung.com> From: Namjae Jeon Date: Mon, 3 Jun 2024 20:50:29 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] exfat: fix potential deadlock on __exfat_get_dentry_set To: Sungjong Seo Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+412a392a2cd4a65e71db@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2024=EB=85=84 5=EC=9B=94 31=EC=9D=BC (=EA=B8=88) =EC=98=A4=ED=9B=84 7:16, S= ungjong Seo =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > When accessing a file with more entries than ES_MAX_ENTRY_NUM, the bh-arr= ay > is allocated in __exfat_get_entry_set. The problem is that the bh-array i= s > allocated with GFP_KERNEL. It does not make sense. In the following cases= , > a deadlock for sbi->s_lock between the two processes may occur. > > CPU0 CPU1 > ---- ---- > kswapd > balance_pgdat > lock(fs_reclaim) > exfat_iterate > lock(&sbi->s_lock) > exfat_readdir > exfat_get_uniname_from_ext_entry > exfat_get_dentry_set > __exfat_get_dentry_set > kmalloc_array > ... > lock(fs_reclaim) > ... > evict > exfat_evict_inode > lock(&sbi->s_lock) > > To fix this, let's allocate bh-array with GFP_NOFS. > > Fixes: a3ff29a95fde ("exfat: support dynamic allocate bh for exfat_entry_= set_cache") > Cc: stable@vger.kernel.org # v6.2+ > Reported-by: syzbot+412a392a2cd4a65e71db@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/lkml/000000000000fef47e0618c0327f@google.= com > Signed-off-by: Sungjong Seo Applied it to #dev. Thanks for your patch!