Received: by 10.192.165.156 with SMTP id m28csp55536imm; Tue, 10 Apr 2018 16:16:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+InU9MmTW24lDof1DptY5GCHydf0WNI5AOWMf/TAC470y9K9LvyoeFhkNQqH+ZxrU87HH7 X-Received: by 2002:a17:902:d685:: with SMTP id v5-v6mr2421103ply.284.1523402214321; Tue, 10 Apr 2018 16:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402214; cv=none; d=google.com; s=arc-20160816; b=c4x6P1JqF9KS0S8d1XPc0ekmOCswE8+WF+Ypyd0woi8PPZq5lqB6YsSSmuqEWfUiBp a+mspyO7fD27aaMP26TydgqdIL1Ts4p66e5GAAiUSWwQhVN0yMNKMyldYdNvLjyGRTjW eCXQaV8MdjQWHvpGqOhIO/h9XzDdbFveTGiGNLytJbINEZGpGvlP0isgL47h+g6HUf8d 45EgLPjcYRlqgfW5PdTdIop008281k72OtPD5kAPTRrOwujmeFSZqmDgWnuCqV1Dta0C AEEH04fgRTm8yzOsojhdH6F6mwlnwi464IKQ8gLzr2RQgkB4i9gp3LD4YxvEXKZP9MTr ID4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=H8mqPQvo2KVQTXq3CqX5ZO6pntX4GO1HioD0kL7ye68=; b=QMmK0+Dpsx6U7ASCc6mydjLTkdhmGjSv117e/bncmIUGyLgDKrSzAC/mC+iCMgT5Z6 wmbkKgRsXVmE5CmQuzTrT91aIu9HevfVcqiCnq08kSw++cze4+y/hDQ/KHdSW0LV5fQO om0rvo2IRb9Qk3nIWDNBP7KPrOtq6JOocOC1CUfUjax8HL3IIUff0VzMQGW3px1bHARV BvnfAkeSnA7Tddfczdh3aE8QEGaYhYaxS10kyiX7YKSZFW1pnNEzQF45e+FV/AANY+58 0FCsb55mw278OVbpL0UB4i7LjhVbSXXEZeyg/fr1Y2lFPSONfoJ3b6vbe7e+bFStDzzL /9mg== 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 a4si2782719pfi.226.2018.04.10.16.16.17; Tue, 10 Apr 2018 16:16:54 -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 S1755623AbeDJXLe (ORCPT + 99 others); Tue, 10 Apr 2018 19:11:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41116 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753909AbeDJWcy (ORCPT ); Tue, 10 Apr 2018 18:32:54 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 38BDCBCF; Tue, 10 Apr 2018 22:32:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miguel Fadon Perlines , David Ahern , "David S. Miller" Subject: [PATCH 4.15 139/168] vrf: Fix use after free and double free in vrf_finish_output Date: Wed, 11 Apr 2018 00:24:41 +0200 Message-Id: <20180410212806.989341969@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Ahern [ Upstream commit 82dd0d2a9a76fc8fa2b18d80b987d455728bf83a ] Miguel reported an skb use after free / double free in vrf_finish_output when neigh_output returns an error. The vrf driver should return after the call to neigh_output as it takes over the skb on error path as well. Patch is a simplified version of Miguel's patch which was written for 4.9, and updated to top of tree. Fixes: 8f58336d3f78a ("net: Add ethernet header for pass through VRF device") Signed-off-by: Miguel Fadon Perlines Signed-off-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vrf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -578,12 +578,13 @@ static int vrf_finish_output(struct net if (!IS_ERR(neigh)) { sock_confirm_neigh(skb, neigh); ret = neigh_output(neigh, skb); + rcu_read_unlock_bh(); + return ret; } rcu_read_unlock_bh(); err: - if (unlikely(ret < 0)) - vrf_tx_error(skb->dev, skb); + vrf_tx_error(skb->dev, skb); return ret; }