From patchwork Fri Jul 27 06:51:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Klassert X-Patchwork-Id: 143012 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp461859ljj; Thu, 26 Jul 2018 23:52:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf/+lZcy77kAqtZL90dGPyqA2ex7GaqCPmPc7e6LVcLh31RA5+CFDusl6CamDMjbH8WCAOf X-Received: by 2002:a65:53cb:: with SMTP id z11-v6mr4858727pgr.218.1532674325857; Thu, 26 Jul 2018 23:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532674325; cv=none; d=google.com; s=arc-20160816; b=Qh4jP3OHTrBerX8RpxX8Q0WIcem8YO5q2IdvI9ozpvX1YKVe4eLe1bdk5fz7rUsf70 vXOTz7d/Mxs57duPxrpuNRoOYgNJq3zA65DyCDaEXXmOpkacVIz94N2F0WqgPCqrfpWJ 4JfLBRw9YQ/2VZ8YJpcBnyTKPiULhL2JTsJvlo54p630NIyRYBZiDoTe7NXaq83ENjs/ v0rlrFaXhM2dCphEEUU89DZswa186gUsKTzSCuA73tF3gQidQSxhwWe1m9WaY7JSy9V5 nwFEWGCivgJFcZXA09BMLwLLcm3FFjMAN7f46wGvikTVH/zAv/bno+NxKF+yGmA3seZZ UcXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=UCFtSzz2xRXHNoxydZaoLQGXq92KQezapfGA9eN+HsI=; b=qDVjlXjiF9OQM6SGkw7sHys7w5iVbh3WOigOZy7ULP98wwE16f/IlAIsu+T9/Smw39 zyw3z2Mese3CoJ/bviIhutitGAc1KVvGYTnSaroXGk80AGGSJVLar3VRf9fmuOcYP6FP eMJA0vSmtE6P7fVsmSyqYJGDcehY5XUjivpWCtoG8uyLXy2boBU1Z3itz81VJzUPnHkD NKh45/f9DdcZrq0gGi0ifq79o9wKf5UapyGlHncBji8qG3NjZxXqBAhUGzgi3cW3IFfr LA7y1vwVcJi0IV8xCpIlKXjupwb1vBkgBwAh7Vu7Pk16MjJZTrAuvs6WCfy748VCi+4m KZYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 f9-v6si2873548plo.206.2018.07.26.23.52.05; Thu, 26 Jul 2018 23:52:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729559AbeG0IM3 (ORCPT + 10 others); Fri, 27 Jul 2018 04:12:29 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:56008 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729487AbeG0IM2 (ORCPT ); Fri, 27 Jul 2018 04:12:28 -0400 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id A9951201C8; Fri, 27 Jul 2018 10:51:45 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1HvCiRPHmYhs; Fri, 27 Jul 2018 10:51:44 +0200 (CEST) Received: from mail-essen-01.secunet.de (mail-essen-01.secunet.de [10.53.40.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id B1D80201C3; Fri, 27 Jul 2018 10:51:43 +0200 (CEST) Received: from gauss2.secunet.de (10.182.7.193) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server id 14.3.399.0; Fri, 27 Jul 2018 08:51:58 +0200 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 0F0073182103; Fri, 27 Jul 2018 08:51:58 +0200 (CEST) From: Steffen Klassert To: David Miller CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 5/5] esp6: fix memleak on error path in esp6_input Date: Fri, 27 Jul 2018 08:51:54 +0200 Message-ID: <20180727065154.28557-6-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180727065154.28557-1-steffen.klassert@secunet.com> References: <20180727065154.28557-1-steffen.klassert@secunet.com> MIME-Version: 1.0 X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 23 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: 55642349-CE9E-43E6-A638-214CAAE82C0B Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Zhen Lei 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 --- net/ipv6/esp6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.14.1 diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 97513f35bcc5..88a7579c23bd 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;