From patchwork Wed Jun 27 03:49:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 140084 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp355990ljj; Tue, 26 Jun 2018 20:52:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIXIIKQOa1UxgmGEr+L1101ODxqhVqcKiRDuje/WtNWjQGF7S6k8MY7pkakG8gQgiWtbmR X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr4244879plo.257.1530071572069; Tue, 26 Jun 2018 20:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530071572; cv=none; d=google.com; s=arc-20160816; b=nqYDcufhpVdSeByCzDx1RB77Mh2ImdFNv1Vfxr16kdCmn+g+J/ii32aPljWd1B+I91 P8858ZyC7T+k0sAi0D20OtuSPa0cI4sKj1+A9Hp1p9QAYYNVwr2mEO4vPdgrdS4Y1c1j O3cAvvmUVYVCACJgIy/VA8tNsr7p4K9SSwcMEy8YVOZfikBu7Y29zkPtz1IepIiUvTx/ zEpVGKIAHUrJU3wtDd8hqRLupRbcIuFnuV1bxF6nPutx4YL8XcPxSlnKVm4H/pxUg7YJ XlXsI/YlosJRPOIwTFNxBx+NB8cfHWXhu3QFY2OG5NBKyFGeJEoW60/j/u+3pzG1n56y ZbIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=djRLwPttbIoZO6e6zHiB6/Cb0FWiE8qkFzAT1PtETr4=; b=GzFn6kYe7RhX5vRpXI1EzDfCgGBThjF7CJL0Dv7lhSVvHJyIG1kfiSsEZeUzGjGB2Y x+B30x4VYVuALwpNZipUCZiwkcDK26Eh5wV9uu36QYqZnQb/BXKLZB3Rl9bN+SiQzZwR sdd9CSgWEozoFOcO3oPOhyBO0qLecekSaOQiKI2495g5eFmpaHck272r4Ub5TgXf+AWD HJ4DzzJNomv6CfS4ac2m/ZY93quhomQUWILCCoWclOcl86ahd5Xe4DtdUE7UaJ4F6nv1 0jC14JOikRPkGPz8nOrUx6fIM+7f+sOLrPA0GgJFx3NFUGjrsxIyfhz+WAphe7Mxh+Vs eSow== 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 e67-v6si2973873pfa.217.2018.06.26.20.52.51; Tue, 26 Jun 2018 20:52:52 -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 S932257AbeF0Dwp (ORCPT + 31 others); Tue, 26 Jun 2018 23:52:45 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8735 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932084AbeF0Dwm (ORCPT ); Tue, 26 Jun 2018 23:52:42 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2D49F9605C8DF; Wed, 27 Jun 2018 11:52:28 +0800 (CST) Received: from localhost (10.177.23.164) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.382.0; Wed, 27 Jun 2018 11:52:21 +0800 From: Zhen Lei To: Steffen Klassert , Herbert Xu , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev , linux-kernel CC: Zhen Lei , Hanjun Guo , Libin , YueHaibing Subject: [PATCH 1/1] esp6: fix memleak on error path in esp6_input Date: Wed, 27 Jun 2018 11:49:28 +0800 Message-ID: <1530071368-15156-1-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/ipv6/esp6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.8.3 diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 97513f3..88a7579 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -669,8 +669,10 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) 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;