From patchwork Fri Nov 6 22:17:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 320885 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp1676257ilc; Fri, 6 Nov 2020 14:21:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4DYfmta1xOFSUSdyMVpex8zhQaVYi42SwbL+/i4FbvZyNn+MbDIjYY85vEiEubpLi3Cte X-Received: by 2002:a05:6402:396:: with SMTP id o22mr3945606edv.34.1604701302754; Fri, 06 Nov 2020 14:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701302; cv=none; d=google.com; s=arc-20160816; b=joY6fPsNNkQw9c2mhGoX0ATZeQtIAj8J2oFCrsGXOu0K8UgNkKQBJa8/izS7p7ijGL KLRlq3nfUiOy5jW71F/p6kfeK2Dsn+YcZ1fvGnWonRDMeRasBFQV3rj5lt9+I9Xfsqex 49QJGAEFYKcRBTQi463VsprBmLwY9v2YGdumauj5AXLTKZGbRQmJp3jVUtpFMruo7kwE zX6kMEZaPjMkQS7/09yuAz5j1ednOu21eLjwW/gUHW6q1PDhAQM61C/3cg8kr5LyzATS 7bzISJuNEyDWKrc5NmLYcbtNw64a76VOtJplIdLyQbg1PhvIPB9EHlLTmJXhtdphBrpf adyA== 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=Dwv9tWGzMRrqBtEMwNfE0+dC0HA6EzPw8ewjlrXe3Ys=; b=btwX4YgqxzszLFomWxiXcO7/eVpIAErfH0/I+7UzlC78ImfO31DZWn+/b5dFcoohSg 6U8sbUr3QmS8fiOM5vYxstRVX+1ohRVaBeRtLpWTJrSgWxyhlh2tKpheDKtpet9TPRrf B7nLguQ0m8M1D/D4qT2KWuMAf7QwoLAufWnHqy+R+CcLNvnY/Z/6IftGzvluwqOyMX/2 uG0L5ZP5VrOv5Z1PpMpUV5MjJtuMK2Y/Ms/VbTPfCSyz1E1zMl+TMY2C47yW0q1Ds7mk AZGIBXVQ4ou7hPSJZ+N7nWudw6g6liQLAC463HbuiqT+RJsln5MKwFWRHStbNykIUnKb LjIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=owEJfBBO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 pg1si1875294ejb.96.2020.11.06.14.21.42; Fri, 06 Nov 2020 14:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=owEJfBBO; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S1729025AbgKFWVj (ORCPT + 2 others); Fri, 6 Nov 2020 17:21:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:41712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728963AbgKFWSY (ORCPT ); Fri, 6 Nov 2020 17:18:24 -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 E5CB12151B; Fri, 6 Nov 2020 22:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604701103; bh=t9jSt2j/mn9d/2bFgxLTxkax2Wz43GPQL/9eJHs6bJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owEJfBBOcrGQlW714fU4VJ6j6FJ7Hbh4yW9r1cTx17UAATNaC3SLVafvOptINHA7Z EaG/MCPttENxaPec502uc9r6GQTDeceh+9E78jLJgr+LFxYFUEJX4+YgyQEcoZwqtF KW286aLoA7zhoG0sXbbFmf0dXeolD6iGldx9DmnE= 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 10/28] appletalk: use ndo_siocdevprivate Date: Fri, 6 Nov 2020 23:17:25 +0100 Message-Id: <20201106221743.3271965-11-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: linux-wireless@vger.kernel.org From: Arnd Bergmann appletalk has three SIOCDEVPRIVATE ioctl commands that are broken in compat mode because the passed structure contains a pointer. Change it over to ndo_siocdevprivate for consistency and make it return an error when called in compat mode. This could be fixed if there are still users. Signed-off-by: Arnd Bergmann --- drivers/net/appletalk/ipddp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.27.0 diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index 51cf5eca9c7f..812b1c878ae7 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c @@ -54,11 +54,11 @@ static netdev_tx_t ipddp_xmit(struct sk_buff *skb, static int ipddp_create(struct ipddp_route *new_rt); static int ipddp_delete(struct ipddp_route *rt); static struct ipddp_route* __ipddp_find_route(struct ipddp_route *rt); -static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); +static int ipddp_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd); static const struct net_device_ops ipddp_netdev_ops = { .ndo_start_xmit = ipddp_xmit, - .ndo_do_ioctl = ipddp_ioctl, + .ndo_siocdevprivate = ipddp_siocdevprivate, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, }; @@ -268,15 +268,18 @@ static struct ipddp_route* __ipddp_find_route(struct ipddp_route *rt) return NULL; } -static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +static int ipddp_siocdevprivate(struct net_device *dev, struct ifreq *ifr, + void __user *data, int cmd) { - struct ipddp_route __user *rt = ifr->ifr_data; struct ipddp_route rcp, rcp2, *rp; + if (in_compat_syscall()) + return -EOPNOTSUPP; + if(!capable(CAP_NET_ADMIN)) return -EPERM; - if(copy_from_user(&rcp, rt, sizeof(rcp))) + if(copy_from_user(&rcp, data, sizeof(rcp))) return -EFAULT; switch(cmd) @@ -296,7 +299,7 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) spin_unlock_bh(&ipddp_route_lock); if (rp) { - if (copy_to_user(rt, &rcp2, + if (copy_to_user(data, &rcp2, sizeof(struct ipddp_route))) return -EFAULT; return 0;