From patchwork Tue Jul 27 13:44:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 486707 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp232068jas; Tue, 27 Jul 2021 06:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9rBu/fkyp2lJ1Fx/YaxMB3Wc376JilGdwI2MPP6RBFt89DUyC6RFYwf0MonUIdza2hzFQ X-Received: by 2002:aa7:c810:: with SMTP id a16mr18999090edt.338.1627393607930; Tue, 27 Jul 2021 06:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627393607; cv=none; d=google.com; s=arc-20160816; b=Ugk0MEGmTMVsFGHGMNbkfNAXfZdjVCwn03Is5qV4UAlki0y8fx3AfzPjKi36f1bUCZ Uw/Oqhi1oOV3Xyo2OV3cZrglxYXwUKfGVPJCrdMoX+rBcUxYrOKcuQZHWuvwy4bzetJG HF6vsdiBoJfYFQhl0e53YJLrUUz6jdLVa6ClNP1se9nlzc0qWQH5Vm4wDrzn0c+5xq6U itzUv3k0RuL8Tmi384SjHefR9uGHgINMirerxR3TMfsX7fIOAORRTh1bZx5EK79/BsET iSj5mq+UmRSWOO+kij0cvv38GUXkaahSFihvVjNICIyUC36RO2RC80Tbnj1bgkT+Bunx QPuQ== 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=mnu+0FN8fAogUM4MiV+XLxl77BRPlxIjZUAx/yBD+Ts=; b=CLyPpHoAotZvQVP+5psKbuXCnRri/nIdlt7Fw8K6OmoD1lrkDgOe1YxU1m7lvwKajm XEUBWqRNSzbwOYHUbKDsrIADApemVmY285yoSWsLyMrhtJx+n1JYHwMOeVXVE7dVpm62 I30SPHrkYr7vfB8b6R5U4RQ0FJ+GiWFDI5tApRCi68SlsRofYxZXVu/MtGF/9qM/pGJI URyCiNMBz8EtVDdFGn9BDjnhGGVfXW53Vm8GcYT0i7cjuI1+FfaNLamdZKkX1A5kWPs6 Ez+f/YTSMUOPbVMPRc/LYLaC6fGkpDZ55pu5G27IziJVZuXoZ0bAE+2Ng0nImZ8KmC09 dEOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hcT/f4Fu"; 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 hy25si2766512ejc.673.2021.07.27.06.46.47; Tue, 27 Jul 2021 06:46:47 -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="hcT/f4Fu"; 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 S236762AbhG0Nqp (ORCPT + 8 others); Tue, 27 Jul 2021 09:46:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236860AbhG0NqS (ORCPT ); Tue, 27 Jul 2021 09:46:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0576661A8B; Tue, 27 Jul 2021 13:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627393578; bh=79XTVpCt/ykWdmIsFWtzZbSIe8bov8bIjAYDooG6RHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hcT/f4FuRrUC9JeIW/rccwUoBiOG1R8L0yPELnVkGB9wPnVDZE6PSTIHX7wrnGU+1 dt9KeQa+NtnGJ4PtOHbJ2ioNOclcglbrpSXHHmgxXIgdr43AWU/j5PSRyO2vF/haJL 0+IlR8Lwg/n5CPGkQx9lpg09XufBivFx64hxkJyCcmsdXetOa/WjQ7y99N5IFK5LvY tezmiSokeH+6TSu9xlzfYmNKsMSSEbEIREnx/qUWYvXGKmgj4ziUoFL5Zi6GXDTaN9 lmvq7/dB+v1vftmT/N3K//dQq8iRS82tBFd7L0uJrDULt91R1u3i8SZMY7J8f7d6/d rdaEqJX50CQYw== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Arnd Bergmann , Andy Gospodarek Subject: [PATCH net-next v3 11/31] tehuti: use ndo_siocdevprivate Date: Tue, 27 Jul 2021 15:44:57 +0200 Message-Id: <20210727134517.1384504-12-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 Tehuti only implements private ioctl commands, and implements them by overriding the ifreq layout, which is broken in compat mode. Move it to the ndo_siocdevprivate callback in order to fix this. Cc: Andy Gospodarek Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/tehuti/tehuti.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) -- 2.29.2 diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index d054c6e83b1c..8f6abaec41d1 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -637,7 +637,8 @@ static int bdx_range_check(struct bdx_priv *priv, u32 offset) -EINVAL : 0; } -static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) +static int bdx_siocdevprivate(struct net_device *ndev, struct ifreq *ifr, + void __user *udata, int cmd) { struct bdx_priv *priv = netdev_priv(ndev); u32 data[3]; @@ -647,7 +648,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) DBG("jiffies=%ld cmd=%d\n", jiffies, cmd); if (cmd != SIOCDEVPRIVATE) { - error = copy_from_user(data, ifr->ifr_data, sizeof(data)); + error = copy_from_user(data, udata, sizeof(data)); if (error) { pr_err("can't copy from user\n"); RET(-EFAULT); @@ -669,7 +670,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) data[2] = READ_REG(priv, data[1]); DBG("read_reg(0x%x)=0x%x (dec %d)\n", data[1], data[2], data[2]); - error = copy_to_user(ifr->ifr_data, data, sizeof(data)); + error = copy_to_user(udata, data, sizeof(data)); if (error) RET(-EFAULT); break; @@ -688,15 +689,6 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd) return 0; } -static int bdx_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) -{ - ENTER; - if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) - RET(bdx_ioctl_priv(ndev, ifr, cmd)); - else - RET(-EOPNOTSUPP); -} - /** * __bdx_vlan_rx_vid - private helper for adding/killing VLAN vid * @ndev: network device @@ -1860,7 +1852,7 @@ static const struct net_device_ops bdx_netdev_ops = { .ndo_stop = bdx_close, .ndo_start_xmit = bdx_tx_transmit, .ndo_validate_addr = eth_validate_addr, - .ndo_do_ioctl = bdx_ioctl, + .ndo_siocdevprivate = bdx_siocdevprivate, .ndo_set_rx_mode = bdx_setmulti, .ndo_change_mtu = bdx_change_mtu, .ndo_set_mac_address = bdx_set_mac,