[PATCH v4 1/2] tpm: Unify the send callback behaviourä

Jarkko Sakkinen jarkko.sakkinen at linux.intel.com
Fri Feb 8 19:17:10 UTC 2019


On Fri, Feb 08, 2019 at 09:00:57PM +0200, Jarkko Sakkinen wrote:
> It all looks now legit, but just in case I'll add a check for the return
> value to tpm_try_transmit() and a warning if it is not zero in the
> success case (and after that zeroing of rc).

Now the commits are applied both master and next, and these are
the checks for send():

rc = chip->ops->send(chip, buf, count);
if (rc < 0) {
	if (rc != -EPIPE)
		dev_err(&chip->dev,
			"%s: send(): error %d\n", __func__, rc);
	return rc;
}

/* A sanity check. send() should just return zero on success e.g.
 * not the command length.
 */
if (rc > 0) {
	dev_warn(&chip->dev,
		 "%s: send(): invalid value %d\n", __func__, rc);
	rc = 0;
}

Should be fairly safe play now.

/Jarkko



More information about the Linux-security-module-archive mailing list