diff --git a/kernel.spec b/kernel.spec index b9efdcf..439435b 100644 --- a/kernel.spec +++ b/kernel.spec @@ -614,6 +614,9 @@ Patch609: 0002-drm-nouveau-Fix-drm-core-using-atomic-code-paths-on-.patch # rhbz 1781288 Patch610: 0001-tracing-Do-not-create-directories-if-lockdown-is-in-.patch +# rhbz 1788653 +Patch611: tpm-handle-negative-priv--response_len-in-tpm_common_read.patch + # END OF PATCH DEFINITIONS %endif @@ -1851,6 +1854,9 @@ fi # # %changelog +* Mon Jan 06 2020 Laura Abbott +- Fix for tpm usercopy (rhbz 1788653) + * Mon Jan 06 2020 Hans de Goede - Make the MFD Intel LPSS driver builtin, some devices require this to be available early during boot (rhbz#1787997) diff --git a/tpm-handle-negative-priv--response_len-in-tpm_common_read.patch b/tpm-handle-negative-priv--response_len-in-tpm_common_read.patch new file mode 100644 index 0000000..40df117 --- /dev/null +++ b/tpm-handle-negative-priv--response_len-in-tpm_common_read.patch @@ -0,0 +1,89 @@ +From patchwork Tue Jan 7 22:04:48 2020 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Tadeusz Struk +X-Patchwork-Id: 1176682 +Return-Path: +Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 5846CC3F68F + for ; Tue, 7 Jan 2020 22:04:42 +0000 (UTC) +Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) + by mail.kernel.org (Postfix) with ESMTP id 207982073D + for ; Tue, 7 Jan 2020 22:04:42 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1727451AbgAGWEl (ORCPT + ); + Tue, 7 Jan 2020 17:04:41 -0500 +Received: from mga11.intel.com ([192.55.52.93]:40523 "EHLO mga11.intel.com" + rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP + id S1727080AbgAGWEk (ORCPT ); + Tue, 7 Jan 2020 17:04:40 -0500 +X-Amp-Result: SKIPPED(no attachment in message) +X-Amp-File-Uploaded: False +Received: from fmsmga007.fm.intel.com ([10.253.24.52]) + by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; + 07 Jan 2020 14:04:40 -0800 +X-ExtLoop1: 1 +X-IronPort-AV: E=Sophos;i="5.69,407,1571727600"; + d="scan'208";a="217317989" +Received: from tstruk-mobl1.jf.intel.com (HELO [127.0.1.1]) ([10.7.196.67]) + by fmsmga007.fm.intel.com with ESMTP; 07 Jan 2020 14:04:39 -0800 +Subject: [PATCH] tpm: handle negative priv->response_len in tpm_common_read +From: Tadeusz Struk +To: jarkko.sakkinen@linux.intel.com +Cc: keescook@chromium.org, tadeusz.struk@intel.com, + linux-kernel@vger.kernel.org, stable@vger.kernel.org, + linux-integrity@vger.kernel.org, labbott@redhat.com +Date: Tue, 07 Jan 2020 14:04:48 -0800 +Message-ID: <157843468820.24718.10808226634364669421.stgit@tstruk-mobl1> +In-Reply-To: +References: +User-Agent: StGit/0.17.1-dirty +MIME-Version: 1.0 +Sender: linux-kernel-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-kernel@vger.kernel.org + +The priv->responce_length can hold the size of an response or +an negative error code, and the tpm_common_read() needs to handle +both cases correctly. Changed the type of responce_length to +signed and accounted for negative value in tpm_common_read() + +Cc: stable@vger.kernel.org +Fixes: d23d12484307 ("tpm: fix invalid locking in NONBLOCKING mode") +Reported-by: Laura Abbott +Signed-off-by: Tadeusz Struk +Reviewed-by: Jarkko Sakkinen +--- + drivers/char/tpm/tpm-dev-common.c | 2 +- + drivers/char/tpm/tpm-dev.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c +index b23b0b999232..87f449340202 100644 +--- a/drivers/char/tpm/tpm-dev-common.c ++++ b/drivers/char/tpm/tpm-dev-common.c +@@ -130,7 +130,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf, + priv->response_read = true; + + ret_size = min_t(ssize_t, size, priv->response_length); +- if (!ret_size) { ++ if (ret_size <= 0) { + priv->response_length = 0; + goto out; + } +diff --git a/drivers/char/tpm/tpm-dev.h b/drivers/char/tpm/tpm-dev.h +index 1089fc0bb290..f3742bcc73e3 100644 +--- a/drivers/char/tpm/tpm-dev.h ++++ b/drivers/char/tpm/tpm-dev.h +@@ -14,7 +14,7 @@ struct file_priv { + struct work_struct timeout_work; + struct work_struct async_work; + wait_queue_head_t async_wait; +- size_t response_length; ++ ssize_t response_length; + bool response_read; + bool command_enqueued; +