Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821032imm; Mon, 3 Sep 2018 10:17:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZZWX7K1stAfMs1YmT9rorhxELDFHv5KROr2y/A9agIylNCSg4A6HKwDKdGC95CJyT3Bhze X-Received: by 2002:a63:d645:: with SMTP id d5-v6mr1873488pgj.450.1535995042769; Mon, 03 Sep 2018 10:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995042; cv=none; d=google.com; s=arc-20160816; b=GHjejWngfnWpg5byfGgc/PjkZ++tETQ4jdynkY212Pk+uvmPpYljvQQHpF5ijX3Jij KkH7eACkUVoKMwtsUEHuupn8LlotyLqrwSr+Qf/RpV7FshxGZ66Po/hD4rMP792NS0rI U5rFabe9XfS2JPTic3I+AkWr/QhTE6F4iou80t9ordb9RJkH8anIJtbTLHSIohrFCd0z jOCdifKZ4zPLaQsZ0Q5IXBAEuZ6kJOQ+F42fPjnssg1EFgSEr5g5FUHh5cibphzzFbFi HJaz9cV6iUVoROpLnx1IZC9zwE52xjkLarlsqyKG5fAyJVKlPLH0ZLuYiEYW6Ysh3PB8 +HfQ== 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=4QAulpSJlnwY3hCCT7BW+wxBMMjkCLV2tUdSu2AvLy0=; b=ZuKbQHRNoBRlW0AIwsqeJhOt92/HssxcOQpIG9adEkGvGvUT8Wluz/MZRo8GcAefkq YkumOlhz8QFt55xiXQtmTBCnXOjyubUlAbRyVGONKvemlpMghhVDeBdibj0RzQ7eXZfL lO4juZJSnzeo3Nap4NLgE9Tp9PN/yBOCFcnl6uch9P0F4jKPU87nzDBjwacpQOqVnmsE zLsIiAbIhXxvtifsR1RRXkDyDvjQL0A5iSO9ntcYaP7VnSrTsMYU+CVBO4kpnJfumBKP xQc6Q8Zk7l2nFIP3UF9bHB2fohM2t22frmZK+W6209/ktpyBv/6Y2sOjz8qB+o2aDKaH Qosg== 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 w2-v6si14946060pgh.182.2018.09.03.10.17.08; Mon, 03 Sep 2018 10:17:22 -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 S1729809AbeICVhK (ORCPT + 99 others); Mon, 3 Sep 2018 17:37:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42494 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729135AbeICVhJ (ORCPT ); Mon, 3 Sep 2018 17:37:09 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 98B37D06; Mon, 3 Sep 2018 17:16:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhen Lei , Steffen Klassert , Sasha Levin Subject: [PATCH 4.14 005/165] esp6: fix memleak on error path in esp6_input Date: Mon, 3 Sep 2018 18:54:51 +0200 Message-Id: <20180903165655.272330518@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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: Zhen Lei [ Upstream commit 7284fdf39a912322ce97de2d30def3c6068a418c ] This ought to be an omission in e6194923237 ("esp: Fix memleaks on error paths."). The memleak on error path in esp6_input is similar to esp_input of esp4. Fixes: e6194923237 ("esp: Fix memleaks on error paths.") Fixes: 3f29770723f ("ipsec: check return value of skb_to_sgvec always") Signed-off-by: Zhen Lei Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ipv6/esp6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -651,8 +651,10 @@ skip_cow: sg_init_table(sg, nfrags); ret = skb_to_sgvec(skb, sg, 0, skb->len); - if (unlikely(ret < 0)) + if (unlikely(ret < 0)) { + kfree(tmp); goto out; + } skb->ip_summed = CHECKSUM_NONE;