Received: by 10.192.165.156 with SMTP id m28csp29573imm; Tue, 10 Apr 2018 15:44:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48rf5G1T4Gw0W0rBlQnyEGOFXOks8c9gZxtN56+bIHmQZcRGn5hOf9sBQsQDM7exhbgdJB6 X-Received: by 2002:a17:902:322:: with SMTP id 31-v6mr2365917pld.122.1523400246650; Tue, 10 Apr 2018 15:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400246; cv=none; d=google.com; s=arc-20160816; b=MF+99En7wudV4o1QcrKIY59NSVZs9kb8tzcrHtA0LFA5hMwAU/bM/KcgT1edCzmfR2 RnimLS2P4QHX+P08++uEdEw+UIYjynMMoF9vDvMhCM2t3PlBmwHpT9/IfHXtGPoSh2hW bllNiQwxuhW+wjKyEzMvUGrTZz5xNRjSTRnD3MgpfKBceKgjIQktQYT+iJyR4Eupyukp zAVOoaTnvWOagdUvX31qbodw5VZ9odcnqumteWaBLhK65eU0c7Au9FN9nOhCJm2T2uvf 8bX3D5HsOSwvH0JKLq4U1h6fS7p082ypZNps82mPe4qt7HJCBID1sJOkVV8uGixHa7N7 gKPw== 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=vIb7YUG7W/es6A0NU2bX8wWLU6tH5iAm4HU7B4AcLsQ=; b=NsXJPrD1MzRyH8aFfx+F98Zy4iBEWcGFtWsboqGFdjXZUpGJc6KSvFuke8omCzlldi yhhQeYS4U5ZMON1LbNEWGn2O/DVcVjM1cY4HI+0LBCISAYQXuBfMsX2LZXxlcKYLPA5k Ly5TuDl24JACFytFZk89gFGSs4FYlEe/oGuTQnTNvhkRK9jsV35micYTmlUaLfPoe8qR gjy7ztFbnjRwb0TqVtnSxcl71j3BzbokbMb5+2804/9NGv0TUfUpeC+DLik8vyaPxwgd JswNK0ovYu+8tpJDMkXgxOh+klUmO+SrPLPg/C/98stBsfbrtn3Ml2tsGSfyGReP1Arf XXIg== 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 l5si1787411pgs.605.2018.04.10.15.43.30; Tue, 10 Apr 2018 15:44:06 -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 S932643AbeDJWjo (ORCPT + 99 others); Tue, 10 Apr 2018 18:39:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45630 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756072AbeDJWjm (ORCPT ); Tue, 10 Apr 2018 18:39:42 -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 063D7D31; Tue, 10 Apr 2018 22:39:41 +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.14 113/138] vrf: Fix use after free and double free in vrf_finish_output Date: Wed, 11 Apr 2018 00:25:03 +0200 Message-Id: <20180410212915.311413155@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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 @@ -579,12 +579,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; }