Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2310298imm; Thu, 7 Jun 2018 08:34:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKImAKIztQe0Q9J/7uRr803nJD18w9owSHyEASHci3Bf6mRspo/6msddUY/E5LeNEHmOtzaz X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr2483035plc.87.1528385661997; Thu, 07 Jun 2018 08:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528385661; cv=none; d=google.com; s=arc-20160816; b=FlvHk79VOkLmrcFeUVbjX0WGiFg9K+dlx8c0UgMGp3wuIhPss+0IkCUxOAFfTYFNUw 4Aa3mFzcKRvepB5BvvwK9THpxj6i36cFAeOWInp4aISRWk6+NBQ+Jx0jFUXCj7b8LFAT m6h3Pp4RPw3Swc7o214SMHxzSdufm8PeyX7ObbtAnIyDaS4gc0h8qu3SzgH8Zn+jxp2o DeldMpA4o2gRK1qjKR2GG3vu756vd1/pio6mGWsLtxRd05nmgckuALsfInHWgmEghQjH kevF5q2vj7WmDfjam6o9Q2JWejRq2d7dDOJhRtS1a/Y5XLh/kWanVw+o/k7pifzZSYWp 0VYA== 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 :arc-authentication-results; bh=/r8PT/15RTkuQTQE52MMMkJClcFQU6fbz8YnzjaFD/I=; b=P92NE8d2OjaKXkYkL5D1xNopTHsza59INxMy3xWcSHCQ1REjUQZNR4RctNkX63YBG/ q9WPKkkP+kYlwbGLJDZcUArpzktWOnkCBVIjW57dmJzDFFQg2w2WOxEKbEcsCml3JdOr 4B1jMC2UJoN1y3wBmB4UFjClN6zF1aLDv0y5cJ3Pl97hd7BpJgMjtBbNMxZNzE+uF+SE /Q8XBu7cLFXvb1AJvDjvKy+G0GF66kV+fo9h7uKhCa0wasoQHp/ebR07zJZb/aXJtyPr mHOVCYgbLh365peb+P0seJ95M6DevZLLwblC9J5FcdANvOKJZ6/THAeMxBrBS7OuRpod BCgA== 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 63-v6si39391943pla.140.2018.06.07.08.34.07; Thu, 07 Jun 2018 08:34:21 -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 S935213AbeFGOwt (ORCPT + 99 others); Thu, 7 Jun 2018 10:52:49 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40919 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934776AbeFGOwr (ORCPT ); Thu, 7 Jun 2018 10:52:47 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbQ-0005Zq-MY; Thu, 07 Jun 2018 15:09:25 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbC-0003Cs-71; Thu, 07 Jun 2018 15:09:10 +0100 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, "Arkadi Sharshevsky" , "David S. Miller" , "Jiri Pirko" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 336/410] team: Fix double free in error path In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 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.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Arkadi Sharshevsky commit cbcc607e18422555db569b593608aec26111cb0b upstream. The __send_and_alloc_skb() receives a skb ptr as a parameter but in case it fails the skb is not valid: - Send failed and released the skb internally. - Allocation failed. The current code tries to release the skb in case of failure which causes redundant freeing. Fixes: 9b00cf2d1024 ("team: implement multipart netlink messages for options transfers") Signed-off-by: Arkadi Sharshevsky Acked-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- drivers/net/team/team.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2356,7 +2356,7 @@ send_done: if (!nlh) { err = __send_and_alloc_skb(&skb, team, portid, send_func); if (err) - goto errout; + return err; goto send_done; } @@ -2636,7 +2636,7 @@ send_done: if (!nlh) { err = __send_and_alloc_skb(&skb, team, portid, send_func); if (err) - goto errout; + return err; goto send_done; }