From patchwork Tue Jul 20 14:46:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 481524 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5226334jao; Tue, 20 Jul 2021 08:14:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuxIloXNkAV77H1Jg2XZgqwpNaVvWaUrupKLsvkScUy0uFeYkrIAU7h+RLvAizEro6Kh7p X-Received: by 2002:a2e:8145:: with SMTP id t5mr7138244ljg.432.1626794076124; Tue, 20 Jul 2021 08:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626794076; cv=none; d=google.com; s=arc-20160816; b=ZXmmI2YJnC3FwW4SK67Fk7aFyhnbQR9NkEelODW0zTmMPFx6lDgMlAikAN++ONCKM1 zj/8lyt0Cvb4blkzVodLNUdEefO5W4C6y0UGhldmm8ihIVd/FBHRwYcG6setoNSp3ceh CRo7TXMdMeYte4PvxoMLQ7XzJSqh/7fD3SVPbxDj0+xJqjaaE2b78jptrdRjVgTttI8L a3OC5Q4BIQPKitcCu+rspHrZIGnCnl0A1Pojxh8HRMrOVXYIWPAlsMrL+6jmZonh0gkX thhYEzH+ORd9hlJv3j5vono/ryG9nL/gNLECNN0lYGdEYUrjOK8+Dl9QFkw/+CBFw4n1 BePA== 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=m1W947/n49F2R3KkxeDwGojOkg+Za73dqcYLPL3N9iQ=; b=jK0AM9Hs+kEbEbs9kBLkjKFXEzU3y2AyEIqi6lSepCXSLQUFFoY8HOaz/sGHrSonPk 58Ld20+tkJ2P8BOftsHC2dS/NNIiNoPKfspxobtCR7u8jHzFQwT8iCb6B8Vbrp8PZW/c APn6jbRqtgNYy9+K3amTlPNkfxV6JK2IpfLQDg5ik05rsGDdYRO0vRgb28XujAMv0RPV Mjc1TOweQQKPs9Uu7+ubYcmhmL+2zB9X7o9jEyI0NFmD2RrKQ5kitGWI2N5YbZ0zHQ2t OexQZ2yo51o3EGx7fFkUKdnLvGBfTc91m7KSPnDB7GsGuiy1BandccMHlZu3N0izEu+Q BXNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SjBTat+6; 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 j8si24247821ljq.554.2021.07.20.08.14.35; Tue, 20 Jul 2021 08:14:36 -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=SjBTat+6; 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 S238635AbhGTOdn (ORCPT + 8 others); Tue, 20 Jul 2021 10:33:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238922AbhGTONr (ORCPT ); Tue, 20 Jul 2021 10:13:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E779061249; Tue, 20 Jul 2021 14:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626792427; bh=wbqcJxVsNFjs2klhS9Zszc4lI72zEc/3MmSvWDszng4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjBTat+68lkUi+L7hY9EUQRSqo6HWtXKQtzP6zs3dKnDDc+1e9j4aU9F7i2zfN/U+ cO5ekPklWkfjg11Z5Pt3jg1l6Qg9I5sgi7DEsJViqVCL9PfHp6QPyx/0BNhKvvFFUl puvWByxtxdL+wY4MrqmelxRiFjsG7iYlG0AASmo5+1qtiU4BWwrR6LPkmLU05/IOIJ ZWYoeloMS6OhPtzibd4Jf4tahhtWCYiggJJV6rwRgadOHQyHKjIelLCZFxV+58zKrg UeqYa3yQIIQJ0JFQ2H8zC4/h9pINoVczy13DHZ9QZ1bCWcEwrwSlo+210fEwKkgqc7 5rX/gabJYiATw== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Christoph Hellwig , Arnd Bergmann Subject: [PATCH net-next v2 13/31] fddi: use ndo_siocdevprivate Date: Tue, 20 Jul 2021 16:46:20 +0200 Message-Id: <20210720144638.2859828-14-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 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 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) -- 2.29.2 diff --git a/drivers/net/fddi/skfp/skfddi.c b/drivers/net/fddi/skfp/skfddi.c index 69c29a2ef95d..f62e98fada1a 100644 --- a/drivers/net/fddi/skfp/skfddi.c +++ b/drivers/net/fddi/skfp/skfddi.c @@ -70,6 +70,7 @@ static const char * const boot_msg = /* Include files */ #include +#include #include #include #include @@ -103,7 +104,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 +166,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 +934,9 @@ static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr) /* - * ============== - * = skfp_ioctl = - * ============== + * ======================= + * = skfp_siocdevprivate = + * ======================= * * Overview: * @@ -954,16 +956,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);