diff options
author | dheerajpdsk <p.dheeraj.srujan.kumar@intel.com> | 2023-12-31 18:41:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-31 18:41:27 +0300 |
commit | 0127bdba37b5e22adcc423d170589211de377e2e (patch) | |
tree | c4e595e183ef7500206e30f687bb384f73f58fa8 /meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch | |
parent | 2561f0aabb8c6a13475d56b5a14bde1f18909d7f (diff) | |
parent | 7f53998bd3726c808abf8b0c4950e25db29d9ea2 (diff) | |
download | openbmc-0127bdba37b5e22adcc423d170589211de377e2e.tar.xz |
Merge pull request #129 from Intel-BMC/update1-1.11-1
Update to internal 1-1.11-1
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch new file mode 100644 index 000000000..e041e665a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0004-soc-aspeed-lpc-mbox-Don-t-allow-partial-reads.patch @@ -0,0 +1,40 @@ +From d655ada2fc4b5065c2be6943f28aa4e4f694a1a3 Mon Sep 17 00:00:00 2001 +From: Iwona Winiarska <iwona.winiarska@intel.com> +Date: Mon, 9 Jan 2023 21:09:44 +0100 +Subject: [PATCH] soc: aspeed: lpc-mbox: Don't allow partial reads + +IRQ handler always adds all registers to the fifo, while the userspace +can potentially consume a smaller amount. Unfortunately, when smaller +amount is consumed, it permanently shifts the fifo. +Serialize the "empty" state check to avoid partial reads. + +Fixes: 60fde6cf7114 ("soc: aspeed: lpc-mbox: Avoid calling kfifo_to_user in atomic context") +Reported-by: Arun P. Mohanan <arun.p.m@linux.intel.com> +Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> +--- + drivers/soc/aspeed/aspeed-lpc-mbox.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/soc/aspeed/aspeed-lpc-mbox.c b/drivers/soc/aspeed/aspeed-lpc-mbox.c +index 7941792abacb..564c7318da10 100644 +--- a/drivers/soc/aspeed/aspeed-lpc-mbox.c ++++ b/drivers/soc/aspeed/aspeed-lpc-mbox.c +@@ -172,7 +172,14 @@ static ssize_t aspeed_mbox_read(struct file *file, char __user *buf, + } + + mutex_lock(&mbox->mutex); +- if (kfifo_is_empty(&mbox->fifo)) { ++ /* ++ * Since fifo on the producer side will drop the oldest values, causing ++ * a shift if the data is not consumed fully, when we're using count == ++ * num_regs reads, we need to serialize with the producer to make ++ * sure that all regs were inserted into fifo (avoiding a partial ++ * read). ++ */ ++ if (kfifo_is_empty_spinlocked(&mbox->fifo, &mbox->lock)) { + if (file->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + goto out_unlock; +-- +2.17.1 + |