Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3982177iob; Mon, 2 May 2022 10:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwNPqNjUXe1xrmB/KTPq8IZws1gq0P0bxyRLYQQZJ24ujvHmrCP3J/zFLJqKy7dAdMUk/6 X-Received: by 2002:a63:fd51:0:b0:3c1:977e:1fed with SMTP id m17-20020a63fd51000000b003c1977e1fedmr10245050pgj.246.1651511155289; Mon, 02 May 2022 10:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651511155; cv=none; d=google.com; s=arc-20160816; b=ClH/Xd6E+PMywj8vWK8beeg3fIEK8CPsIHPiEkTd4hTs+kZX6YzMjlt9cYzz6KqRvX hZoDJ7Dh5l3ebCyxx9Qv1JyWdbW+3GZnOEdeyB82saEVRMEtKp9DMiNDXp/pxn3at239 l7gx+PuemSVq4Og6EodDsNz9MJnCS6VGuX13whvA+WeMnePd/eZa9iN63zkVBRGBpcg4 Mzo5mt5AuSAtg+Gf9Y7QfHdd3k/KLa6bIHjKaJ914oky0s3QUx1RokYfUjpePUXE/8BP LJU0Yf0yBAamRhJiZ3Nvv1GYqwYP3IV+fZzaGy1Efm+mdREz/Q+F9dLMy8IUemgUe4ET QUuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=/0gbFtgdy7CDyJjdS+yqHgi+WNEK/LMUhGKYDfnnlqU=; b=USN2qcX2+gb+vN7JlK+2IXtWFoujlP4Zmz9SynfuQvtHzZ7nuQdangzn88Rc8oXR6Y drhVMLCLbNsSyO/KOAaGm8neMsYCOM+VdTTIPHEUL2ecGsPB5Vosr0tr4TPkqK04IKqZ jopVaYWcW2W5AvO+H6R/tfYy/DSZPsihgeyYwVdjDRBEqpFLsb8y1f8DwnhgXMkAoF9W TgATjnPZHTZQcYj9gTGF4iHf2yRzI+l/cxsLCWvA4JJvtqLYwEivvYfNDWUfYF79J4MR 30uYquDwVxvhFYvAmqMM40XR7sjM4nrfhWPn2YHXmk7J0Dsvds/A4XMrqHBVgx/GHqGO cd+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cj8K+tgr; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a63d14c000000b003aa6987721esi13870455pgj.380.2022.05.02.10.04.52; Mon, 02 May 2022 10:05:55 -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=@redhat.com header.s=mimecast20190719 header.b=cj8K+tgr; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377191AbiD2OZr (ORCPT + 99 others); Fri, 29 Apr 2022 10:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377184AbiD2OZo (ORCPT ); Fri, 29 Apr 2022 10:25:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A46D54EF67 for ; Fri, 29 Apr 2022 07:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651242145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=/0gbFtgdy7CDyJjdS+yqHgi+WNEK/LMUhGKYDfnnlqU=; b=cj8K+tgr9tmYMTOI0v9iKEEp9v4+w4zjfOmlyidCTirOFoIOrO+gIsezdWSXQBJwDo+6jD /SJPiMehS064XqpuduoCpWlhPSgZc65WbUv5W//lCcc7izzBEozGq26utC3jsKeLBMgiI0 sqZt7itKxKBEYG2N7byADkHi2zzMaT4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-k-rx8HEKNXqEiMX6FcziOQ-1; Fri, 29 Apr 2022 10:22:21 -0400 X-MC-Unique: k-rx8HEKNXqEiMX6FcziOQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 712B2811E7A; Fri, 29 Apr 2022 14:22:21 +0000 (UTC) Received: from asgard.redhat.com (unknown [10.36.110.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B3B14639DE; Fri, 29 Apr 2022 14:22:20 +0000 (UTC) Date: Fri, 29 Apr 2022 16:22:18 +0200 From: Eugene Syromiatnikov To: Jens Axboe , Pavel Begunkov Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] io_uring: check that data field is 0 in ringfd unregister Message-ID: <20220429142218.GA28696@asgard.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 Only allow data field to be 0 in struct io_uring_rsrc_update user arguments to allow for future possible usage. Fixes: e7a6c00dc77a ("io_uring: add support for registering ring file descriptors") Signed-off-by: Eugene Syromiatnikov --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 7625b29..4e32338 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -10588,7 +10588,7 @@ static int io_ringfd_unregister(struct io_ring_ctx *ctx, void __user *__arg, ret = -EFAULT; break; } - if (reg.resv || reg.offset >= IO_RINGFD_REG_MAX) { + if (reg.resv || reg.data || reg.offset >= IO_RINGFD_REG_MAX) { ret = -EINVAL; break; } -- 2.1.4