Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp269182img; Mon, 18 Mar 2019 02:43:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvoD2iobPtcNFNeSJIlP1ODgrYMkW4FbELxFAorRCPp+75yv9Z514mm37xd3tAw4k818bD X-Received: by 2002:a62:1147:: with SMTP id z68mr5091095pfi.215.1552902198643; Mon, 18 Mar 2019 02:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552902198; cv=none; d=google.com; s=arc-20160816; b=YzES+56PFC5rrk68YbOnFFxm8VOTcXIagqkvXoQpirjEvCs1Ys4KN5lDglww9B+5xJ /2uAx6t3GC0VrucubVZUO/YSJGgooqB6hTZI2t4RanpwNbTDENTdczy50tuqHC+syVLh 9aPI7qJ8l/nxYSD0lkGQIo4Ei9AlARmAfah0OCctd2NwsOLipv5mr4eHYRvIorZOxqgB 3T5qH7JjGgp9AM6r2jsQn0kx1GRai1dkuMAPaB8TMkjHltidtfloRzVvdTUGAD8Di/7U Qh5bABZbrCytjHTwBVqckCt84zGfK1pUCU0Y5oThZb1qPqVob1nVXf+9SIL16fTUhKsS PNSg== 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=Rq4ugopfC+p96gwj0UP0+xdpanLplxGKWmuPgN87XSk=; b=PbIMYWx1R2Hui+Er5YCVXAbBe7NiEUhU7jxwNVVgE/7ce1PdHHV9WUdPDU7ob7qiQe 5Zo7wfsLegLU0AvvX+B0dY6GLAOjQrYCHShyKJJtY/ohXfbGwvuxOf7K8vXXq+Y4RBTC aX7ylF8FLtMqNWHr3zvT3HFKA7v1xqBp2K87ICXF7uy1iKUPkV+sl6HUFCj8Iixn81vQ pmMSb15d0z3G4dlfIwL/Mgj7izt6ClRpE87mXIw6U5gLnx/Jt9xj2ZLxPCHxs+xQZNj5 Op/n+LfaJmCGQrjEFBhf8Iejwwqbe/UOHYxkdoBN/51S5D+51BwmpiwmYpaKSDgZsoDZ DyBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wh70EFC8; 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 b75si4029391pfm.127.2019.03.18.02.43.03; Mon, 18 Mar 2019 02:43:18 -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=Wh70EFC8; 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 S1728499AbfCRJe0 (ORCPT + 99 others); Mon, 18 Mar 2019 05:34:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:42816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726973AbfCRJeY (ORCPT ); Mon, 18 Mar 2019 05:34:24 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 0EC172083D; Mon, 18 Mar 2019 09:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901663; bh=a11u1miOPobiNlc+9OHlBsKXkFlM3bvsFbfRt/GcvQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wh70EFC8zUzPpqlzzFyu/ZIbhKGSm9/Z11uujJD2sQNu8lVt8un6Ugsm+7FjwMjCK xlAQINMMlyHZOnVgTT/p5TtBUfVHgnraiNlbN7V0KqmG6cTf10+Ig2UrCXj5JUy7z4 cLQfkVto5meJsTabVXz4+gbDlCyDqiSxWr/s9+OE= 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 4.14 11/34] pptp: dst_release sk_dst_cache in pptp_sock_destruct Date: Mon, 18 Mar 2019 10:25:35 +0100 Message-Id: <20190318084146.234108525@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318084144.657740413@linuxfoundation.org> References: <20190318084144.657740413@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 4.14-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 @@ -539,6 +539,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, int kern)