When we get an interrupt for a channel program, it is not
necessarily the final interrupt; for example, the issuing
guest may request an intermediate interrupt by specifying
the program-controlled-interrupt flag on a ccw.
We must not switch the state to idle if the interrupt is not
yet final; even more importantly, we must not free the translated
channel program if the interrupt is not yet final, or the host
can crash during cp rewind.
Fixes: e5f84dbaea59 ("vfio: ccw: return I/O results asynchronously")
Cc: stable(a)vger.kernel.org # v4.12+
Reviewed-by: Eric Farman <farman(a)linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck(a)redhat.com>
(cherry picked from commit 50b7f1b7236bab08ebbbecf90521e84b068d7a17)
---
drivers/s390/cio/vfio_ccw_drv.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
index ae7a49ade414..d22759eb6640 100644
--- a/drivers/s390/cio/vfio_ccw_drv.c
+++ b/drivers/s390/cio/vfio_ccw_drv.c
@@ -70,20 +70,24 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
{
struct vfio_ccw_private *private;
struct irb *irb;
+ bool is_final;
private = container_of(work, struct vfio_ccw_private, io_work);
irb = &private->irb;
+ is_final = !(scsw_actl(&irb->scsw) &
+ (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT));
if (scsw_is_solicited(&irb->scsw)) {
cp_update_scsw(&private->cp, &irb->scsw);
- cp_free(&private->cp);
+ if (is_final)
+ cp_free(&private->cp);
}
memcpy(private->io_region.irb_area, irb, sizeof(*irb));
if (private->io_trigger)
eventfd_signal(private->io_trigger, 1);
- if (private->mdev)
+ if (private->mdev && is_final)
private->state = VFIO_CCW_STATE_IDLE;
}
--
2.17.2
Having a cyclic DMA, a residue 0 is not an indication of a completed
DMA. In case of cyclic DMA make sure that dma_set_residue() is called
and with this a residue of 0 is forwarded correctly to the caller.
Fixes: 3544d2878817 ("dmaengine: rcar-dmac: use result of updated get_residue in tx_status")
Signed-off-by: Dirk Behme <dirk.behme(a)de.bosch.com>
Signed-off-by: Achim Dahlhoff <Achim.Dahlhoff(a)de.bosch.com>
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx(a)renesas.com>
Cc: <stable(a)vger.kernel.org> # v4.8+
---
Note: Patch done against mainline v5.0
Changes in v2: None
drivers/dma/sh/rcar-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 2b4f25698169..2ea59229d7f5 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1378,7 +1378,7 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan,
spin_unlock_irqrestore(&rchan->lock, flags);
/* if there's no residue, the cookie is complete */
- if (!residue)
+ if (!residue && !rchan->desc.running->cyclic)
return DMA_COMPLETE;
dma_set_residue(txstate, residue);
--
2.20.0
This is the start of the stable review cycle for the 4.9.166 release.
There are 30 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu Mar 28 04:25:51 UTC 2019.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.166-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.9.166-rc1
Arnd Bergmann <arnd(a)arndb.de>
ath10k: avoid possible string overflow
Baolin Wang <baolin.wang(a)linaro.org>
power: supply: charger-manager: Fix incorrect return value
Enric Balletbo i Serra <enric.balletbo(a)collabora.com>
pwm-backlight: Enable/disable the PWM before/after LCD enable toggle.
Baolin Wang <baolin.wang(a)linaro.org>
rtc: Fix overflow when converting time64_t to rtc_time
kehuanlin <chgokhl(a)gmail.com>
scsi: ufs: fix wrong command type of UTRD for UFSHCI v2.1
Andrey Konovalov <andreyknvl(a)google.com>
USB: core: only clean up what we allocated
Peter Zijlstra <peterz(a)infradead.org>
lib/int_sqrt: optimize small argument
Lanqing Liu <lanqing.liu(a)spreadtrum.com>
serial: sprd: clear timeout interrupt only rather than all interrupts
Qiao Zhou <qiaozhou(a)asrmicro.com>
arm64: traps: disable irq in die()
Al Viro <viro(a)ZenIV.linux.org.uk>
Hang/soft lockup in d_invalidate with simultaneous calls
Wei Qiao <wei.qiao(a)spreadtrum.com>
serial: sprd: adjust TIMEOUT to a big value
Eric Dumazet <edumazet(a)google.com>
tcp/dccp: drop SYN packets if accept queue is full
Hui Wang <hui.wang(a)canonical.com>
ALSA: hda - Enforces runtime_resume after S3 and S4 for each codec
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda - Record the current power state before suspend/resume calls
Waiman Long <longman(a)redhat.com>
locking/lockdep: Add debug_locks check in __lock_downgrade()
Myungho Jung <mhjungk(a)gmail.com>
Bluetooth: Fix decrementing reference count twice in releasing socket
Hans Verkuil <hverkuil(a)xs4all.nl>
media: v4l2-ctrls.c/uvc: zero v4l2_event
zhangyi (F) <yi.zhang(a)huawei.com>
ext4: brelse all indirect buffer in ext4_ind_remove_space()
Lukas Czerner <lczerner(a)redhat.com>
ext4: fix data corruption caused by unaligned direct AIO
Jiufei Xue <jiufei.xue(a)linux.alibaba.com>
ext4: fix NULL pointer dereference while journal is aborted
Josh Poimboeuf <jpoimboe(a)redhat.com>
objtool: Move objtool_file struct off the stack
Chen Jie <chenjie6(a)huawei.com>
futex: Ensure that futex address is aligned in handle_futex_death()
Archer Yan <ayan(a)wavecomp.com>
MIPS: Fix kernel crash for R6 in jump label branch function
Yasha Cherikovsky <yasha.che3(a)gmail.com>
MIPS: Ensure ELF appended dtb is relocated
Yifeng Li <tomli(a)tomli.me>
mips: loongson64: lemote-2f: Add IRQF_NO_SUSPEND to "cascade" irqaction.
Jan Kara <jack(a)suse.cz>
udf: Fix crash on IO error during truncate
Ilya Dryomov <idryomov(a)gmail.com>
libceph: wait for latest osdmap in ceph_monc_blacklist_add()
Stanislaw Gruszka <sgruszka(a)redhat.com>
iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE
Thomas Zimmermann <tzimmermann(a)suse.de>
drm/vmwgfx: Don't double-free the mode stored in par->set_mode
Arnd Bergmann <arnd(a)arndb.de>
mmc: pxamci: fix enum type confusion
-------------
Diffstat:
Makefile | 4 +--
arch/arm64/kernel/traps.c | 8 +++--
arch/mips/include/asm/jump_label.h | 8 ++---
arch/mips/kernel/vmlinux.lds.S | 12 ++++---
arch/mips/loongson64/lemote-2f/irq.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 12 ++-----
drivers/iommu/amd_iommu.c | 7 ++++-
drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
drivers/media/v4l2-core/v4l2-ctrls.c | 2 +-
drivers/mmc/host/pxamci.c | 2 +-
drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
drivers/power/supply/charger-manager.c | 3 +-
drivers/rtc/rtc-lib.c | 6 ++--
drivers/scsi/ufs/ufshcd.c | 14 +++++----
drivers/tty/serial/sprd_serial.c | 6 ++--
drivers/usb/core/config.c | 9 ++++--
drivers/video/backlight/pwm_bl.c | 9 +++---
fs/dcache.c | 10 +++---
fs/ext4/ext4_jbd2.h | 2 +-
fs/ext4/file.c | 2 +-
fs/ext4/indirect.c | 12 ++++---
fs/udf/truncate.c | 3 ++
include/linux/ceph/libceph.h | 2 ++
include/net/inet_connection_sock.h | 5 ---
kernel/futex.c | 4 +++
kernel/locking/lockdep.c | 3 ++
lib/int_sqrt.c | 3 ++
net/bluetooth/hci_sock.c | 3 +-
net/ceph/ceph_common.c | 18 ++++++++++-
net/ceph/mon_client.c | 9 ++++++
net/dccp/ipv4.c | 8 +----
net/dccp/ipv6.c | 2 +-
net/ipv4/tcp_input.c | 8 +----
sound/pci/hda/hda_codec.c | 57 ++++++++++++++++++++++++++++++++--
tools/objtool/check.c | 3 +-
35 files changed, 175 insertions(+), 87 deletions(-)
The patch below does not apply to the 3.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 91740fc8242b4f260cfa4d4536d8551804777fae Mon Sep 17 00:00:00 2001
From: Kohji Okuno <okuno.kohji(a)jp.panasonic.com>
Date: Tue, 26 Feb 2019 11:34:13 +0900
Subject: [PATCH] ARM: imx6q: cpuidle: fix bug that CPU might not wake up at
expected time
In the current cpuidle implementation for i.MX6q, the CPU that sets
'WAIT_UNCLOCKED' and the CPU that returns to 'WAIT_CLOCKED' are always
the same. While the CPU that sets 'WAIT_UNCLOCKED' is in IDLE state of
"WAIT", if the other CPU wakes up and enters IDLE state of "WFI"
istead of "WAIT", this CPU can not wake up at expired time.
Because, in the case of "WFI", the CPU must be waked up by the local
timer interrupt. But, while 'WAIT_UNCLOCKED' is set, the local timer
is stopped, when all CPUs execute "wfi" instruction. As a result, the
local timer interrupt is not fired.
In this situation, this CPU will wake up by IRQ different from local
timer. (e.g. broacast timer)
So, this fix changes CPU to return to 'WAIT_CLOCKED'.
Signed-off-by: Kohji Okuno <okuno.kohji(a)jp.panasonic.com>
Fixes: e5f9dec8ff5f ("ARM: imx6q: support WAIT mode using cpuidle")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Shawn Guo <shawnguo(a)kernel.org>
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index bfeb25aaf9a2..326e870d7123 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -16,30 +16,23 @@
#include "cpuidle.h"
#include "hardware.h"
-static atomic_t master = ATOMIC_INIT(0);
-static DEFINE_SPINLOCK(master_lock);
+static int num_idle_cpus = 0;
+static DEFINE_SPINLOCK(cpuidle_lock);
static int imx6q_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{
- if (atomic_inc_return(&master) == num_online_cpus()) {
- /*
- * With this lock, we prevent other cpu to exit and enter
- * this function again and become the master.
- */
- if (!spin_trylock(&master_lock))
- goto idle;
+ spin_lock(&cpuidle_lock);
+ if (++num_idle_cpus == num_online_cpus())
imx6_set_lpm(WAIT_UNCLOCKED);
- cpu_do_idle();
- imx6_set_lpm(WAIT_CLOCKED);
- spin_unlock(&master_lock);
- goto done;
- }
+ spin_unlock(&cpuidle_lock);
-idle:
cpu_do_idle();
-done:
- atomic_dec(&master);
+
+ spin_lock(&cpuidle_lock);
+ if (num_idle_cpus-- == num_online_cpus())
+ imx6_set_lpm(WAIT_CLOCKED);
+ spin_unlock(&cpuidle_lock);
return index;
}
On 27.3.2019 16.00, Sasha Levin wrote:
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
>
> The bot has tested the following trees: v5.0.4, v4.19.31, v4.14.108, v4.9.165, v4.4.177, v3.18.137.
>
> v5.0.4: Build OK!
> v4.19.31: Build OK!
> v4.14.108: Build OK!
> v4.9.165: Failed to apply! Possible dependencies:
> 76a0f32b28d4 ("xhci: rename temp and temp1 variables")
>
> v4.4.177: Failed to apply! Possible dependencies:
> 76a0f32b28d4 ("xhci: rename temp and temp1 variables")
>
> v3.18.137: Failed to apply! Possible dependencies:
> 2338b9e47fba ("xhci: define the new default speed ID for SuperSpeedPlus used by xhci hw")
> 41485a90d573 ("xhci: optimize xhci bus resume time")
> 76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> b50107bb83d0 ("xhci: check xhci hardware for USB 3.1 support")
> cd33a32157e4 ("usb: xhci: cleanup xhci_hcd allocation")
>
>
> How should we proceed with this patch?
Backported versions for 4.9, 4.4 and 3.18 sent to stable
Thanks
Mathias
commit 072684e8c58d17e853f8e8b9f6d9ce2e58d2b036 upstream.
In f_hidg_write() the write_spinlock is acquired before calling
usb_ep_queue() which causes a deadlock when dummy_hcd is being used.
This is because dummy_queue() callbacks into f_hidg_req_complete() which
tries to acquire the same spinlock. This is (part of) the backtrace when
the deadlock occurs:
0xffffffffc06b1410 in f_hidg_req_complete
0xffffffffc06a590a in usb_gadget_giveback_request
0xffffffffc06cfff2 in dummy_queue
0xffffffffc06a4b96 in usb_ep_queue
0xffffffffc06b1eb6 in f_hidg_write
0xffffffff8127730b in __vfs_write
0xffffffff812774d1 in vfs_write
0xffffffff81277725 in SYSC_write
Fix this by releasing the write_spinlock before calling usb_ep_queue()
Reviewed-by: James Bottomley <James.Bottomley(a)HansenPartnership.com>
Tested-by: James Bottomley <James.Bottomley(a)HansenPartnership.com>
Cc: stable(a)vger.kernel.org
Fixes: 749494b6bdbb ("usb: gadget: f_hid: fix: Move IN request allocation to set_alt()")
Signed-off-by: Radoslav Gerganov <rgerganov(a)vmware.com>
Signed-off-by: Felipe Balbi <felipe.balbi(a)linux.intel.com>
---
drivers/usb/gadget/function/f_hid.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 5815120..8e83649 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -340,20 +340,20 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
req->complete = f_hidg_req_complete;
req->context = hidg;
+ spin_unlock_irqrestore(&hidg->write_spinlock, flags);
+
status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC);
if (status < 0) {
ERROR(hidg->func.config->cdev,
"usb_ep_queue error on int endpoint %zd\n", status);
- goto release_write_pending_unlocked;
+ goto release_write_pending;
} else {
status = count;
}
- spin_unlock_irqrestore(&hidg->write_spinlock, flags);
return status;
release_write_pending:
spin_lock_irqsave(&hidg->write_spinlock, flags);
-release_write_pending_unlocked:
hidg->write_pending = 0;
spin_unlock_irqrestore(&hidg->write_spinlock, flags);
--
1.9.1
Currently, compat tasks running on arm64 can allocate memory up to
TASK_SIZE_32 (UL(0x100000000)).
This means that mmap() allocations, if we treat them as returning an
array, are not compliant with the sections 6.5.8 of the C standard
(C99) which states that: "If the expression P points to an element of
an array object and the expression Q points to the last element of the
same array object, the pointer expression Q+1 compares greater than P".
Redefine TASK_SIZE_32 to address the issue.
Cc: Catalin Marinas <catalin.marinas(a)arm.com>
Cc: Will Deacon <will.deacon(a)arm.com>
Cc: Jann Horn <jannh(a)google.com>
Reported-by: Jann Horn <jannh(a)google.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino(a)arm.com>
---
arch/arm64/include/asm/processor.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 5d9ce62bdebd..f8235f7df29b 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -57,7 +57,11 @@
#define TASK_SIZE_64 (UL(1) << vabits_user)
#ifdef CONFIG_COMPAT
+#ifdef CONFIG_ARM64_64K_PAGES
#define TASK_SIZE_32 UL(0x100000000)
+#else
+#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE)
+#endif /* CONFIG_ARM64_64K_PAGES */
#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \
TASK_SIZE_32 : TASK_SIZE_64)
#define TASK_SIZE_OF(tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
--
2.21.0