From patchwork Tue Jun 9 17:44:04 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: 187702 Delivered-To: patch@linaro.org Received: by 2002:a54:30ca:0:0:0:0:0 with SMTP id e10csp643756ecs; Tue, 9 Jun 2020 11:25:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjPNnBDPCNQtg723GW6a7BOPOyYdDqPA4TH/yQJtJ6vosdax41Pv6dIrr1ALZtaWNNVoLn X-Received: by 2002:a17:906:b2c1:: with SMTP id cf1mr28299492ejb.135.1591727151684; Tue, 09 Jun 2020 11:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591727151; cv=none; d=google.com; s=arc-20160816; b=sUkggc4WU+Lz/u29g/QBssV+OWAvyyekaRVMqogI8HN4GXtHmN8+x2rjRWjREcobk8 nFGmiVC/IKxtO7przZoH1hGwnO5zL5uKrh/4pOw1ew15Z5ayC71IWfb1cCI5mGM2N2qk xh6IjefI6BEYfjs4frSBvOAsprvADOosJ61r09aNysg0Ix2SnkhTdN4PCuEyEnO0XJFX G79BxpkiNk77i8zPFko6eF24GQ7iJ2EpCKfOzfzC97+2R/vEIOwiZV64QwyT+qkHXcTq 5XJynpEElK4gS5h4YsLyWtUcefXpPRQ+r0o3+3ZqO7AIlQ1QNbF4r3YLpfE24DUJcMen WJrw== 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=QRxanaEdYea06p9lcbLf7RCeAOscZe7shPnY8KeEEMW5eWgM/HmH4qrjjl8rXyJAJ1 IkBOuI/g9ePLfRYTyopg2GuTUnaCiGvCf3DZctZ1Av3yAmYZBFh/XrBK2KQeKEEG7epf lZmH+uCO3m1/DIwhyWttwogkQJyCKFFprhA4SWl4b1PGHQVmjFktFRn7BCs5MbXq8Mcr JDL6WvUUVGtPFuSRzI4sdIHE/FOhfrP88fkRO+BKJ6maU8q4bSFaDHGdOVGwup0dvEV2 fo0TQ+hjfe2mX5cOXXYUI7SaKvt+2LiMQSP9oiIBOxPQ7YGbLnrCJSUepMEj+qfLmhW7 iCHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VLkn7KRW; 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 s18si12709585eds.79.2020.06.09.11.25.51; Tue, 09 Jun 2020 11:25:51 -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=VLkn7KRW; 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 S1731905AbgFIRqT (ORCPT + 15 others); Tue, 9 Jun 2020 13:46:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730555AbgFIRqS (ORCPT ); Tue, 9 Jun 2020 13:46:18 -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 71B9620814; Tue, 9 Jun 2020 17:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591724777; bh=sAKqQsYspESBgdnN+eV9couIFzpg4RDXKq4PEh5Ww5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLkn7KRWaTNnkEYr8POhMF0jwueII5niHAG9eA7vwzE9A8klrVUQUlp9eNtc6yAg8 SlWf9lbbbeoBeKlhh0aG/90WaIdBFrpQg+1O36t83rPq/8cAlz9o3R9CmRKuYegNfJ jzYCKYcw6HRy7oisGCSomS8FV/mC8cwy0f3HTN+M= 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.4 04/36] esp6: fix memleak on error path in esp6_input Date: Tue, 9 Jun 2020 19:44:04 +0200 Message-Id: <20200609173933.542853475@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609173933.288044334@linuxfoundation.org> References: <20200609173933.288044334@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);