From patchwork Tue May 26 18:53:56 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: 225358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F67EC433DF for ; Tue, 26 May 2020 19:10:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 136C8208B3 for ; Tue, 26 May 2020 19:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520206; bh=EfmoUFDfEwH4Q5Ot/bnQSXjd/BZyqtVbIvDLawe1sL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hgPKc5xTrba4KGN12zg/BWVudW2ZVY4iJrcEuPwHefmVk6fdT3Mdw9VfwSVOtioqv uEl38vckIwa7zjPzoIco9dC/zoD1cpavHka3LaT2j+Q3dm1MsYo2mdhpO7eCkoDzx/ v2p6lzWFKoFUYlDyMTUiW/Nm83rN5Z3wBzsCoib4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391228AbgEZTKE (ORCPT ); Tue, 26 May 2020 15:10:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403969AbgEZTKC (ORCPT ); Tue, 26 May 2020 15:10:02 -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 E4F05208B6; Tue, 26 May 2020 19:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520202; bh=EfmoUFDfEwH4Q5Ot/bnQSXjd/BZyqtVbIvDLawe1sL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0AIlrwXSmFzzxtxmhKspwNzJCi1P1iLV752YcboyQyQCmon2wG3ye8IQ5y5qSrXH VVqOr0Iy4M8YO+bGIQXvgrgTSZpjCrN0w2Zx8/DwQuvnTIVe4SwQpA+CeCzGCu4jDO 9GaDtAA8ykswgZmIkKVSebqCm4z3wPHfOWs1LWYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , David Howells , Markus Elfring Subject: [PATCH 5.4 098/111] rxrpc: Fix a memory leak in rxkad_verify_response() Date: Tue, 26 May 2020 20:53:56 +0200 Message-Id: <20200526183942.199358513@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526183932.245016380@linuxfoundation.org> References: <20200526183932.245016380@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: Qiushi Wu commit f45d01f4f30b53c3a0a1c6c1c154acb7ff74ab9f upstream. A ticket was not released after a call of the function "rxkad_decrypt_ticket" failed. Thus replace the jump target "temporary_error_free_resp" by "temporary_error_free_ticket". Fixes: 8c2f826dc3631 ("rxrpc: Don't put crypto buffers on the stack") Signed-off-by: Qiushi Wu Signed-off-by: David Howells cc: Markus Elfring Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/rxkad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c @@ -1148,7 +1148,7 @@ static int rxkad_verify_response(struct ret = rxkad_decrypt_ticket(conn, skb, ticket, ticket_len, &session_key, &expiry, _abort_code); if (ret < 0) - goto temporary_error_free_resp; + goto temporary_error_free_ticket; /* use the session key from inside the ticket to decrypt the * response */ @@ -1230,7 +1230,6 @@ protocol_error: temporary_error_free_ticket: kfree(ticket); -temporary_error_free_resp: kfree(response); temporary_error: /* Ignore the response packet if we got a temporary error such as