From: Greg Kroah-Hartman Date: Mon, 8 Jun 2020 12:32:36 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.7.2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f91e1f415ae2871bc73d75902304ba42abaf734;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: iio-vcnl4000-fix-i2c-swapped-word-reading.patch usb-musb-fix-runtime-pm-imbalance-on-error.patch usb-musb-start-session-in-resume-for-host-port.patch --- diff --git a/queue-4.19/iio-vcnl4000-fix-i2c-swapped-word-reading.patch b/queue-4.19/iio-vcnl4000-fix-i2c-swapped-word-reading.patch new file mode 100644 index 00000000000..d2821cc04ba --- /dev/null +++ b/queue-4.19/iio-vcnl4000-fix-i2c-swapped-word-reading.patch @@ -0,0 +1,52 @@ +From 18dfb5326370991c81a6d1ed6d1aeee055cb8c05 Mon Sep 17 00:00:00 2001 +From: Mathieu Othacehe +Date: Sun, 3 May 2020 11:29:55 +0200 +Subject: iio: vcnl4000: Fix i2c swapped word reading. + +From: Mathieu Othacehe + +commit 18dfb5326370991c81a6d1ed6d1aeee055cb8c05 upstream. + +The bytes returned by the i2c reading need to be swapped +unconditionally. Otherwise, on be16 platforms, an incorrect value will be +returned. + +Taking the slow path via next merge window as its been around a while +and we have a patch set dependent on this which would be held up. + +Fixes: 62a1efb9f868 ("iio: add vcnl4000 combined ALS and proximity sensor") +Signed-off-by: Mathieu Othacehe +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/light/vcnl4000.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/iio/light/vcnl4000.c ++++ b/drivers/iio/light/vcnl4000.c +@@ -166,7 +166,6 @@ static int vcnl4000_measure(struct vcnl4 + u8 rdy_mask, u8 data_reg, int *val) + { + int tries = 20; +- __be16 buf; + int ret; + + mutex_lock(&data->vcnl4000_lock); +@@ -193,13 +192,12 @@ static int vcnl4000_measure(struct vcnl4 + goto fail; + } + +- ret = i2c_smbus_read_i2c_block_data(data->client, +- data_reg, sizeof(buf), (u8 *) &buf); ++ ret = i2c_smbus_read_word_swapped(data->client, data_reg); + if (ret < 0) + goto fail; + + mutex_unlock(&data->vcnl4000_lock); +- *val = be16_to_cpu(buf); ++ *val = ret; + + return 0; + diff --git a/queue-4.19/series b/queue-4.19/series index 17f3640a9c1..435e69674c4 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -8,3 +8,6 @@ net-check-untrusted-gso_size-at-kernel-entry.patch usb-serial-qcserial-add-dw5816e-qdl-support.patch usb-serial-usb_wwan-do-not-resubmit-rx-urb-on-fatal-errors.patch usb-serial-option-add-telit-le910c1-eux-compositions.patch +iio-vcnl4000-fix-i2c-swapped-word-reading.patch +usb-musb-start-session-in-resume-for-host-port.patch +usb-musb-fix-runtime-pm-imbalance-on-error.patch diff --git a/queue-4.19/usb-musb-fix-runtime-pm-imbalance-on-error.patch b/queue-4.19/usb-musb-fix-runtime-pm-imbalance-on-error.patch new file mode 100644 index 00000000000..c25f641c5cb --- /dev/null +++ b/queue-4.19/usb-musb-fix-runtime-pm-imbalance-on-error.patch @@ -0,0 +1,54 @@ +From e4befc121df03dc8ed2ac1031c98f9538e244bae Mon Sep 17 00:00:00 2001 +From: Dinghao Liu +Date: Sun, 24 May 2020 21:50:49 -0500 +Subject: usb: musb: Fix runtime PM imbalance on error + +From: Dinghao Liu + +commit e4befc121df03dc8ed2ac1031c98f9538e244bae upstream. + +When copy_from_user() returns an error code, there +is a runtime PM usage counter imbalance. + +Fix this by moving copy_from_user() to the beginning +of this function. + +Fixes: 7b6c1b4c0e1e ("usb: musb: fix runtime PM in debugfs") + +Signed-off-by: Dinghao Liu +Cc: stable@vger.kernel.org +Signed-off-by: Bin Liu +Link: https://lore.kernel.org/r/20200525025049.3400-7-b-liu@ti.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/musb/musb_debugfs.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/usb/musb/musb_debugfs.c ++++ b/drivers/usb/musb/musb_debugfs.c +@@ -168,6 +168,11 @@ static ssize_t musb_test_mode_write(stru + u8 test; + char buf[24]; + ++ memset(buf, 0x00, sizeof(buf)); ++ ++ if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) ++ return -EFAULT; ++ + pm_runtime_get_sync(musb->controller); + test = musb_readb(musb->mregs, MUSB_TESTMODE); + if (test) { +@@ -176,11 +181,6 @@ static ssize_t musb_test_mode_write(stru + goto ret; + } + +- memset(buf, 0x00, sizeof(buf)); +- +- if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) +- return -EFAULT; +- + if (strstarts(buf, "force host full-speed")) + test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; + diff --git a/queue-4.19/usb-musb-start-session-in-resume-for-host-port.patch b/queue-4.19/usb-musb-start-session-in-resume-for-host-port.patch new file mode 100644 index 00000000000..c0a50496ed6 --- /dev/null +++ b/queue-4.19/usb-musb-start-session-in-resume-for-host-port.patch @@ -0,0 +1,44 @@ +From 7f88a5ac393f39319f69b8b20cc8d5759878d1a1 Mon Sep 17 00:00:00 2001 +From: Bin Liu +Date: Sun, 24 May 2020 21:50:45 -0500 +Subject: usb: musb: start session in resume for host port + +From: Bin Liu + +commit 7f88a5ac393f39319f69b8b20cc8d5759878d1a1 upstream. + +Commit 17539f2f4f0b ("usb: musb: fix enumeration after resume") replaced +musb_start() in musb_resume() to not override softconnect bit, but it +doesn't restart the session for host port which was done in musb_start(). +The session could be disabled in musb_suspend(), which leads the host +port doesn't stay in host mode. + +So let's start the session specifically for host port in musb_resume(). + +Fixes: 17539f2f4f0b ("usb: musb: fix enumeration after resume") + +Cc: stable@vger.kernel.org +Signed-off-by: Bin Liu +Link: https://lore.kernel.org/r/20200525025049.3400-3-b-liu@ti.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/musb/musb_core.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -2737,6 +2737,13 @@ static int musb_resume(struct device *de + musb_enable_interrupts(musb); + musb_platform_enable(musb); + ++ /* session might be disabled in suspend */ ++ if (musb->port_mode == MUSB_HOST && ++ !(musb->ops->quirks & MUSB_PRESERVE_SESSION)) { ++ devctl |= MUSB_DEVCTL_SESSION; ++ musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); ++ } ++ + spin_lock_irqsave(&musb->lock, flags); + error = musb_run_resume_work(musb); + if (error)