From patchwork Tue Jun 9 17:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 187701 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp641648ecs; Tue, 9 Jun 2020 11:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOZx08JTRz2ZgB2LQS+4VuAZCt5SJe3SXFiBqVCAlWEhXL83GIFUcBnZfPdQA+I7gC7xlx X-Received: by 2002:a17:907:94c4:: with SMTP id dn4mr25750202ejc.150.1591726945641; Tue, 09 Jun 2020 11:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591726945; cv=none; d=google.com; s=arc-20160816; b=DUTwwHwZrbTxQ1829+wzoMRBz0r92A5/x9roqfo7255vu4rpibNehj+aMEp+ExeMkp XffVKWQUOu5k1RAITC14jGVZw18dTmjpzOLu0ttHdXa/I4Jo30v3ZiopKz+J7xv0j/Iq rsEnunzUfePkCw9naDrkD0oLU/1U7k8FomR29rQXXmCVC4X1zl9zZmvPRtLYkhKzgjJm sv9h2A82iWJpRTWJynHVDSWhHIgOnDI7SZvicEZfvt1bSu/TnUu0sUHIFgkcixZ8c8mm 7yJsLW7kkGwwzYPW6R9z0VB9S2fZ+YyzukMtQmR/aMKt+fd3Mi0+h5f4zrInKcZ7f2RT Kfxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uG7MvdfT3YivL9FCIxT0/41PwyiLhEGIu2AjytJqkfU=; b=FdNGimAwMjMXre9kRRE3YbJ8Tovzrr02CytF4LT7gRof5ZcOVcqJQKHlflVFJ2dndx QksVJjbhdnLYwKIypxC9Avpf39sXQJ2/xYuWaz44/D42PBFoGciYk3giMI1qIN/rDdit 2s1zIMBD97vJCN76BmOR3jDrEeviqcIZNDvbGDsFbtxfqD5gU3bYjmRyaoc4Aq/OM6lX QM5lnbL0jIZDcUSclr18T/oDqefQM/AXJBTCQeX8IKxcwhGFOgv8QSUTK6GNBPJEzzYu CDPEgTX6GLYF+eAVk3LycOAPYMOuouaOy2c8I5Gge4u9lMJMqmHV2SVJs3KAUCC0hq8S LjGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AsfEUCK2; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl21si10493719ejb.739.2020.06.09.11.22.25; Tue, 09 Jun 2020 11:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AsfEUCK2; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730612AbgFIRsX (ORCPT + 15 others); Tue, 9 Jun 2020 13:48:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:60640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732271AbgFIRsW (ORCPT ); Tue, 9 Jun 2020 13:48:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A206207ED; Tue, 9 Jun 2020 17:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724901; bh=sAKqQsYspESBgdnN+eV9couIFzpg4RDXKq4PEh5Ww5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsfEUCK2srszFp2b2HA7OzKcseLter37K/z/FmQautaF6YT0hQDM3Q0D772LiQQs7 iAVQQMeqAT1P1fWRJbPUa9406Y7/oHfErIOqopE2iZ6AjtcpwJ/NgumNprqH6Eytkm xmvKazHlOhaiO521vkJvzfyK13Tji5QEvYsZK1f0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhen Lei , Steffen Klassert , Guenter Roeck Subject: [PATCH 4.9 03/42] esp6: fix memleak on error path in esp6_input Date: Tue, 9 Jun 2020 19:44:09 +0200 Message-Id: <20200609174015.786573756@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174015.379493548@linuxfoundation.org> References: <20200609174015.379493548@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Zhen Lei commit 7284fdf39a912322ce97de2d30def3c6068a418c upstream. 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 Cc: Guenter Roeck 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 @@ -426,8 +426,10 @@ static int esp6_input(struct xfrm_state 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; + } aead_request_set_crypt(req, sg, sg, elen + ivlen, iv); aead_request_set_ad(req, assoclen);