From patchwork Fri Nov 6 22:17:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320868 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1674532ilc; Fri, 6 Nov 2020 14:18:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQAdJqBRnCsaR+gJ9aSwxh48d9w58tVc+jKpwycE4UrwF32WkDSXe+IIFedIvq8PSOkSng X-Received: by 2002:a50:ed96:: with SMTP id h22mr3886953edr.336.1604701120042; Fri, 06 Nov 2020 14:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701120; cv=none; d=google.com; s=arc-20160816; b=mVnMVI5RyBZbi0rC6Z3EUR9YQpFWvGjszAnAyA8+Y7Cwbx+skBoeKC/ZqR+pdj+NcC RxpPi7b9fK3sbQIyX7GfU+tUbr+kdBIheMbBuWsGTgHyKBvKlufYDL9Kpdw5ZTgFIvMV lReOss0vJJz9U3XqSIXXhH6KdJlLnNpVuEjXXl9zfS86EZYyOyOSSDH0H9tkBVXQ6hhg CRC0IPpANs4WKVvtr/xQbnPRnE6OncR8sUQzlLmZcI6BdDVJMiBuO7O5Q2Excs8xK7Q+ hUXbxyFceh+NKcRHdpAcz1MapHyj0S9rnvxhhYtSjJugYKQMGa28sOgiqg1EsYmS17o/ B4dg== 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=WMbiD0oacTV2SGHzhQU/kjbJ+HO6395r0wczxykN8u0=; b=JYt5dLIcbOcFTWzfp+5dFa7yydWuF32jjIaT7Gx0ZlPD8R/7XG/7DSwptogPjs3tfQ GMLJQS7v2xVnfqXtarobfAYDlcA+5XyEOsaya/K8nJi3DEEaw/kj33WVvuy666xHP2Ar rV7HGEOOol8n6IyehHU6G9WbHcFhz9tmdnZzmnE1k10n+eFxwGfplo973wLS+X/0xVaa BDYF9xxBzVSqbOqisTpiyi4wIX40zSxcOLSaTB+vr070KRdtcN2Wj6hyUctPxHswE14V 0RjeN5vxpRJnd5Q5oXbt4NExXfxe2TZRk0+WwSkZR0+C/zInCN77kd2DMrEXEgsEl2Pa SnZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oMzwQM4O; 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 ci4si1848008ejb.436.2020.11.06.14.18.39; Fri, 06 Nov 2020 14:18:40 -0800 (PST) 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=default header.b=oMzwQM4O; 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 S1729047AbgKFWSh (ORCPT + 8 others); Fri, 6 Nov 2020 17:18:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:41844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729003AbgKFWS3 (ORCPT ); Fri, 6 Nov 2020 17:18:29 -0500 Received: from localhost.localdomain (HSI-KBW-46-223-126-90.hsi.kabel-badenwuerttemberg.de [46.223.126.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9637021707; Fri, 6 Nov 2020 22:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604701109; bh=PWlbZt8wWlmn+LUnXGXuQMunnnfW/Ks/7SA6eyhM52Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMzwQM4OVxtFFKwcgJNzxD9lIMwZ8Ldhj6OoNVtOTOlOh07hOQA+sAtQsWuuZsZMl Wm3NC7wnZyJ4/XOyMbyFrK5kwowihD1Dxi7Y2+QvxXFEfzDs/z2M9LCIo5TP+B0Y1v B/nHoqZZhKRPrZkbQ0sSnUs1ZV1HjFJLUxZOnGDQ= From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, bridge@lists.linux-foundation.org, linux-hams@vger.kernel.org, Jakub Kicinski , Christoph Hellwig , Alexander Viro , Johannes Berg , Andrew Lunn , Heiner Kallweit Subject: [RFC net-next 12/28] tehuti: use ndo_siocdevprivate Date: Fri, 6 Nov 2020 23:17:27 +0100 Message-Id: <20201106221743.3271965-13-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201106221743.3271965-1-arnd@kernel.org> References: <20201106221743.3271965-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. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/tehuti/tehuti.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) -- 2.27.0 diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index b8f4f419173f..e25524081a30 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,