Message ID | 20231101-rfkill-ioctl-enosys-v1-1-5bf374fabffe@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp663843vqx; Wed, 1 Nov 2023 12:42:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKODx1lVm/ZfgcALTfuehAeEdY2wHzONyP2ZJTVH8KXXsqIGwNjDWwW5Hlr52Vvm1OWtOL X-Received: by 2002:a05:6359:29cc:b0:168:ec64:8298 with SMTP id qf12-20020a05635929cc00b00168ec648298mr13360715rwb.17.1698867741552; Wed, 01 Nov 2023 12:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698867741; cv=none; d=google.com; s=arc-20160816; b=CBvfTM2RIi/ES7VVmfxRV63g1cXuJQC7Q3OLYa4ch/x45dxKc0hpAp3YKk9K7pZR0W mES9fNIGEKipbpoBHaqBJgQ+Dt96miA8rFqc3+EjcgDfEQqIIaVNlWpR532ecjaFV506 t3jvTD/r9i90NRL2kwINpU5Ua9GcscIXV/7lTyRmc18zNnBo3tq36PmxBFlzwIuZTDFw uhfNKCowV9YC0SF8KnYF+1Z36QW08HcPQ9pJkfLkTBGF/VOKyP6PE634o4QPnWBO0jqz yipT5fwwRWtcAge1MzAUqR1CxdAJ2ZzP1ljkWDlo7woAPM0Hrp4Y7VAG0R5AS/bx6lyi Z0SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=Fr9tumZCcNcjPS9MRqgoMhcJW8WAY/B2NZrSK3jkH0I=; fh=gcZfINLf3WZTb4Z6s2y3641pf9xlvT2zfmZlaAaHFsg=; b=1FKq9Ro68BHOiF2mdkFMVF+F2xUxS9D+D9+SEtAu7uARH5ycdE5Mt0qALr76C9rcoQ K1aw+/8gLUmE+MIvzKuq+E8ZzKGnL9M4uOb7PIqNMNfHzLiDHS+knkwjmYyTHV+03MTK jLjOc8psQRQ+bIJiCZj8BZtJQEXIHBWQ6pMhbpF2Nc6bi34qUxEDq6l3pr8mPcfLeo6R MQSdNYjoSMRKvsz7HqSQc5c62MH0gLB15nhFUF2pKpifhDuGBK9SyHbhloz++QeBT3nh ZUchvDP2OyS7nO7IpomLyW6lcQlod22GKxPhQFPOwsLCLjg30CPVsadEMVb8ecGPsgeI q5BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RgKkttjK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d190-20020a6336c7000000b00578e98dec9dsi488608pga.160.2023.11.01.12.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 12:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=RgKkttjK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C23AB812D21A; Wed, 1 Nov 2023 12:42:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347936AbjKATl4 (ORCPT <rfc822;rbbytesnap@gmail.com> + 34 others); Wed, 1 Nov 2023 15:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346179AbjKATlz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Nov 2023 15:41:55 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC4FBD; Wed, 1 Nov 2023 12:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1698867702; bh=6kOOEsQgA20o02ni+Bbcpima7j16ISpDSfIVR3lmAHo=; h=From:Date:Subject:To:Cc:From; b=RgKkttjK6JHbUkNCJEGKwSUQBo2D1LVV/CtJA/BRdiAsNkuvWgT6mc1CrYE1EBw+T JDfPyoDOK7LpDXTsVsBEHmLc55HZpiHWgHv1Hg09HxHobbPMFTnwWzpJyyRkzOmBCq H7uX0orZAkqBQSWVtQ1Rlo5aSIiV+UnbFeXwktDs= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> Date: Wed, 01 Nov 2023 20:41:38 +0100 Subject: [PATCH] rfkill: return ENOTTY on invalid ioctl MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231101-rfkill-ioctl-enosys-v1-1-5bf374fabffe@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAPGpQmUC/x3MwQqDMAyA4VeRnBdIqqe9iuzQ1tQFSzuaMSbiu 1s8fof/P8CkqRg8hwOa/NS0lg5+DBDfvqyCunSDIzcyE2NLm+aMWuM3o5RquyGRdyGQn3xg6OW nSdL/fZ1f53kBxrK472UAAAA= To: Johannes Berg <johannes@sipsolutions.net>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1698867702; l=1027; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=6kOOEsQgA20o02ni+Bbcpima7j16ISpDSfIVR3lmAHo=; b=PCouzUkWjCX8b4EyQv4Oh3mGh+icPABvcaSCwi8ZKWWfm0MN7wtPhGOZZZJDZDHZZRhHXGuo9 tX5Sr1txgKVDl411lumTlUJq0mY1eBz57bA4bczvxT3dg+jVfF8vYW3 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 12:42:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781391940756385665 X-GMAIL-MSGID: 1781391940756385665 |
Series |
rfkill: return ENOTTY on invalid ioctl
|
|
Commit Message
Thomas Weißschuh
Nov. 1, 2023, 7:41 p.m. UTC
For unknown ioctls the correct error is
ENOTTY "Inappropriate ioctl for device".
ENOSYS as returned before should only be used to indicate that a syscall
is not available at all.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
net/rfkill/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
base-commit: 7d461b291e65938f15f56fe58da2303b07578a76
change-id: 20231101-rfkill-ioctl-enosys-00a2bb0a4ab1
Best regards,
Comments
On 11/1/23 20:41, Thomas Weißschuh wrote: > For unknown ioctls the correct error is > ENOTTY "Inappropriate ioctl for device". For sure! I would like to learn more of why this is not an UAPI breaking change? > > ENOSYS as returned before should only be used to indicate that a syscall > is not available at all. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > --- > net/rfkill/core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/rfkill/core.c b/net/rfkill/core.c > index 14cc8fe8584b..c3feb4f49d09 100644 > --- a/net/rfkill/core.c > +++ b/net/rfkill/core.c > @@ -1351,11 +1351,11 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd, > unsigned long arg) > { > struct rfkill_data *data = file->private_data; > - int ret = -ENOSYS; > + int ret = -ENOTTY; > u32 size; > > if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC) > - return -ENOSYS; > + return -ENOTTY; > > mutex_lock(&data->mtx); > switch (_IOC_NR(cmd)) { > > --- > base-commit: 7d461b291e65938f15f56fe58da2303b07578a76 > change-id: 20231101-rfkill-ioctl-enosys-00a2bb0a4ab1 > > Best regards,
Hi! On 2023-11-02 09:57:45+0100, Przemek Kitszel wrote: > On 11/1/23 20:41, Thomas Weißschuh wrote: > > For unknown ioctls the correct error is > > ENOTTY "Inappropriate ioctl for device". > > For sure! > > I would like to learn more of why this is not an UAPI breaking change? "break" would mean that some user application worked correctly before but does not do so anymore with this change. This seems highly unlikely and I was not able to find such an application via Debian code search. In general I did *not* mark this change for stable so if some application would indeed break it gets detected before the patch hits a release. > > > > ENOSYS as returned before should only be used to indicate that a syscall > > is not available at all. > > > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> > > --- > > net/rfkill/core.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/net/rfkill/core.c b/net/rfkill/core.c > > index 14cc8fe8584b..c3feb4f49d09 100644 > > --- a/net/rfkill/core.c > > +++ b/net/rfkill/core.c > > @@ -1351,11 +1351,11 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd, > > unsigned long arg) > > { > > struct rfkill_data *data = file->private_data; > > - int ret = -ENOSYS; > > + int ret = -ENOTTY; > > u32 size; > > if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC) > > - return -ENOSYS; > > + return -ENOTTY; > > mutex_lock(&data->mtx); > > switch (_IOC_NR(cmd)) { > > > > --- > > base-commit: 7d461b291e65938f15f56fe58da2303b07578a76 > > change-id: 20231101-rfkill-ioctl-enosys-00a2bb0a4ab1 > > > > Best regards, >
On 11/2/23 20:14, Thomas Weißschuh wrote: > Hi! > > On 2023-11-02 09:57:45+0100, Przemek Kitszel wrote: >> On 11/1/23 20:41, Thomas Weißschuh wrote: >>> For unknown ioctls the correct error is >>> ENOTTY "Inappropriate ioctl for device". >> >> For sure! >> >> I would like to learn more of why this is not an UAPI breaking change? > > "break" would mean that some user application worked correctly before > but does not do so anymore with this change. > > This seems highly unlikely and I was not able to find such an > application via Debian code search. > > In general I did *not* mark this change for stable so if some > application would indeed break it gets detected before the patch hits > a release. > >>> >>> ENOSYS as returned before should only be used to indicate that a syscall >>> is not available at all. >>> >>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> >>> --- >>> net/rfkill/core.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/net/rfkill/core.c b/net/rfkill/core.c >>> index 14cc8fe8584b..c3feb4f49d09 100644 >>> --- a/net/rfkill/core.c >>> +++ b/net/rfkill/core.c >>> @@ -1351,11 +1351,11 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd, >>> unsigned long arg) >>> { >>> struct rfkill_data *data = file->private_data; >>> - int ret = -ENOSYS; >>> + int ret = -ENOTTY; >>> u32 size; >>> if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC) >>> - return -ENOSYS; >>> + return -ENOTTY; >>> mutex_lock(&data->mtx); >>> switch (_IOC_NR(cmd)) { >>> >>> --- >>> base-commit: 7d461b291e65938f15f56fe58da2303b07578a76 >>> change-id: 20231101-rfkill-ioctl-enosys-00a2bb0a4ab1 >>> >>> Best regards, >> Thanks! Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 14cc8fe8584b..c3feb4f49d09 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -1351,11 +1351,11 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct rfkill_data *data = file->private_data; - int ret = -ENOSYS; + int ret = -ENOTTY; u32 size; if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC) - return -ENOSYS; + return -ENOTTY; mutex_lock(&data->mtx); switch (_IOC_NR(cmd)) {