Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp578884img; Fri, 22 Mar 2019 04:26:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoIKU/7LCidqE997pxgO5Nxlc4M2D2DkD8+vXmYn5Vrw+nYLNJ0XBGBrQUQpDj0K4joZZd X-Received: by 2002:a62:4290:: with SMTP id h16mr8704138pfd.8.1553253993124; Fri, 22 Mar 2019 04:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253993; cv=none; d=google.com; s=arc-20160816; b=I9Sc6t/ejgjzelj8T/EDNAImthKrj8sU9MOxK2i6z6tITwJ3Ake0Xy+m6tkHb4Zh/3 cWKEjHH2u5PVViNkLiGoZq0OdXMIBbE/SAKpuOVbuac1RSVHX4N3Axuf+SklN3nMUmRN UfwDM/ignf6bTKWdKKS3C9BQ3w73PGnDFWElxsCOc7MHALlXUIU50ElODQy3kvQFoSOi lCHqTLZ9VbjiqwuXiWTIThUtS7HwcxZBij+zU6EmXeobqPNIJiC6/Wi3eb2rOiBZme84 MjioIkVJQrveFUIvxt2dGagMg792H39TRSM6YVNOTQfwmdwAZGx8Lel7y2whc9R8gUuS hU5A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aceXh8t4ETGBF8kshR4dOz3apWY5oUTu3+l0pHNAs0U=; b=yChSPwSIn7/tzwdZTdw6Os1KrNpJwU5+XQOlTS1p9CY6Iqc4TbH0Tmn/ENEf81ZNuN PqSWep4Lwk7xmI4IZ5XWsw5hp0G/2koo4NRfn7dGmEDgV5+KXjZt9CgyxJR5tz35VcSY r1RO1tmYGhy/NqOejHVmpNXZXayxtnbqeDbvXVtEsqzOrtFS3Qrd3oY+P1UuZInaWIGa S7R1AdoNzs6ibBkX/QUec+UO2KrQfSnCC1dz8sI8veP7uuBoNkfByLrHtvh3IYTvx9/q x9BcvgJjtcbmzeLTCaZtFsCYV1fY+DOargKob/6GIbm495PmuvySiB1mYiHbXJhsMb7h EMrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Cs6wL/Pw"; 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 d37si7150053pla.71.2019.03.22.04.26.15; Fri, 22 Mar 2019 04:26:33 -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; dkim=pass header.i=@kernel.org header.s=default header.b="Cs6wL/Pw"; 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 S1729162AbfCVLYj (ORCPT + 99 others); Fri, 22 Mar 2019 07:24:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729146AbfCVLYi (ORCPT ); Fri, 22 Mar 2019 07:24:38 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26FC8218B0; Fri, 22 Mar 2019 11:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253877; bh=MW9UEjgjQp2JunpCMRk/4++U5o+8k0u93p/XteIpvgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cs6wL/Pw5HzZpBG3ZYVcv3XbYiCsH9BnjUnPd+Nnc5+GI9Dyypfo+oWi19GLmwYhh vCyhY1YlbQZr61nF2u1aBZWeZIfnCwo4Z/llM/006SvizM6ft2bgvJ/mDWmJFQpMGV +ZIuko9A8AkLh1GMyBq6mboGEtf/ya197zah6bRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiumei Mu , Xin Long , "David S. Miller" Subject: [PATCH 3.18 084/134] pptp: dst_release sk_dst_cache in pptp_sock_destruct Date: Fri, 22 Mar 2019 12:14:57 +0100 Message-Id: <20190322111216.195203788@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit 9417d81f4f8adfe20a12dd1fadf73a618cbd945d ] sk_setup_caps() is called to set sk->sk_dst_cache in pptp_connect, so we have to dst_release(sk->sk_dst_cache) in pptp_sock_destruct, otherwise, the dst refcnt will leak. It can be reproduced by this syz log: r1 = socket$pptp(0x18, 0x1, 0x2) bind$pptp(r1, &(0x7f0000000100)={0x18, 0x2, {0x0, @local}}, 0x1e) connect$pptp(r1, &(0x7f0000000000)={0x18, 0x2, {0x3, @remote}}, 0x1e) Consecutive dmesg warnings will occur: unregister_netdevice: waiting for lo to become free. Usage count = 1 v1->v2: - use rcu_dereference_protected() instead of rcu_dereference_check(), as suggested by Eric. Fixes: 00959ade36ac ("PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)") Reported-by: Xiumei Mu Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ppp/pptp.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c @@ -564,6 +564,7 @@ static void pptp_sock_destruct(struct so pppox_unbind_sock(sk); } skb_queue_purge(&sk->sk_receive_queue); + dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1)); } static int pptp_create(struct net *net, struct socket *sock)