From patchwork Tue Jul 27 13:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 486722 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp232867jas; Tue, 27 Jul 2021 06:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMBTtzIqYW6CRNBud73IdwTvOFSuyPmXsaFEbGqHmP8zB+Ls2GCsupIxRLoDB2RTAKMWpe X-Received: by 2002:aa7:d8c6:: with SMTP id k6mr27982900eds.374.1627393669707; Tue, 27 Jul 2021 06:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627393669; cv=none; d=google.com; s=arc-20160816; b=l8ou8+Pn4iPjAIdJ0OzA1JVHK8wj9FOMDCPGosedbOp1U9A58lq0E7RjiHlDcWAlBD BWY+1R5sH9f2ChIBP0029cx5FauTJloEFSuVewq/pZjQLuLpR6ttAqQX/QeO0/esTZhW PMB42VEM0Jn2OW5fR+LG3k8CSbS/4+YMwG3RDmcjZQeCKmxb46iaS0pavkRFsIDVxPkd syS8XXsMgUrKsW0i67cpm/M9zqbMzFxKCv9WyRHOeHt3mI6heuiGxgx5h5DArQnXQCoR sBD8kybuFu+LQpbFaL9cInk/ugVhX+GKfwNVjdqYxvAz47Vb/zVMenngWoOFqquy4CfL CAEw== 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=NDAAabXo9u37j5z/O1qu4lWYrC6m8c6KHTbdsdDXP+g=; b=bEEk8xJ8xbHZYb+V0cGkVAFdGO9L+UyN1haQJgV0W/U+t7ZjRH7fITPj3LuHBI46W+ 30YGZhaGGpKE4i/zjsCW6O/N0n4Ps9b0KPQVTxfbbGf0ywwQNQyPfenrSlsjxzLngC8+ yx2tUOmWrxc1nls2ixdTBa+GctXHSnVUD6nZq+Io/CY26+lCDmcqKma42OVHQz2vbxZZ x/zbSW36kSp837jP86KOKI1SMOzTC+8FLI6Yqq5cQnkjNPl1L3mlwL4nxRXBvpctVMCW bDZFZOYp4CG02Z4fub66KuXo2KObDTwenwY0QkHZBTnTiCouiLUUY0U45iZc8q/uVQuE OMgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n6y835zb; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si2970195eje.250.2021.07.27.06.47.49; Tue, 27 Jul 2021 06:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n6y835zb; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237205AbhG0Nrn (ORCPT + 8 others); Tue, 27 Jul 2021 09:47:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:46836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237237AbhG0Nq6 (ORCPT ); Tue, 27 Jul 2021 09:46:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61C7F61AA5; Tue, 27 Jul 2021 13:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627393615; bh=F50Mhn/T+bUW+5xbXrNJuotyTutuRwySzq4bKfAHonw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n6y835zbgZUnkMEQ+vDaFjTAgosLuMc6w7HkAq0W+GPw+8IyFWfmXLxh+Fcp6eZDN S6iOgBzFBitnUEqyN0EpRrcD7CtXB0RtUrOV4eFDEuKrOqtvInpr4QmPk5aGBjXpvv y9f+4Hb7EkidReNrc6+Bu0Uh8c5yEalKNEYkDMS4cuupfBUiAKeGSV/sBs3l/x2UPx K7jYtuHfZEqY1fGhECx5w1+7Jn7ZysoP6xV2L1y9f96ctN26L7N/hILoLTFn9xGnIw GdSG9jhWwb2GQtF834IiU4BFe1CnCemgumJvFGnzQxFrOOaQO9Vt2zBJ59CXDDdg8r Nv7/qz2gkF8nQ== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Arnd Bergmann , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek Subject: [PATCH net-next v3 31/31] net: bonding: move ioctl handling to private ndo operation Date: Tue, 27 Jul 2021 15:45:17 +0200 Message-Id: <20210727134517.1384504-32-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210727134517.1384504-1-arnd@kernel.org> References: <20210727134517.1384504-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann All other user triggered operations are gone from ndo_ioctl, so move the SIOCBOND family into a custom operation as well. The .ndo_ioctl() helper is no longer called by the dev_ioctl.c code now, but there are still a few definitions in obsolete wireless drivers as well as the appletalk and ieee802154 layers to call SIOCSIFADDR/SIOCGIFADDR helpers from inside the kernel. Cc: Jay Vosburgh Cc: Veaceslav Falico Cc: Andy Gospodarek Signed-off-by: Arnd Bergmann --- Documentation/networking/netdevices.rst | 11 +++++++++++ drivers/net/bonding/bond_main.c | 2 +- include/linux/netdevice.h | 13 ++++++++++--- net/core/dev_ioctl.c | 8 ++++---- 4 files changed, 26 insertions(+), 8 deletions(-) -- 2.29.2 diff --git a/Documentation/networking/netdevices.rst b/Documentation/networking/netdevices.rst index 3c42b0b0be93..9e4cccb90b87 100644 --- a/Documentation/networking/netdevices.rst +++ b/Documentation/networking/netdevices.rst @@ -222,6 +222,17 @@ ndo_do_ioctl: Synchronization: rtnl_lock() semaphore. Context: process + This is only called by network subsystems internally, + not by user space calling ioctl as it was in before + linux-5.14. + +ndo_siocbond: + Synchronization: rtnl_lock() semaphore. + Context: process + + Used by the bonding driver for the SIOCBOND family of + ioctl commands. + ndo_siocwandev: Synchronization: rtnl_lock() semaphore. Context: process diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 23769e937c28..bec8ceaff98f 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4988,7 +4988,7 @@ static const struct net_device_ops bond_netdev_ops = { .ndo_select_queue = bond_select_queue, .ndo_get_stats64 = bond_get_stats, .ndo_eth_ioctl = bond_eth_ioctl, - .ndo_do_ioctl = bond_do_ioctl, + .ndo_siocbond = bond_do_ioctl, .ndo_siocdevprivate = bond_siocdevprivate, .ndo_change_rx_flags = bond_change_rx_flags, .ndo_set_rx_mode = bond_set_rx_mode, diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cc11382f76a3..226bbee06730 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1086,9 +1086,14 @@ struct netdev_net_notifier { * Test if Media Access Control address is valid for the device. * * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); - * Called when a user requests an ioctl which can't be handled by - * the generic interface code. If not defined ioctls return - * not supported error code. + * Old-style ioctl entry point. This is used internally by the + * appletalk and ieee802154 subsystems but is no longer called by + * the device ioctl handler. + * + * int (*ndo_siocbond)(struct net_device *dev, struct ifreq *ifr, int cmd); + * Used by the bonding driver for its device specific ioctls: + * SIOCBONDENSLAVE, SIOCBONDRELEASE, SIOCBONDSETHWADDR, SIOCBONDCHANGEACTIVE, + * SIOCBONDSLAVEINFOQUERY, and SIOCBONDINFOQUERY * * * int (*ndo_eth_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); * Called for ethernet specific ioctls: SIOCGMIIPHY, SIOCGMIIREG, @@ -1367,6 +1372,8 @@ struct net_device_ops { struct ifreq *ifr, int cmd); int (*ndo_eth_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); + int (*ndo_siocbond)(struct net_device *dev, + struct ifreq *ifr, int cmd); int (*ndo_siocwandev)(struct net_device *dev, struct if_settings *ifs); int (*ndo_siocdevprivate)(struct net_device *dev, diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 3166f196b296..4035bce06bf8 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -260,14 +260,14 @@ static int dev_eth_ioctl(struct net_device *dev, return err; } -static int dev_do_ioctl(struct net_device *dev, +static int dev_siocbond(struct net_device *dev, struct ifreq *ifr, unsigned int cmd) { const struct net_device_ops *ops = dev->netdev_ops; - if (ops->ndo_do_ioctl) { + if (ops->ndo_siocbond) { if (netif_device_present(dev)) - return ops->ndo_do_ioctl(dev, ifr, cmd); + return ops->ndo_siocbond(dev, ifr, cmd); else return -ENODEV; } @@ -407,7 +407,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data, cmd == SIOCBONDSLAVEINFOQUERY || cmd == SIOCBONDINFOQUERY || cmd == SIOCBONDCHANGEACTIVE) { - err = dev_do_ioctl(dev, ifr, cmd); + err = dev_siocbond(dev, ifr, cmd); } else err = -EINVAL;