Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1086778ybl; Wed, 14 Aug 2019 10:29:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsQNvRgxpU5ugvSgBQgHmrBgL2U5fP9eBYnREZi/brEuFJybIHIATHftHFold/oCQK/08w X-Received: by 2002:a62:f94a:: with SMTP id g10mr1047405pfm.167.1565803742740; Wed, 14 Aug 2019 10:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803742; cv=none; d=google.com; s=arc-20160816; b=kselT+H6xfjyfHOwAP8cd5v4nAJHhOCKzMz3G0+H60PqMVCSzjozD1SVuhAwZ4Sv2Z fRXjV9bx6NHGXXYJCRCLHmj5KP9qrtAmmXnqv+1tA5oQH6kqzsP3dWXSOSrmmkCLVBSM 224yYkLEF2yYwP2itKP0/ctOke4rNOYPMMycLVK9WjGu7YJ39NCNgw8LJt+oTtXfLozf lGfcxqvcnlCBZcYOdcRmXFGjYsSD3BGD7eF9RhAIJpM77rWZIBpyWum+gRJgoon+8xWD okRlQ/JwRbZqjqMZiL5hKFI6P8irPwZHBjmQQvcHmvbebjHjkihJqtxCB3nZYhxY7y/p I+8w== 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=qARq4odul/npU0yhhAKxNzfY7ntEl4ooLYHKHdcxUX4=; b=v5gaaoj8+AZtn3tBJrE1S5AZQybkIIAu16WyZnKSqGaDDP3OaGqG0pH1qk82Pylzsg W2V3YMVR8LJiqN/zwqGok7nx7RZ0KhMILqdLAQJRBEamioH8OCaaLvjJVk2807bDNTlD rInNbeHrMtFpiquZKAkEtQPE1cPGtzPdOtnlO8zLXRVtoR2BMCjajeczyUVnomjgbzH9 wlZxg41/EhkGaXsx2F6GXQYJ8qK2WR+LwAXCSP5hTqC9LmQTe3PCbO2DlkXkLRR975gu xXxZ4Oe45J/4D92Hfv3wwzH7lqBI6O7BIYmiIjY7aAFD72pCK7zje0kGfygHfiKUef5r CkWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bSZP2xp2; 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 i6si116504pfb.122.2019.08.14.10.28.47; Wed, 14 Aug 2019 10:29:02 -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=bSZP2xp2; 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 S1729209AbfHNR2R (ORCPT + 99 others); Wed, 14 Aug 2019 13:28:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:50882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbfHNRCZ (ORCPT ); Wed, 14 Aug 2019 13:02:25 -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 DDEBA2173B; Wed, 14 Aug 2019 17:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802145; bh=3hYd0RRYBbfAdBHINRX2Cp50Gclo48b009vT2VZQ0yY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSZP2xp2GLQF6MuAEtA1hK/WOhormIhylGQNAyi5pGuHftzpvYW1HZ1jh92SWSNe2 H6rGzwPd4gW8VdJiiJEM5yvp0+kSVeJ8G5PTQUW4TPs/jQpIGLvFy+Bw3WKYDgEU0m t9BJRWVm9T3A02ZJy6HXHbYTxUg/o86v6pZvmIAA= 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 5.2 012/144] crypto: ccp - Fix oops by properly managing allocated structures Date: Wed, 14 Aug 2019 18:59:28 +0200 Message-Id: <20190814165800.440512872@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 @@ -859,11 +859,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: