From: Greg Kroah-Hartman Date: Mon, 28 Aug 2017 04:51:26 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v3.18.68~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=104069af22030edce0de5f251e3fb5d660d1c5a2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: android-binder-fix-proc-tsk-check.patch binder-use-group-leader-instead-of-open-thread.patch binder-use-wake-up-hint-for-synchronous-transactions.patch iio-hid-sensor-trigger-fix-the-race-with-user-space-powering-up-sensors.patch iio-imu-adis16480-fix-acceleration-scale-factor-for-adis16480.patch staging-rtl8188eu-add-rnx-n150nub-support.patch --- diff --git a/queue-4.4/android-binder-fix-proc-tsk-check.patch b/queue-4.4/android-binder-fix-proc-tsk-check.patch new file mode 100644 index 00000000000..f652d4f20a3 --- /dev/null +++ b/queue-4.4/android-binder-fix-proc-tsk-check.patch @@ -0,0 +1,32 @@ +From b2a6d1b999a4c13e5997bb864694e77172d45250 Mon Sep 17 00:00:00 2001 +From: Martijn Coenen +Date: Fri, 28 Jul 2017 13:56:08 +0200 +Subject: ANDROID: binder: fix proc->tsk check. + +From: Martijn Coenen + +commit b2a6d1b999a4c13e5997bb864694e77172d45250 upstream. + +Commit c4ea41ba195d ("binder: use group leader instead of open thread")' +was incomplete and didn't update a check in binder_mmap(), causing all +mmap() calls into the binder driver to fail. + +Signed-off-by: Martijn Coenen +Tested-by: John Stultz +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/android/binder.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/android/binder.c ++++ b/drivers/android/binder.c +@@ -2869,7 +2869,7 @@ static int binder_mmap(struct file *filp + const char *failure_string; + struct binder_buffer *buffer; + +- if (proc->tsk != current) ++ if (proc->tsk != current->group_leader) + return -EINVAL; + + if ((vma->vm_end - vma->vm_start) > SZ_4M) diff --git a/queue-4.4/binder-use-group-leader-instead-of-open-thread.patch b/queue-4.4/binder-use-group-leader-instead-of-open-thread.patch new file mode 100644 index 00000000000..b2e8290cb41 --- /dev/null +++ b/queue-4.4/binder-use-group-leader-instead-of-open-thread.patch @@ -0,0 +1,35 @@ +From c4ea41ba195d01c9af66fb28711a16cc97caa9c5 Mon Sep 17 00:00:00 2001 +From: Todd Kjos +Date: Thu, 29 Jun 2017 12:01:36 -0700 +Subject: binder: use group leader instead of open thread + +From: Todd Kjos + +commit c4ea41ba195d01c9af66fb28711a16cc97caa9c5 upstream. + +The binder allocator assumes that the thread that +called binder_open will never die for the lifetime of +that proc. That thread is normally the group_leader, +however it may not be. Use the group_leader instead +of current. + +Signed-off-by: Todd Kjos +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/android/binder.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/android/binder.c ++++ b/drivers/android/binder.c +@@ -2966,8 +2966,8 @@ static int binder_open(struct inode *nod + proc = kzalloc(sizeof(*proc), GFP_KERNEL); + if (proc == NULL) + return -ENOMEM; +- get_task_struct(current); +- proc->tsk = current; ++ get_task_struct(current->group_leader); ++ proc->tsk = current->group_leader; + INIT_LIST_HEAD(&proc->todo); + init_waitqueue_head(&proc->wait); + proc->default_priority = task_nice(current); diff --git a/queue-4.4/binder-use-wake-up-hint-for-synchronous-transactions.patch b/queue-4.4/binder-use-wake-up-hint-for-synchronous-transactions.patch new file mode 100644 index 00000000000..8284eb7d202 --- /dev/null +++ b/queue-4.4/binder-use-wake-up-hint-for-synchronous-transactions.patch @@ -0,0 +1,38 @@ +From 00b40d613352c623aaae88a44e5ded7c912909d7 Mon Sep 17 00:00:00 2001 +From: Riley Andrews +Date: Thu, 29 Jun 2017 12:01:37 -0700 +Subject: binder: Use wake up hint for synchronous transactions. + +From: Riley Andrews + +commit 00b40d613352c623aaae88a44e5ded7c912909d7 upstream. + +Use wake_up_interruptible_sync() to hint to the scheduler binder +transactions are synchronous wakeups. Disable preemption while waking +to avoid ping-ponging on the binder lock. + +Signed-off-by: Todd Kjos +Signed-off-by: Omprakash Dhyade +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/android/binder.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/android/binder.c ++++ b/drivers/android/binder.c +@@ -1718,8 +1718,12 @@ static void binder_transaction(struct bi + list_add_tail(&t->work.entry, target_list); + tcomplete->type = BINDER_WORK_TRANSACTION_COMPLETE; + list_add_tail(&tcomplete->entry, &thread->todo); +- if (target_wait) +- wake_up_interruptible(target_wait); ++ if (target_wait) { ++ if (reply || !(t->flags & TF_ONE_WAY)) ++ wake_up_interruptible_sync(target_wait); ++ else ++ wake_up_interruptible(target_wait); ++ } + return; + + err_get_unused_fd_failed: diff --git a/queue-4.4/iio-hid-sensor-trigger-fix-the-race-with-user-space-powering-up-sensors.patch b/queue-4.4/iio-hid-sensor-trigger-fix-the-race-with-user-space-powering-up-sensors.patch new file mode 100644 index 00000000000..9540e8407e2 --- /dev/null +++ b/queue-4.4/iio-hid-sensor-trigger-fix-the-race-with-user-space-powering-up-sensors.patch @@ -0,0 +1,82 @@ +From f1664eaacec31035450132c46ed2915fd2b2049a Mon Sep 17 00:00:00 2001 +From: Srinivas Pandruvada +Date: Sat, 12 Aug 2017 09:09:21 -0700 +Subject: iio: hid-sensor-trigger: Fix the race with user space powering up sensors + +From: Srinivas Pandruvada + +commit f1664eaacec31035450132c46ed2915fd2b2049a upstream. + +It has been reported for a while that with iio-sensor-proxy service the +rotation only works after one suspend/resume cycle. This required a wait +in the systemd unit file to avoid race. I found a Yoga 900 where I could +reproduce this. + +The problem scenerio is: +- During sensor driver init, enable run time PM and also set a + auto-suspend for 3 seconds. + This result in one runtime resume. But there is a check to avoid +a powerup in this sequence, but rpm is active +- User space iio-sensor-proxy tries to power up the sensor. Since rpm is + active it will simply return. But sensors were not actually +powered up in the prior sequence, so actaully the sensors will not work +- After 3 seconds the auto suspend kicks + +If we add a wait in systemd service file to fire iio-sensor-proxy after +3 seconds, then now everything will work as the runtime resume will +actually powerup the sensor as this is a user request. + +To avoid this: +- Remove the check to match user requested state, this will cause a + brief powerup, but if the iio-sensor-proxy starts immediately it will +still work as the sensors are ON. +- Also move the autosuspend delay to place when user requested turn off + of sensors, like after user finished raw read or buffer disable + +Signed-off-by: Srinivas Pandruvada +Tested-by: Bastien Nocera +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c ++++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +@@ -36,8 +36,6 @@ static int _hid_sensor_power_state(struc + s32 poll_value = 0; + + if (state) { +- if (!atomic_read(&st->user_requested_state)) +- return 0; + if (sensor_hub_device_open(st->hsdev)) + return -EIO; + +@@ -84,6 +82,9 @@ static int _hid_sensor_power_state(struc + &report_val); + } + ++ pr_debug("HID_SENSOR %s set power_state %d report_state %d\n", ++ st->pdev->name, state_val, report_val); ++ + sensor_hub_get_feature(st->hsdev, st->power_state.report_id, + st->power_state.index, + sizeof(state_val), &state_val); +@@ -107,6 +108,7 @@ int hid_sensor_power_state(struct hid_se + ret = pm_runtime_get_sync(&st->pdev->dev); + else { + pm_runtime_mark_last_busy(&st->pdev->dev); ++ pm_runtime_use_autosuspend(&st->pdev->dev); + ret = pm_runtime_put_autosuspend(&st->pdev->dev); + } + if (ret < 0) { +@@ -175,8 +177,6 @@ int hid_sensor_setup_trigger(struct iio_ + /* Default to 3 seconds, but can be changed from sysfs */ + pm_runtime_set_autosuspend_delay(&attrb->pdev->dev, + 3000); +- pm_runtime_use_autosuspend(&attrb->pdev->dev); +- + return ret; + error_unreg_trigger: + iio_trigger_unregister(trig); diff --git a/queue-4.4/iio-imu-adis16480-fix-acceleration-scale-factor-for-adis16480.patch b/queue-4.4/iio-imu-adis16480-fix-acceleration-scale-factor-for-adis16480.patch new file mode 100644 index 00000000000..bd8d28e001a --- /dev/null +++ b/queue-4.4/iio-imu-adis16480-fix-acceleration-scale-factor-for-adis16480.patch @@ -0,0 +1,32 @@ +From fdd0d32eb95f135041236a6885d9006315aa9a1d Mon Sep 17 00:00:00 2001 +From: Dragos Bogdan +Date: Fri, 4 Aug 2017 01:37:27 +0300 +Subject: iio: imu: adis16480: Fix acceleration scale factor for adis16480 + +From: Dragos Bogdan + +commit fdd0d32eb95f135041236a6885d9006315aa9a1d upstream. + +According to the datasheet, the range of the acceleration is [-10 g, + 10 g], +so the scale factor should be 10 instead of 5. + +Signed-off-by: Dragos Bogdan +Acked-by: Lars-Peter Clausen +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/imu/adis16480.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -696,7 +696,7 @@ static const struct adis16480_chip_info + .gyro_max_val = IIO_RAD_TO_DEGREE(22500), + .gyro_max_scale = 450, + .accel_max_val = IIO_M_S_2_TO_G(12500), +- .accel_max_scale = 5, ++ .accel_max_scale = 10, + }, + [ADIS16485] = { + .channels = adis16485_channels, diff --git a/queue-4.4/series b/queue-4.4/series index 11802b19c33..be8bfde794c 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -35,3 +35,9 @@ perf-core-fix-group-cpu-task-validation.patch bluetooth-hidp-fix-possible-might-sleep-error-in-hidp_session_thread.patch bluetooth-cmtp-fix-possible-might-sleep-error-in-cmtp_session.patch bluetooth-bnep-fix-possible-might-sleep-error-in-bnep_session.patch +binder-use-group-leader-instead-of-open-thread.patch +binder-use-wake-up-hint-for-synchronous-transactions.patch +android-binder-fix-proc-tsk-check.patch +iio-imu-adis16480-fix-acceleration-scale-factor-for-adis16480.patch +iio-hid-sensor-trigger-fix-the-race-with-user-space-powering-up-sensors.patch +staging-rtl8188eu-add-rnx-n150nub-support.patch diff --git a/queue-4.4/staging-rtl8188eu-add-rnx-n150nub-support.patch b/queue-4.4/staging-rtl8188eu-add-rnx-n150nub-support.patch new file mode 100644 index 00000000000..ab05253c2a3 --- /dev/null +++ b/queue-4.4/staging-rtl8188eu-add-rnx-n150nub-support.patch @@ -0,0 +1,29 @@ +From f299aec6ebd747298e35934cff7709c6b119ca52 Mon Sep 17 00:00:00 2001 +From: Charles Milette +Date: Fri, 18 Aug 2017 16:30:34 -0400 +Subject: staging: rtl8188eu: add RNX-N150NUB support + +From: Charles Milette + +commit f299aec6ebd747298e35934cff7709c6b119ca52 upstream. + +Add support for USB Device Rosewill RNX-N150NUB. +VendorID: 0x0bda, ProductID: 0xffef + +Signed-off-by: Charles Milette +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +@@ -49,6 +49,7 @@ static struct usb_device_id rtw_usb_id_t + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ + {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ ++ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ + {} /* Terminating entry */ + }; +