From patchwork Tue Jul 20 14:46:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 481550 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5243915jao; Tue, 20 Jul 2021 08:34:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2fTaMXybWHBoJlLNc7DJTR/1A617Nv5IWWjX974m+x4K/Ni0FQr2LeyN9PVO0VC3cNheY X-Received: by 2002:a17:906:5e51:: with SMTP id b17mr33314997eju.270.1626795259927; Tue, 20 Jul 2021 08:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626795259; cv=none; d=google.com; s=arc-20160816; b=iFaL0hos2gW+ZvgdKwidt5GUYd4KZq4M4zjaZXq/SwzoYzHyYXf6codwiTHoKT4Jsf 5eqbkxDh64rn7ziiNPiz27er/1J+mDcG/8poLUa7LulmnyHdxn64rH90elr+Hgm+ffM5 uuTuSf9r3gvtNFT9DBhB/QG1osn9fYTH+8NtZ+JhzKKAQHWCvtLo2gig6FOyEE6mgWij 9ZUf6Ts4ipL6l0cvTDL1hLqQj8MvVoQzvOo0Y2kX/4QH6KFFTQLASdH6fCOtS4suwsED CxRzatWnAtRhV6E8neboZJrEOTtvMeeRHpHSHmSJ9Qm0nWSYeLyRlKGEoWK25PP7MLsl jq3w== 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=1X0UtZp5wdpuhkHmNINTSsGeyyysiApfgzPFtLqYykI=; b=yqyqGZ68oJxwPNuAi1jmBfCyUDK/QsF+tD18RI8qvRQDrtT15w4bs1H5azqstNiXBr hARpnDB8iM8fg4QWDf2UiRqKcqJxhpq+bM7y8eZjBt6SDb+yHOy++nOtfKT6b4iYna6s EKayaUmeu1/iNb5obHvSrCt4F3fAoHR7+WvZRq4PXL37pqaPg2HxvbWxah7aI3BTceU3 6ERBrnqhY1vsvb1LTaVIn2ISdfk1U+FDoip8O4hNonuNv/yj3nNlmhMirAfL+b11e04P 89Hy+/jHveRsfDIL2bupWNcX+2HchgHxVWkBlkdt/aPpgL8fkXnLSxsTE4Ucg4jTZVCF 6fsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nAnPKf4D; 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 b7si160517edd.497.2021.07.20.08.34.19; Tue, 20 Jul 2021 08:34:19 -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=nAnPKf4D; 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 S237425AbhGTOwy (ORCPT + 8 others); Tue, 20 Jul 2021 10:52:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:35612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240121AbhGTO2q (ORCPT ); Tue, 20 Jul 2021 10:28:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2407F61242; Tue, 20 Jul 2021 14:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626792421; bh=FBU3mvl8B6oQHJIQ3dAba22U8Nn4CQoEYZ8YPr3rE4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nAnPKf4D4GagaB0YPToMdtpbgV3khWraUnYRq3LdU767eqem3voAgNUTfFncXLvB/ tTWZp2iqu2kmm1muz/eU8VRBjzDZesjEiDxqjefp3BmuagL/4Bajj7dh3JmiD8MBWn LnEIic4Cf8VLuGc9SBHG2xjJPjJx1X3VZYtwFmRh9L8Hs3RKBZPrIGvLo6aIdoE4YN EWvEfw9lLD8+bXaJI1z7XyXXR9LZGhpYEcuxKR4xe1jOkNeDZ0vwC8fdSeR9eGZoz5 EGO+aRw9XU/6J6ERKb/tx0tnVL9UaypGS5HNB74eTp2q/UNoFaWGmwOWKazLugMdZj eyAg7NCBxzjvw== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Christoph Hellwig , Arnd Bergmann Subject: [PATCH net-next v2 08/31] bonding: use siocdevprivate Date: Tue, 20 Jul 2021 16:46:15 +0200 Message-Id: <20210720144638.2859828-9-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210720144638.2859828-1-arnd@kernel.org> References: <20210720144638.2859828-1-arnd@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann The bonding driver supports two command codes for each operation: one in the SIOCDEVPRIVATE range and another one with the same definition but a unique command code. Only the second set currently works in compat mode, as the ifr_data expansion overwrites part of the ifr_slave field. Move the private ones into ndo_siocdevprivate and change the implementation to call the other function. This makes both version work correctly. Signed-off-by: Arnd Bergmann --- drivers/net/bonding/bond_main.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) -- 2.29.2 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index d22d78303311..94f8d6a9adfb 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -3998,7 +3998,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd } return 0; - case BOND_INFO_QUERY_OLD: case SIOCBONDINFOQUERY: u_binfo = (struct ifbond __user *)ifr->ifr_data; @@ -4010,7 +4009,6 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return -EFAULT; return 0; - case BOND_SLAVE_INFO_QUERY_OLD: case SIOCBONDSLAVEINFOQUERY: u_sinfo = (struct ifslave __user *)ifr->ifr_data; @@ -4040,19 +4038,15 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return -ENODEV; switch (cmd) { - case BOND_ENSLAVE_OLD: case SIOCBONDENSLAVE: res = bond_enslave(bond_dev, slave_dev, NULL); break; - case BOND_RELEASE_OLD: case SIOCBONDRELEASE: res = bond_release(bond_dev, slave_dev); break; - case BOND_SETHWADDR_OLD: case SIOCBONDSETHWADDR: res = bond_set_dev_addr(bond_dev, slave_dev); break; - case BOND_CHANGE_ACTIVE_OLD: case SIOCBONDCHANGEACTIVE: bond_opt_initstr(&newval, slave_dev->name); res = __bond_opt_set_notify(bond, BOND_OPT_ACTIVE_SLAVE, @@ -4065,6 +4059,29 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd return res; } +static int bond_siocdevprivate(struct net_device *bond_dev, struct ifreq *ifr, + void __user *data, int cmd) +{ + struct ifreq ifrdata = { .ifr_data = data }; + + switch (cmd) { + case BOND_INFO_QUERY_OLD: + return bond_do_ioctl(bond_dev, &ifrdata, SIOCBONDINFOQUERY); + case BOND_SLAVE_INFO_QUERY_OLD: + return bond_do_ioctl(bond_dev, &ifrdata, SIOCBONDSLAVEINFOQUERY); + case BOND_ENSLAVE_OLD: + return bond_do_ioctl(bond_dev, ifr, SIOCBONDENSLAVE); + case BOND_RELEASE_OLD: + return bond_do_ioctl(bond_dev, ifr, SIOCBONDRELEASE); + case BOND_SETHWADDR_OLD: + return bond_do_ioctl(bond_dev, ifr, SIOCBONDSETHWADDR); + case BOND_CHANGE_ACTIVE_OLD: + return bond_do_ioctl(bond_dev, ifr, SIOCBONDCHANGEACTIVE); + } + + return -EOPNOTSUPP; +} + static void bond_change_rx_flags(struct net_device *bond_dev, int change) { struct bonding *bond = netdev_priv(bond_dev); @@ -4954,6 +4971,7 @@ static const struct net_device_ops bond_netdev_ops = { .ndo_select_queue = bond_select_queue, .ndo_get_stats64 = bond_get_stats, .ndo_do_ioctl = bond_do_ioctl, + .ndo_siocdevprivate = bond_siocdevprivate, .ndo_change_rx_flags = bond_change_rx_flags, .ndo_set_rx_mode = bond_set_rx_mode, .ndo_change_mtu = bond_change_mtu,