From patchwork Fri Nov 6 22:17:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320884 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1676046ilc; Fri, 6 Nov 2020 14:21:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA64vxwzzEWfI4PKJ9Hq1YUp+/snNyezy2xiSZA7/rRIZb5eX3CGqRtNbudyK9InJPYlYa X-Received: by 2002:a17:906:16ca:: with SMTP id t10mr4444637ejd.24.1604701280868; Fri, 06 Nov 2020 14:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701280; cv=none; d=google.com; s=arc-20160816; b=GpQE9q7Izl1bPEl1IWJgDhTdz/5Rlg2EdCMpc2qnltlFaaXzDm0tRkxXHobUEpbupt u8mCXPePxT9Uhi/MSFzo7UE2DWjPs5cIYV8CGSTaGKLezTJKUFsRAOBsohXLxi3OLA56 nO6UfpAq829RoMeTTTYjEwJtynl+Owg7EcUcKF1HYXTCxiiefub8abRA7esl5h8Mi3qJ Hpe2b550BXNnXgZrLoWn5eWSsR3XO3vpH9QJPdgjWTEwU2G6tfVtqkdw1+RenEY/FDBZ J+8FObKA5ARciuB0/65+p8/fc/30Q9VCrDMg6Uqh1Bexqjj03EPr/TUA94o2c/NM0iwo shRw== 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=IvvAS4CS+qGzlkJdm5Qt+Xz389oYb4h9DZ6KcoH0biY=; b=MXbhbu4xnMgjlTTD+bwrj9+4BWeaCrHsyeLSpiwJdqIg/n9tZhqFnt2RYKHSDv3bqo jRR2wHLzZxrrABXxOLj1au0XSsM7BfZIGY9vDtkjJekCxFVP6jJhIEOVJXXGwOkXFzIt eHBsq2cqNVuWtYIBfg5NEIgJseIcGJbQ1XqkzWr6EEmntC3fB62ZlkNWAnQy4KLyPA75 MZZcyOozrQCgOVQtWk/8Sfau5EgDnd4NktHRWk7AY6WaoJOX2K1BmLLfGgKYe96Mdv73 In2SfmvMnlqOX8bO7Vtx46sUfbrBxoRqIx4ytp7cNOSDTnTiBn2nsnZuRE8SOJvyculP mcDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XbeSOZuo; 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 z5si1933590edj.362.2020.11.06.14.21.20; Fri, 06 Nov 2020 14:21:20 -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=XbeSOZuo; 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 S1729329AbgKFWVP (ORCPT + 8 others); Fri, 6 Nov 2020 17:21:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:41964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbgKFWSf (ORCPT ); Fri, 6 Nov 2020 17:18:35 -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 4C48121D7F; Fri, 6 Nov 2020 22:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604701114; bh=AjIS9Fwp+9zwOieexErSSkVefl0S4aqIyIhbjJBo8ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbeSOZuoctGdFTTctZYTPX/FZjuaNYEXLdm25I7crH1V5VQZOVT0UApSiH/I5+cwP t7VZxDeNGE7nZoOrCDqGufbZQlQCAgH5NLZroopgIQ8g/RH2lVRa8Mh+NPVk/qh+Eq nczzE6xnkVg8lqpFXIG6tp/IDPcrq7vgbV6Sme/E= 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 14/28] fddi: use ndo_siocdevprivate Date: Fri, 6 Nov 2020 23:17:29 +0100 Message-Id: <20201106221743.3271965-15-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 The skfddi driver has a private ioctl and passes the data correctly through ifr_data, but the use of a pointer in s_skfp_ioctl is broken in compat mode. Change the driver to use ndo_siocdevprivate and disallow calling it in compat mode until a conversion handler is added. Signed-off-by: Arnd Bergmann --- drivers/net/fddi/skfp/skfddi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.27.0 diff --git a/drivers/net/fddi/skfp/skfddi.c b/drivers/net/fddi/skfp/skfddi.c index 69c29a2ef95d..fe3b1d041142 100644 --- a/drivers/net/fddi/skfp/skfddi.c +++ b/drivers/net/fddi/skfp/skfddi.c @@ -103,7 +103,8 @@ static struct net_device_stats *skfp_ctl_get_stats(struct net_device *dev); static void skfp_ctl_set_multicast_list(struct net_device *dev); static void skfp_ctl_set_multicast_list_wo_lock(struct net_device *dev); static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr); -static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +static int skfp_siocdevprivate(struct net_device *dev, struct ifreq *rq, + void __user *data, int cmd); static netdev_tx_t skfp_send_pkt(struct sk_buff *skb, struct net_device *dev); static void send_queued_packets(struct s_smc *smc); @@ -164,7 +165,7 @@ static const struct net_device_ops skfp_netdev_ops = { .ndo_get_stats = skfp_ctl_get_stats, .ndo_set_rx_mode = skfp_ctl_set_multicast_list, .ndo_set_mac_address = skfp_ctl_set_mac_address, - .ndo_do_ioctl = skfp_ioctl, + .ndo_siocdevprivate = skfp_siocdevprivate, }; /* @@ -932,9 +933,9 @@ static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr) /* - * ============== - * = skfp_ioctl = - * ============== + * ======================= + * = skfp_siocdevprivate = + * ======================= * * Overview: * @@ -954,16 +955,19 @@ static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr) */ -static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +static int skfp_siocdevprivate(struct net_device *dev, struct ifreq *rq, void __user *data, int cmd) { struct s_smc *smc = netdev_priv(dev); skfddi_priv *lp = &smc->os; struct s_skfp_ioctl ioc; int status = 0; - if (copy_from_user(&ioc, rq->ifr_data, sizeof(struct s_skfp_ioctl))) + if (copy_from_user(&ioc, data, sizeof(struct s_skfp_ioctl))) return -EFAULT; + if (in_compat_syscall()) + return -EOPNOTSUPP; + switch (ioc.cmd) { case SKFP_GET_STATS: /* Get the driver statistics */ ioc.len = sizeof(lp->MacStat);