From mboxrd@z Thu Jan 1 00:00:00 1970 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 9FA534432 for ; Wed, 15 Mar 2023 12:20:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 243ECC433EF; Wed, 15 Mar 2023 12:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678882806; bh=Q3n/ZFFDuIcs9z7/3ezBTKHA7uNoygEha8qv/bRgPpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vktWSK5Xwyy+c6lNijFpet85dLjVy72p6gknEaU0pT8flf7VOw24aiRVgDkMZPXeV EcxJihZS7s5g5H5J1f0On2by5KvcsJoeMbMRLQe+1Oy0z/KM1aiTC7Hex2+FkuOScY ZKEr8bIsO6uPUnHTW0cBct9TVJSGalLw9scKxjQc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Theodore Tso , Al Viro Subject: [PATCH 5.10 001/104] fs: prevent out-of-bounds array speculation when closing a file descriptor Date: Wed, 15 Mar 2023 13:11:32 +0100 Message-Id: <20230315115732.002220998@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115731.942692602@linuxfoundation.org> References: <20230315115731.942692602@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 @@ -677,6 +677,7 @@ static struct file *pick_file(struct fil 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;