Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1067948ybl; Wed, 14 Aug 2019 10:11:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIy8AghZuQiyh7FOCX+cSdVlphTN3PUjBtnKnlIyXICXjk1PM58M9agVZlYgIvmwIu+MCW X-Received: by 2002:a17:902:7c96:: with SMTP id y22mr399471pll.149.1565802667190; Wed, 14 Aug 2019 10:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802667; cv=none; d=google.com; s=arc-20160816; b=Z9D5/DuzaExFSto/X/Qktq9LucmgG15hCVrnkjXUDAHVykpx0FYYqCKiiUbtjkaunf qFSkmI0+e3jRS0AQUGeMglguGS8mlAk/b67g0ObVLdCruyC6H2Wf1VGeaWljgZF5Hb3r PCDLxLI+6+PO32jM5PzynFQTiSpubZPeEXT2XdpvcIaBI87K9YUftVmBMdZmaTj5FrLc Rklvjw9s/P6zcxmKlnAkQV/++a78szkvH3REK4V9DAz4WqJ52J2GV2bGapCC7vnS7IqI qAAkTj+eEqB/M4lEyqz+ubhI6bfV0DXsyMmvdoH/ujFKJc904EnhXu8RT3xHC26FpSeS 7mCg== 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=Pdvm/QsZNd+1mPTM0Pen6LjXKgEZBgXN75+msweQnc8=; b=quJH3mt6tUfy+vy/bSiJRRV/vEoIrXBu/CJU+IhkJYxbSaU/vr7SQoWVWkBuwITp3K 4auavjkmbhlxFjylF4zgsTk/NEB8XWWe6+xmH6TI+yvsGwNW6OgranHJvIqZC7EZWp1X oMqgjvLhcUJrtX66DLEigUU4fJvGopgV3ila7ycP/0cXHiO8vSg8wCex29zOeOmCbeoP ZXeIaFMxDniOVvNbPyk79ZwvhWDntSSEGe0vRBjD+7cYTI0WlGaQ04UuRVEVQEAK6rGK Iq++8K8B2T4jt3T0S8HHJPEjeKeiywIiWlJbpq4783bbFOBQwbwmcmfs7ooSt5zL4p8m 7W2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yoWNYr47; 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 c6si238216plo.263.2019.08.14.10.10.51; Wed, 14 Aug 2019 10:11:07 -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; dkim=pass header.i=@kernel.org header.s=default header.b=yoWNYr47; 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 S1728301AbfHNRJc (ORCPT + 99 others); Wed, 14 Aug 2019 13:09:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:59920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbfHNRJa (ORCPT ); Wed, 14 Aug 2019 13:09:30 -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 1D149217F4; Wed, 14 Aug 2019 17:09:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802569; bh=bMsK2oFPbruaZw4mTKjzxcr+KGodWlB7UpdOisVetwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoWNYr476/lK2+QcrCvrTYNOspdFCgCDxkxAI7Zlcp5GgkXJejPG611u+XAm1X1ZB Ha8V2zTaUVCm2cmWbQmHyqC0azgt73l0YIN27mRZAlOS0Xc7Y6jLQIBUnzLJXWLrYk z0xtlz3MKrlliGTzcFubhJ8gRc9RLcWYilFIcNjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gary R Hook , Herbert Xu Subject: [PATCH 4.19 05/91] crypto: ccp - Fix oops by properly managing allocated structures Date: Wed, 14 Aug 2019 19:00:28 +0200 Message-Id: <20190814165749.293699173@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gary R Hook commit 25e44338321af545ab34243a6081c3f0fc6107d0 upstream. A plaintext or ciphertext length of 0 is allowed in AES, in which case no encryption occurs. Ensure that we don't clean up data structures that were never allocated. Fixes: 36cf515b9bbe2 ("crypto: ccp - Enable support for AES GCM on v5 CCPs") Cc: Signed-off-by: Gary R Hook Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccp/ccp-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -862,11 +862,11 @@ e_tag: ccp_dm_free(&final_wa); e_dst: - if (aes->src_len && !in_place) + if (ilen > 0 && !in_place) ccp_free_data(&dst, cmd_q); e_src: - if (aes->src_len) + if (ilen > 0) ccp_free_data(&src, cmd_q); e_aad: