Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3318074imu; Sun, 11 Nov 2018 12:14:57 -0800 (PST) X-Google-Smtp-Source: AJdET5fC0YdcamNBXQk7oJIeyUfVsWzvk7+Z7yXNTE8fj1jNy8sPnOIfpw1t4U2XRQyilVl8O2GR X-Received: by 2002:a63:81c7:: with SMTP id t190mr15259989pgd.393.1541967297554; Sun, 11 Nov 2018 12:14:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967297; cv=none; d=google.com; s=arc-20160816; b=qfJuUFoCANDreiV0NxHpurj6+9F0eODy2wLEUP0NOVA8dsAIrER3BFC3GwPvEP28AX GwWAAfCuQccQ4DXGplD/4639LgRxpLdcFdPnb1H6Fzzw4xgcExw3U9WDyNslnmYLFwvl dYXVWGO2QACwFJIDsCqD+VDOpuBXlxKd8EBoTPqOa+AZO2cCt+VM23cH5KZImab1bf68 OBDpqT01K3M2xsqG+Ni6QO9K29mqBymKtxTS5drRmhI9LAX61CBog8KUNBuTtui57JaG +jJL/vKPRYmkgQ2/tNSyjIlce27rChjJq7V2hZn2GZIU4032QTkD5bApHvVRBNtukpPM n8TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=WLCPM/QJbcyrCdvh3ijqkfKtR+tsh2NrGYsHPKcWDuM=; b=aswflZ8mT6gUi1z5KJNWO+DLbU1TnRlQVTiOpLu89dDTSAhd9v3VN4tM2SsqLBe80h GOa/ZXB54fKv+T6NbkIqsdKoCZ+rAQIDx3F5de0RLAx5i6RBQiGfArLIC+wQceLQ+Dwy BO3aNTxmJvBC9HUjGD1iKL0GBOh8CdLXk/niv3c+Q6MgKGPj4kJz85lc4D+1wflOQw1s ZA/neTfWg4cgiVT5DeIeGy5i2LIvC8B7sWhB/UQPCcaPRzXXxWMoV1ijctGUvTmCG34L fQETHPm5e7XP3hy/hYhB3seaEfFWWVhg9fxgoQFSIMkW7/xVIC+gneYZj8qc53SbY+q5 b6Yw== 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 m6-v6si16933919pfg.282.2018.11.11.12.14.42; Sun, 11 Nov 2018 12:14:57 -0800 (PST) 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 S1731422AbeKLGDw (ORCPT + 99 others); Mon, 12 Nov 2018 01:03:52 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52840 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbeKLGDv (ORCPT ); Mon, 12 Nov 2018 01:03:51 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt0-0000l6-Lt; Sun, 11 Nov 2018 19:59:10 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsS-0001YU-Ee; Sun, 11 Nov 2018 19:58:36 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Guillaume Nault" , "David S. Miller" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 144/366] l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Guillaume Nault commit ecd012e45ab5fd76ed57546865897ce35920f56b upstream. pppol2tp_tunnel_ioctl() can act on an L2TPv3 tunnel, in which case 'session' may be an Ethernet pseudo-wire. However, pppol2tp_session_ioctl() expects a PPP pseudo-wire, as it assumes l2tp_session_priv() points to a pppol2tp_session structure. For an Ethernet pseudo-wire l2tp_session_priv() points to an l2tp_eth_sess structure instead, making pppol2tp_session_ioctl() access invalid memory. Fixes: d9e31d17ceba ("l2tp: Add L2TP ethernet pseudowire support") Signed-off-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- net/l2tp/l2tp_ppp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -1231,7 +1231,7 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_session_get(sock_net(sk), tunnel, stats.session_id, true); - if (session) { + if (session && session->pwtype == L2TP_PWTYPE_PPP) { err = pppol2tp_session_ioctl(session, cmd, arg); if (session->deref)