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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F993C6FD1D for ; Wed, 15 Mar 2023 12:17:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbjCOMR3 (ORCPT ); Wed, 15 Mar 2023 08:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbjCOMR2 (ORCPT ); Wed, 15 Mar 2023 08:17:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB87794763 for ; Wed, 15 Mar 2023 05:17:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 171A261D13 for ; Wed, 15 Mar 2023 12:17:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BFCDC433EF; Wed, 15 Mar 2023 12:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678882625; bh=HoyvKmOuWOYCibdmOz5YlV4ONSKtfeDW8qT+/DiIfXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oXXVMl/SdG2R7lSzaRDHYFTW4i4PN7I5tiiGmHPPPzBP2if37O4tRqQDdeXQW9fZr m3A1fYFAUVi4XXgeMyzklGwrUdGe4MbSU6k9+lkEu+LV64dRT5qGGzGDscvubVNo5Q 0OKFSS4GHyHZiBM2viV1buAtgjR2UBOkSK7sblCs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Theodore Tso , Al Viro Subject: [PATCH 5.4 01/68] fs: prevent out-of-bounds array speculation when closing a file descriptor Date: Wed, 15 Mar 2023 13:11:55 +0100 Message-Id: <20230315115726.151802925@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115726.103942885@linuxfoundation.org> References: <20230315115726.103942885@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Theodore Ts'o commit 609d54441493c99f21c1823dfd66fa7f4c512ff4 upstream. Google-Bug-Id: 114199369 Signed-off-by: Theodore Ts'o Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/file.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/file.c +++ b/fs/file.c @@ -654,6 +654,7 @@ int __close_fd_get_file(unsigned int fd, fdt = files_fdtable(files); if (fd >= fdt->max_fds) goto out_unlock; + fd = array_index_nospec(fd, fdt->max_fds); file = fdt->fd[fd]; if (!file) goto out_unlock;