From patchwork Tue Apr 16 20:19:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 162355 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4654796jan; Tue, 16 Apr 2019 13:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6p5eSqHSAp2nNXEXfZ+IxQixUc5r17W0o4PjJgsdgQydH3FnYzzKGh84XrT/iJaU/NPMf X-Received: by 2002:a65:6148:: with SMTP id o8mr79668481pgv.153.1555446064326; Tue, 16 Apr 2019 13:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555446064; cv=none; d=google.com; s=arc-20160816; b=VgMqFReU3NxuSrIqe+qr6AA9w0DdfA+1lAb4X9J4cZbYU3cQ0FQ/hs9pKIUUuQPVNw xDMAqHwknDAWIBztPtnCd1BsbIQWKHq6ySm09F9alpt/oT6yC5IlreTfBlDhUEQyNu7R 8xMaiUJ/iYl63kMcfE03GT8WJ+0Sp42CCM9hdYr8CvzRDQAbuz2ib4Y6aU55/JGNZ6Hq aP249GaUcKVYCuXLKMJDBkP8QBDMLFfjwuPpN/WAiIAzjXNPEFhC++3GaPVid1AiU6Wb H758pk50wlM5nntj7mNRWAUK18VFrBhn3LhQWiKptmLTCmsmg2s6Zz+p3cWR1JALLQFs cx6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NEXLZuCL1ZWXEM+5ylFV3oU4GqqswM+EWvvOGKkZ1co=; b=1CfY2eAh0s2u+rUK4Xhx7bTFg13v6AD8WMqNdbQb/eaWeW1Q9ZwlRTyviWaz1WfMp4 3eaz7Kn9oDhewvKOElY+laswKUQvO776u5ceudFNBlNiBEmPlEyEECrIThu1fiJhLsn1 wA/DO+Hu+B0BD/uXwsx4C4RUBK9/GN96YB0PV/3T8/Hy3lgVQo/9c5i0HoWcGPWSoNC+ QgZjq0w73/aova+MxMxfOrs2BVXy26FTPUkPQVSxfVYCez9VN6jcEbJx7yBcmRrXiEhu yBjCNKXInb0CvbRuZTQ6OO18+Uy8eU7BfvC6dS0JAaiDuGOtURFI0r23rpzPHcbu5PVr GBlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si47881190pgc.225.2019.04.16.13.21.04; Tue, 16 Apr 2019 13:21:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730353AbfDPUVC (ORCPT + 30 others); Tue, 16 Apr 2019 16:21:02 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:56043 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728401AbfDPUVC (ORCPT ); Tue, 16 Apr 2019 16:21:02 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mth79-1gzvE91hD5-00vAld; Tue, 16 Apr 2019 22:20:54 +0200 From: Arnd Bergmann To: Alexander Viro Cc: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Guillaume Nault , Michal Ostrowski , "David S. Miller" , netdev@vger.kernel.org Subject: [PATCH v3 01/26] compat_ioctl: pppoe: fix PPPOEIOCSFWD handling Date: Tue, 16 Apr 2019 22:19:39 +0200 Message-Id: <20190416202013.4034148-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190416202013.4034148-1-arnd@arndb.de> References: <20190416202013.4034148-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:UuSKur4F/zpzv8/eUkggQkLgvKUCGCMbUy0fxaAopYsiULgmb0c qlnZoZgjR/ezQ7Spy4ZN8C/7bmXf60fsXDeVZXie5xCW8GkPOWC/swEQrEZhQ2BrZID3LFg YAF/jJFfN2ZZ1wopD1LVQM/5A1sh3o/vpRajLiVX/PDCoPQrSoWG9IATr48/4XihimF5Evw TyxDLdga7kpS0I99zc5mQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Z9NglIFDkPA=:C3G4KtI7zzz1v9AiqvsBsd rBE7SmHIb/6xeCTExVcPaMzzciCrpm1AI36SmWGqbC8Gh+w/nKAutdEiO/E91OKGOwxUMDegT wkm+G4Wc01TaCtLl30UL7kVeKRyU8ysqCJT5bgU23IbvPhb1SogpS6cbHYR8qavgy04u7xNW5 RsexMsxEnlpAmtmgLAF90x1rGFG5Vgl0r6sKv8YxatBfc9gdHsLsQVhUqkQOiToi8qKYyhEKQ 9PvjE70D0P7jinET35uWvXRFf2IsVC/w49QDmWTzTc7FtkfRESOkZwmhrFKzzijFRiEh7grmo PYY26WUIJY2jtUtatjxS0biEVoNkK7iNtC/pzV3xzkqdslFGY52aie1+S3Y2nIPZeCTVKNP7a vgIet4flLDINyW2zmi2SCC4YE/bAhMpqhjzk/WMG1UoPY9S84ghupHhFnQZWcB66xw/LiWurA AkBFFOZwxXIUG9LJadtBJJeT2pE3hBu3WNMtj9bzLDmGgjp6QIYqwKOFFJaze383zD3o31Iqx G1gBbCXTUZBojIQGw0NnzYe39vkipQazZGN2nV25M5w90Ln5LzX8nYhYIgkzyGBmlHytX9cjg 4l7ENTgcxR6WCX+8zbs02SEwq1fc4zaAVPowCi8aEp2qKLTvJK6F+WAvmbbOFBSdLUNPXYJAT JZIqZV9MbxahUpMwwAToGJsfV3rxS1ccw4wb6VA0PYUwz9YXP5H/v7JWD7O8Hbqk0rwu0vsvZ wOzHEpbMzF0ZUYEiKptTk3cUA9AK8x1sg27xMg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support for handling the PPPOEIOCSFWD ioctl in compat mode was added in linux-2.5.69 along with hundreds of other commands, but was always broken sincen only the structure is compatible, but the command number is not, due to the size being sizeof(size_t), or at first sizeof(sizeof((struct sockaddr_pppox)), which is different on 64-bit architectures. Guillaume Nault adds: And the implementation was broken until 2016 (see 29e73269aa4d ("pppoe: fix reference counting in PPPoE proxy")), and nobody ever noticed. I should probably have removed this ioctl entirely instead of fixing it. Clearly, it has never been used. Fix it by defining a separate command code that matches the 32-bit version, and marking that one as compatible. As long as we keep the native ioctl, it seems best to also have the compat version working. This should apply to all stable kernels. Acked-by: Guillaume Nault Signed-off-by: Arnd Bergmann --- drivers/net/ppp/pppoe.c | 4 ++++ fs/compat_ioctl.c | 2 +- include/linux/if_pppox.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index f22639f0116a..c5e7435db86c 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -57,6 +57,7 @@ * */ +#include #include #include #include @@ -784,6 +785,9 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, err = 0; break; +#ifdef CONFIG_COMPAT + case PPPOEIOCSFWD32: +#endif case PPPOEIOCSFWD: { struct pppox_sock *relay_po; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6e30949d9f77..f1065d116b55 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -639,7 +639,7 @@ COMPATIBLE_IOCTL(PPPIOCATTCHAN) COMPATIBLE_IOCTL(PPPIOCGCHAN) COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS) /* PPPOX */ -COMPATIBLE_IOCTL(PPPOEIOCSFWD) +COMPATIBLE_IOCTL(PPPOEIOCSFWD32) COMPATIBLE_IOCTL(PPPOEIOCDFWD) /* Big A */ /* sparc only */ diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index ba7a9b0c7c57..d221f1465f41 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -85,6 +85,8 @@ extern void unregister_pppox_proto(int proto_num); extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t) + /* PPPoX socket states */ enum { PPPOX_NONE = 0, /* initial state */