Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp49961lfv; Tue, 12 Apr 2022 16:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2Qqk15GYmqFPJ7vkXakSSzbEcVwig3PeXIafQYfpTUWtkk8axbfCQ3fgBYzjD8rQIb4My X-Received: by 2002:a17:902:7d81:b0:14f:e18b:2b9e with SMTP id a1-20020a1709027d8100b0014fe18b2b9emr39357454plm.160.1649807516748; Tue, 12 Apr 2022 16:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649807516; cv=none; d=google.com; s=arc-20160816; b=k/oSJ58r/p92yBIjxvbXymECqtyoylzYarOnly1AY1zvVOrbKKacQ1yhebM8n9dyQt 3U2zncTotomKAAXb1hI56kMGEBe0arDNMUy8sgCln3WmlsbSwfcOE2dib+vObvd8DkMY rk547lHi0JAJKe+lwYDaeJInm9OqR1Si+Slfv+L/IAGCm2uuePqdE8CZRl1M6ete+iAy vBSGXU6paRSXKgXyQj/mTlXL6LDY4App2ygKjLqGuD0QLSM9t8zJEx/tNUEy71aehzVF 9diImMiL6wJCoJOU2al1xpRQTLud+0pIH+l+aos2nCMZSshd46ObucI7Qk1CvVHJ1ZeH 3Kiw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=baEaCrnLBHjc8dj+cmCnEDyggTYvxeftZ9u5tqzYlTQ=; b=UsLaNHGv8lpKcy1jXUFcU+2Emz0CMjQEMv4IiV/60UWOct/CLJSGNLM3tn0u7l7h8A GapZr6G5ixCj4K2ppgB9nlV5rLACr3crNa6Q6b9NkM0MZIDEd5Jd4SX5XcPdLo1Ija/W /WMSJP/dRru8xdALHiR3dSaSJ/SPK/CPWzotdXRFzB0Si+hiBHj20j9dcIZrY02E+tqg 6TwjsbVe6xXz0HbZXBVr9UDBn+RoYTOCHVGjHQ0fH/t4+wrzqJXgFMgi7JP3uAPccb3v XZmX341/VkTFBBio10l8Wm2C/mEPwrmPGWMN0uHyFtX7IVhzacs2mvzVEjd/24uOLnkX kJRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="WL6IG/v+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h11-20020a170902704b00b00153b2d16437si12150263plt.63.2022.04.12.16.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="WL6IG/v+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 316111E8160; Tue, 12 Apr 2022 14:45:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357558AbiDLQd5 (ORCPT + 99 others); Tue, 12 Apr 2022 12:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357689AbiDLQd2 (ORCPT ); Tue, 12 Apr 2022 12:33:28 -0400 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812B25E168 for ; Tue, 12 Apr 2022 09:31:05 -0700 (PDT) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.1.2/8.16.1.2) with ESMTP id 23CF1qip006055 for ; Tue, 12 Apr 2022 09:31:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=baEaCrnLBHjc8dj+cmCnEDyggTYvxeftZ9u5tqzYlTQ=; b=WL6IG/v+96ZbexC5BmYEsm9xxAiTaY3eamthvpYVTqKiZsXSI5a2Gi3l8YHyzrhE6DBq BjvDqx39p/bCZpr5BpSh6iIL/oEjxT2ZlP/uvFK7ciIMe1eNV4Ay1EinpGHGjNrDd2Gq C8g47Au16XQ3NEUuOs4fmDGmn/SHnC7GRJw= Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net (PPS) with ESMTPS id 3fckykgq36-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 12 Apr 2022 09:31:04 -0700 Received: from twshared6486.05.ash9.facebook.com (2620:10d:c085:208::11) by mail.thefacebook.com (2620:10d:c085:11d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 12 Apr 2022 09:31:02 -0700 Received: by devbig039.lla1.facebook.com (Postfix, from userid 572232) id A736C745606C; Tue, 12 Apr 2022 09:30:48 -0700 (PDT) From: Dylan Yudaken To: CC: , , , , Dylan Yudaken Subject: [PATCH 3/4] io_uring: verify resv is 0 in ringfd register/unregister Date: Tue, 12 Apr 2022 09:30:41 -0700 Message-ID: <20220412163042.2788062-4-dylany@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220412163042.2788062-1-dylany@fb.com> References: <20220412163042.2788062-1-dylany@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: NiXb3jjnq2cYYFqBsXHH-4CYl2GkYc-C X-Proofpoint-GUID: NiXb3jjnq2cYYFqBsXHH-4CYl2GkYc-C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-12_06,2022-04-12_02,2022-02-23_01 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Only allow resv field to be 0 in struct io_uring_rsrc_update user arguments. Fixes: e7a6c00dc77a ("io_uring: add support for registering ring file des= criptors") Signed-off-by: Dylan Yudaken --- fs/io_uring.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index e899192ffb77..a84bfec97d0d 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -10533,6 +10533,11 @@ static int io_ringfd_register(struct io_ring_ctx= *ctx, void __user *__arg, break; } =20 + if (reg.resv) { + ret =3D -EINVAL; + break; + } + if (reg.offset =3D=3D -1U) { start =3D 0; end =3D IO_RINGFD_REG_MAX; @@ -10579,7 +10584,7 @@ static int io_ringfd_unregister(struct io_ring_ct= x *ctx, void __user *__arg, ret =3D -EFAULT; break; } - if (reg.offset >=3D IO_RINGFD_REG_MAX) { + if (reg.resv || reg.offset >=3D IO_RINGFD_REG_MAX) { ret =3D -EINVAL; break; } --=20 2.30.2