Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1249554imw; Tue, 5 Jul 2022 06:25:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vB94qmOzwhnXGJyGRFUAMlXFhwXXrGJW4ojh0Rc2jBXANnZj1osgcBPY4vMxkdb0Cqjsbw X-Received: by 2002:a63:3851:0:b0:40d:622:1b7b with SMTP id h17-20020a633851000000b0040d06221b7bmr30127758pgn.431.1657027527966; Tue, 05 Jul 2022 06:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027527; cv=none; d=google.com; s=arc-20160816; b=M0H0EoFjzwSEaVUXTbNZOz2ZDiJVu+9NWXZKVxGYZiKxDBsBsiLO/ShCHAkX90K/GC ednnENtp3NPl1EGwJnAxbL6u9NyiCoKxLDBosQxG7+P0E6cs1nFBBweSf6FO3hFIaLah qRQN1BxVa+/2nFHX+/vY1ZgUBj9M0ajH3Rkwbtiiy9LDyaqmprdUrIOekxyHrM1hQ02f CauIaPeSRz4mwmr67MDAFHltsshFvfLVsTulSYqeT2hibw9NqZYVtlsHkJb15QDrhXR+ XM70oj9SbTjZmJORXvJoGuJE2MgTP2p8FJC5pl392Coj0UkGwhkTMC64naMlmCIpjFTY k0ew== 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=vNjRzd40xtgBX1Q7yvQvI6yVb3wX+ZFru9Wt6OC+DgE=; b=hFWk7GdqKty20zRY4da8DKFkCPJ0my49lqo9/PqkoLxHYodcFF5CSxZq2d0T4KSn63 JAYsXe+zacZfm+rkqf0clWlTjiTk2KgdHR2deaaGX7Ty5wT+q0w4Ala8rphNp8sP1x1l bvR2Ese66RLStDsijqXutLgIdzF30q9VamEJ31NReh5fWv6csaotMaHAdytEiJZVXbPY 6KTfEBZUKFrZ1EF4Nvu5Zwf4k+0N9u22G5vdNTsGy0Q8iVF167yZngygvM0l7jVAd1aQ 84tYNOZKIKCiZlblntUvIN1auK6SkTMpzP94zbw2oq34SFA/msZzbX2/ehGz6FddxTKn FN3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xN66xuqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y24-20020a170902d65800b0016a7f1a4857si11407262plh.472.2022.07.05.06.25.15; Tue, 05 Jul 2022 06:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xN66xuqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237849AbiGEMYG (ORCPT + 99 others); Tue, 5 Jul 2022 08:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbiGEMRd (ORCPT ); Tue, 5 Jul 2022 08:17:33 -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 2FEDE1C904; Tue, 5 Jul 2022 05:12:20 -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 80CCF619A6; Tue, 5 Jul 2022 12:12:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91002C341C8; Tue, 5 Jul 2022 12:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657023138; bh=Zvrqgx3TWHUPdHczpbHvYScItmS0flh1Wg5GahmqYxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xN66xuqmC+14N6+OuvUuFcNUpaKoMKWIGu3mNnVBj7OUeqk0ZutEQv+vAy6pk41qW 5RGH9hRipH3kkcYG7UAPhZ7N89tg6FqLmCyrgGC7+Jad5R+vTwS2+736ecnv81I4Mk 9tcLIMcPdYBwGL0/wiYAF/KhPyU+y7i7RvSizG+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe Subject: [PATCH 5.15 52/98] io_uring: ensure that send/sendmsg and recv/recvmsg check sqe->ioprio Date: Tue, 5 Jul 2022 13:58:10 +0200 Message-Id: <20220705115619.061142527@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115617.568350164@linuxfoundation.org> References: <20220705115617.568350164@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=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Jens Axboe commit 73911426aaaadbae54fa72359b33a7b6a56947db upstream. All other opcodes correctly check if this is set and -EINVAL if it is and they don't support that field, for some reason the these were forgotten. This was unified a bit differently in the upstream tree, but had the same effect as making sure we error on this field. Rather than have a painful backport of the upstream commit, just fixup the mentioned opcodes. Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4788,6 +4788,8 @@ static int io_sendmsg_prep(struct io_kio return -EINVAL; if (unlikely(sqe->addr2 || sqe->file_index)) return -EINVAL; + if (unlikely(sqe->addr2 || sqe->file_index || sqe->ioprio)) + return -EINVAL; sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->len = READ_ONCE(sqe->len); @@ -5011,6 +5013,8 @@ static int io_recvmsg_prep(struct io_kio return -EINVAL; if (unlikely(sqe->addr2 || sqe->file_index)) return -EINVAL; + if (unlikely(sqe->addr2 || sqe->file_index || sqe->ioprio)) + return -EINVAL; sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr)); sr->len = READ_ONCE(sqe->len);