From patchwork Tue Jul 20 14:46:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 481540 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5238326jao; Tue, 20 Jul 2021 08:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh9tmiSyAGSbO6oasZXG+7qFYuzeveFXP9qvI+vQ/zJ6rGSMu4BJq296JuWxjWUu+8XHvw X-Received: by 2002:a05:6e02:1354:: with SMTP id k20mr20569711ilr.169.1626794899727; Tue, 20 Jul 2021 08:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626794899; cv=none; d=google.com; s=arc-20160816; b=zpoVCRf8J+HKyogVjbvNsGsYJRj+OgRG9/mOJjQzvzXdchMdYU1q6Ry4eb4/nspSDl dfCEDTusiNUkcJ/KnPIGoSSy1Opq+D+LNBZ0i6FegW9uEjAtOUF+F2b5ez8x2R16qaFs TaxXYpTu4dNt9fhov0z4lqkcwg0MQaO2ufQjzG0Y38e3i45FQ9wq9PXh459E34chnr0x 2m+g/W48oUnVqb+YgkH7OmR4FCMYKicO/N4taszSVjI7AnJ7bJRpb/jK2Mn65vB1PWpM dOrstmds4VDGyFGJjvT4Qj4C+dWSOsuPV75M/m9mr3TuUke0pFATtq1wH/BrHtol/JT4 ZIVw== 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=pFzewymozhRcEmYMPkd+VBRTEcJzDc4/WOWPZCuVoQ8=; b=YMNJ15QVfRH8WBOn1Zh8znadJkMP0eOwqebYM5OHRVxdM/lxS66ngG0pcMgJR9JxSZ jad6A2mXr8QB+NIiiqFIIggSv7LRKDO8igjnZNo2Uw5cD7DufGJ6d3SwA2p5QHbA6P+g AgtLoP5Wv3y//j6NDKMIaJH7CmT/BsTTu/7YDc6HEavXJJiq1Vs3qpi6K/rPpYn3fL// dkH2XYbpso8ZGT3dwZ718aQdUI9bF4mw3XwUhXt8jC0xkHyrNRR1JtRyEOBHiJD2rZBQ vAHznZTdAtAVRV6ysdk1SYLmOigNpVcK7gcIoM7UbBqYQz8KanqKFDUgJi7JiAP1i0jv AxAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eeesKY3u; 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 o7si26753193ilc.64.2021.07.20.08.28.19; Tue, 20 Jul 2021 08:28:19 -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=eeesKY3u; 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 S241245AbhGTOpx (ORCPT + 8 others); Tue, 20 Jul 2021 10:45:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239528AbhGTOUs (ORCPT ); Tue, 20 Jul 2021 10:20:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F1EE26128C; Tue, 20 Jul 2021 14:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626792446; bh=7G0msoVM5bFZAgFgW5o6/U+H/ybwHmjNnggqvgAQVxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeesKY3uVzlk2Ap5Nt0gFxZ8XrCpsxxcP5b3/NxVX1bFagnnkoFp8PhSlmHWH2CWe tbgd190adn0vrT23u7W1FjF7Us4jl1YNlfH+oZXnDag78N7NUbZmcjLNn5jJRq9xzv O32I/uHsRssZHsDhEqCFgMY/G+WVJd7h99YBZ3aBMZMCB6onQNDyHk2L0qoWzrNmzy aX6yDippdcOA1MNMq//gyDYW5VY92ZiNzzUYVSKH2B71lWNwQWOQ03QrLqtAx7d55q hWzfrAe3jBkp7NpM5RVoQQs2Wa18sx3ZrH2SaaLfaoXOIgv07iaB1UDcW8Y0OMe5wp JhVRYfsB2VUnQ== From: Arnd Bergmann To: netdev@vger.kernel.org Cc: Christoph Hellwig , Arnd Bergmann Subject: [PATCH net-next v2 29/31] net: socket: return changed ifreq from SIOCDEVPRIVATE Date: Tue, 20 Jul 2021 16:46:36 +0200 Message-Id: <20210720144638.2859828-30-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 Some drivers that use SIOCDEVPRIVATE ioctl commands modify the ifreq structure and expect it to be passed back to user space, which has never really happened for compat mode because the calling these drivers through ndo_do_ioctl requires overwriting the ifr_data pointer. Now that all drivers are converted to ndo_siocdevprivate, change it to handle this correctly in both compat and native mode. Signed-off-by: Arnd Bergmann --- net/core/dev_ioctl.c | 4 +--- net/socket.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) -- 2.29.2 diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 4da176507006..2f58afbaf87a 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -285,9 +285,7 @@ static int dev_siocdevprivate(struct net_device *dev, struct ifreq *ifr, return -ENODEV; } - /* fall back to do_ioctl for drivers not yet converted */ - ifr->ifr_data = data; - return dev_do_ioctl(dev, ifr, cmd); + return -EOPNOTSUPP; } static int dev_siocwandev(struct net_device *dev, struct if_settings *ifs) diff --git a/net/socket.c b/net/socket.c index ddce6327633e..48471a219c1d 100644 --- a/net/socket.c +++ b/net/socket.c @@ -3234,7 +3234,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, struct net *net = sock_net(sk); if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) - return compat_ifr_data_ioctl(net, cmd, argp); + return sock_ioctl(file, cmd, (unsigned long)argp); switch (cmd) { case SIOCSIFBR: