Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5914070imm; Tue, 26 Jun 2018 22:00:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIRSshge4OynbPZn34vog5YHA4Ca66rac/dSn+tmmdSbZh7FygS38PVDFvzShUbjnmVybBS X-Received: by 2002:a17:902:8308:: with SMTP id bd8-v6mr4530983plb.329.1530075621379; Tue, 26 Jun 2018 22:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530075621; cv=none; d=google.com; s=arc-20160816; b=On4n/4cTl0tHo0RUuiFNFCCg/7xC5vx4KcflBObquJyAdaWMmO34qoT8Y1VmH/HmQz 3/ijVVQDhYRxj8esIN3TAqVH6Hi6wE2XP2IffI228EhglmTBOAMGEtwuWGta5ZsoAn2c DOQJ/jinU4JY6Ggzm2Ok76IUx5JPj8PfWWlThUx9dlSVtNt+8vDGthLFj3sfu2lTTvB/ rzsOONPz/MEr27oyhzA8LRRIeY5XLjd066g5qEWYBumyVSb+7Vmvv9TnX6LAPC2HLfoR /1iLozdx0HfS4iDnlkM+TJFwVO/t+Qz31vcIGnDY0HIROafhdbE3es3ttXvwOdFqLluF y9mA== 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 s4-v6si2569089pgq.454.2018.06.26.22.00.05; Tue, 26 Jun 2018 22:00: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 S932239AbeF0Dwp (ORCPT + 99 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 Content-Type: text/plain 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(-) 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; -- 1.8.3