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 62D16C7618A for ; Wed, 15 Mar 2023 12:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232446AbjCOMZ5 (ORCPT ); Wed, 15 Mar 2023 08:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbjCOMZh (ORCPT ); Wed, 15 Mar 2023 08:25:37 -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 7150C75845 for ; Wed, 15 Mar 2023 05:24:44 -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 C941561CC2 for ; Wed, 15 Mar 2023 12:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC199C433EF; Wed, 15 Mar 2023 12:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678883082; bh=wswBbSrwa8JjBe6E9+BaQhbBFZhBl1rn9lYjdZk1ZhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CUKHWDDZzNpTGz+ENL8IfekjvL/gHMqn88xAD1XoHEh7GOMccU3XQGA/e0ksRKzRk 84QQOwqesLos6BixLRRrVOGWIZAaVRGOn5c9WWjuxjQ1I5yd6B6HVmXlmDIe+OhUeM bLX7Q/UQzv+xel1IFi3JmXam2Cb79OPFtnQKBroc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Theodore Tso , Al Viro Subject: [PATCH 5.15 001/145] fs: prevent out-of-bounds array speculation when closing a file descriptor Date: Wed, 15 Mar 2023 13:11:07 +0100 Message-Id: <20230315115739.017739785@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115738.951067403@linuxfoundation.org> References: <20230315115738.951067403@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 @@ -646,6 +646,7 @@ static struct file *pick_file(struct fil file = ERR_PTR(-EINVAL); goto out_unlock; } + fd = array_index_nospec(fd, fdt->max_fds); file = fdt->fd[fd]; if (!file) { file = ERR_PTR(-EBADF);