From patchwork Tue Jul 27 13:44:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 486711 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp232298jas; Tue, 27 Jul 2021 06:47:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKCAP8OUCJGXqGishKpY/1+jQ0xKsy51qdCcB+MpNLV0WbeP8FOGWksjLy5t10trWpTpCJ X-Received: by 2002:a17:906:af7c:: with SMTP id os28mr22264821ejb.341.1627393624280; Tue, 27 Jul 2021 06:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627393624; cv=none; d=google.com; s=arc-20160816; b=Yg8n3s1vIfB91loAWOiagKvu3pK6kZZxnfYGG6ZieltlYvk7uuCucOOkY9xgosPvar X9FPZeyaFm+KUilm4CI48LzOkKIzFZafDj6FRVth4rMTZwmdftr1Rib8olJOLC4JwKAS qprhnMiwongtL0X8vTUjvJOnYGVaTmHNOp/mHyiyM4idm7G9a3cIGdE3NCqRiYiMBf2n eXO2taOy67v+Npd0Gp3DvvztcRHboBjOjf+vrF2Yv/21D0LowOyy/Ffze8wvB680cfLu dsDWAgTpDXTVled7uRgEWsLKR1soKMoZOqukZ7Im7Mw6YypGpBqLKlzVLMMbn8OMFoQm K9sA== 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=NuuDKAoeEgDSBWokoTC9sjKqYeIbcoHlKu8D1SSNNkE=; b=g+wVzdDbNoEsgflRZEWgkWhNFvcSLn7Hvlq1iq2Ur2N6BBl+nXdVE8w5vqsaFeIQkl ENMAtaHGegjn4NSvBe6tgMConaxtidfBzOOO8xIRFhsUiY50QaG0NN4BUrpQKpLmfCIG UwzJ1zTa2BkXwLlhtaZ5I1gUPh7ngGohWHIfXU/LNbwZMa+5R7bKIHGb+aHOpVHMif19 b2LPS04Ozr86Jpee6NWk5vXyDz2h7q3hdb11VnDf/utY4nmtUKJouSSnVN+QVreVHloE NeNms3VdSkTyn1g30e5GV/M6t0nxw4qpjeBkuJyFRaDJIU3PPEtfLShlJEDopkL4yCmL 5eHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JmUHuTj4; 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 eb13si155740edb.405.2021.07.27.06.47.04; Tue, 27 Jul 2021 06:47:04 -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=JmUHuTj4; 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 S237247AbhG0Nq7 (ORCPT + 8 others); Tue, 27 Jul 2021 09:46:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:46564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236921AbhG0NqV (ORCPT ); Tue, 27 Jul 2021 09:46:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C17E619F5; Tue, 27 Jul 2021 13:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627393581; bh=H8eqYHK1w5Ld8XXi/hfeOdbBK38zaikB8TdAR920Syk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmUHuTj4wS31s9ZiwscusBpmW1kRhgIg+10vd6u2G4dwp8MaRN+sfKjSLnND0Hkgn Di5b0trM7Ti02tFs1kUA8JljDAZlGw5dpoUY6hrcwTLlFc3Fd0wVUeL+Mc5XI/kG30 xIN70yQO2ZpTgb2O3qvs2EhdrOF7y4xJGztxDSf7JuXR3znCde2Xw/V3LTG8t0Gfgy StQhEyMOSwpHquVBnc0Iw6JRHLFeYbeOTNQ7F3RD7TU3KUgXF0QarCnES8R41m93+2 VZ1+48eyD1aBc6IKTLaoKOa4luK8+rA/npW4LJm66+FgcDxD9OKeCbP/6LAa5xOzhU QPAf2lmUgHV5Q== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Arnd Bergmann , "Maciej W. Rozycki" Subject: [PATCH net-next v3 13/31] fddi: use ndo_siocdevprivate Date: Tue, 27 Jul 2021 15:44:59 +0200 Message-Id: <20210727134517.1384504-14-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 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. Cc: "Maciej W. Rozycki" 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);