Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp628148pxx; Wed, 28 Oct 2020 12:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYeOWq8Y+DJY/9yHWn82JWv2VL4jIYE35ls8HfG/OcfBd774JVKzojy0p7jlfcEHqPbbjP X-Received: by 2002:a17:906:aec1:: with SMTP id me1mr707180ejb.225.1603914503685; Wed, 28 Oct 2020 12:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603914503; cv=none; d=google.com; s=arc-20160816; b=cIDMQuoolDpwrlO8AUBCrqXFep4AacgHV0UdNgDvr5pcTYnAEuqclgS06JIOwOCPdN zJD4Q6e1JjCR72eVMDOGST1XP6aBadoK4LOSIra06MLz9fVfS6lezeOA7FE6+WWUgZ5l Jr5BlDU+/e5c0Ac2tRo6Cch7cvfyMLaFdabQx5XQQ+Eq3i9r7q6C3Wd91QRxsE+pMJ54 JNlgzxuT1XYK8n03MKa3YmK7EcYr3y46oBX7exllQAHVUf48D12IOcCaWF14bJCnc9Mz c3KtgYBUGB/9Mr9WIcXOOJXGwCTqkRkTyxtKL1BKcmjKF6802+lfz/VTITL4GvK2lRnU pn9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mom4q/TA6VP44Vtz5pL8p/PjEJ36Rm/fNWHcHzYZWas=; b=mvNmyf20MA929C2dTqYyTeKLEghy9RiZ6Db9iP8aBwrUxK1kSHtYaXzrC7hnqN19s3 1cr8ecSp6mlCMrW8xD/xcAk/eNwo2Zuz+3tepJU/O+I0lRl8/JO7xLfZCwAsC0QsJ/NC j38gM5sXuiQ4Kg506iviyvuIZfuR+9sz7Kuc+0b3eQP/FQUW9dgxEuL0J9iGDLMvDg1s 9M0XqW9W7JTTTIX/BWuSBg00sdr65+/Uan8S3uad5t3V6VEEXnId9NRgBuQ/Kprmtrom AbA/7F3nTGP6D/eHvcEYtSVlZRS/rj1LLaVuadBOHfMyajQlX1Y3nns9OtIVwI/nTkA9 LH6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WuZcgpD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si10484edy.397.2020.10.28.12.48.01; Wed, 28 Oct 2020 12:48:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=WuZcgpD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1827843AbgJ0S2d (ORCPT + 99 others); Tue, 27 Oct 2020 14:28:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:44000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504071AbgJ0N5M (ORCPT ); Tue, 27 Oct 2020 09:57:12 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9F4A9221F8; Tue, 27 Oct 2020 13:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807032; bh=jgDb0BXKtPATmNWHW5JCRJKV8iyX9vyYTAaYGFFpHyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WuZcgpD1McQsYvF+N3ZWl+GM2nhMxg75yCW11kXzsmXoGrzBRoYN1vw4eqKGv+3tl 6Zb/SRIb8619DaZ1TFLH6VqkgoQHzYUDP7CgvZuRFvNRCkfmQDeg0Av6cwNUzqppb5 G/VRIQ/fDX8tQntzdYmtA3SnZq+JeSju1dSIdux0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Sassu , Mimi Zohar Subject: [PATCH 4.4 018/112] ima: Dont ignore errors from crypto_shash_update() Date: Tue, 27 Oct 2020 14:48:48 +0100 Message-Id: <20201027134901.431442586@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roberto Sassu commit 60386b854008adc951c470067f90a2d85b5d520f upstream. Errors returned by crypto_shash_update() are not checked in ima_calc_boot_aggregate_tfm() and thus can be overwritten at the next iteration of the loop. This patch adds a check after calling crypto_shash_update() and returns immediately if the result is not zero. Cc: stable@vger.kernel.org Fixes: 3323eec921efd ("integrity: IMA as an integrity service provider") Signed-off-by: Roberto Sassu Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- security/integrity/ima/ima_crypto.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c @@ -555,6 +555,8 @@ static int __init ima_calc_boot_aggregat ima_pcrread(i, pcr_i); /* now accumulate with current aggregate */ rc = crypto_shash_update(shash, pcr_i, TPM_DIGEST_SIZE); + if (rc != 0) + return rc; } if (!rc) crypto_shash_final(shash, digest);