Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1965999imj; Fri, 8 Feb 2019 10:09:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBuoGE5HfYatM/p7pbbzb3KwZUp/uFY6dSsaWhBgJqWw99KI9UGkoxGx9KU7okEtT/czLt X-Received: by 2002:a62:710a:: with SMTP id m10mr23346675pfc.69.1549649386992; Fri, 08 Feb 2019 10:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549649386; cv=none; d=google.com; s=arc-20160816; b=hU+/zSVFf1Pbtw5wXpDS1jf8NazM7D6JYqUCYcf1x9TYBqpNIGg8Qe4tJDwS2LU4vm Z86u93XVIttNCcUmUXy6aH1WBDXXFw230386ddNch28V9iZ+UT+1zK8kqhlkFsHwVf7n fNDXd3urlnbBu4mSrN/hqzkQb1QXChLECLMmYIGl2U/k/oixLShmT6XFnyalv//ovGRM rYg+gRCuG1NbpbCs9qm1G//uh+MiFSRcWXOVV7TX+7UzTp+NXG1YK/gjdD2ZbXtYT2kQ jir7Ork2AG4MRJp7ZubZ0Sdfy9h53B6QiBnNY6xtC6k/6PoZ1S+MZ3W83A2nYrI39ht5 8qyg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dvgNV5LVAxBPwk/d0bN8BzHAchEJtnhIVwGkXkq3Cbw=; b=XHFjKItkiJ4Yghe3rEXl0qFmZY8oR0z2xSfJi7jBQJgCTbSypuKOxd+z2DxL6lbQ5V gKfm9krhoriQTpDrBYzzDDrBeQHUK2JA7V/Q9q4kb1Dft9Z+d+l06kfR09tqD0NHh905 nD99SJ+Bbol0m0CHAQrSSlJxmMupgmAh/krnYbH7R0UGkGXPb1AUE+eG5/jaeQOsxaKi +8dlrRNDFlEn0H9NUvrRWpb817KY+pBfClAoQwPRciMA9Co//f588CzmWt7hanuN9//6 lks5VaOgEMibEE/EcPWaDKeL39i26wwi0PW0NXx/X+gWimF57OwQMMmUh+QObba7bI/f Ecrg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f65si2959276pfb.194.2019.02.08.10.09.31; Fri, 08 Feb 2019 10:09:46 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727922AbfBHSJT (ORCPT + 99 others); Fri, 8 Feb 2019 13:09:19 -0500 Received: from mga04.intel.com ([192.55.52.120]:35127 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbfBHSJS (ORCPT ); Fri, 8 Feb 2019 13:09:18 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2019 10:09:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,348,1544515200"; d="scan'208";a="116299489" Received: from shivamur-mobl1.gar.corp.intel.com (HELO localhost) ([10.249.254.162]) by orsmga008.jf.intel.com with ESMTP; 08 Feb 2019 10:09:14 -0800 From: Jarkko Sakkinen To: linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Peter Huewe , Jason Gunthorpe , Stefan Berger , Alexander Steffen , Jarkko Sakkinen , stable@vger.kernel.org Subject: [PATCH v4 2/2] tpm/tpm_i2c_atmel: Return -E2BIG when the transfer is incomplete Date: Fri, 8 Feb 2019 20:08:57 +0200 Message-Id: <20190208180857.12330-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190208180857.12330-1-jarkko.sakkinen@linux.intel.com> References: <20190208180857.12330-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return -E2BIG when the transfer is incomplete. The upper layer does not retry, so not doing that is incorrect behaviour. Cc: stable@vger.kernel.org Fixes: a2871c62e186 ("tpm: Add support for Atmel I2C TPMs") Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger --- drivers/char/tpm/tpm_i2c_atmel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c index aa11c8a1df5e..8a7e80923091 100644 --- a/drivers/char/tpm/tpm_i2c_atmel.c +++ b/drivers/char/tpm/tpm_i2c_atmel.c @@ -69,6 +69,10 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) if (status < 0) return status; + /* The upper layer does not support incomplete sends. */ + if (status != len) + return -E2BIG; + return 0; } -- 2.19.1