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: 12388543 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2092FC07E9B for ; Tue, 20 Jul 2021 15:14:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AFFD60FF2 for ; Tue, 20 Jul 2021 15:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238635AbhGTOdn (ORCPT ); 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 X-Patchwork-Delegate: kuba@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(-) 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);