Skip to contentSkip to conversation

Patch "HID: sensor-hub: Move the memset to sensor_hub_get_feature()" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

HID: sensor-hub: Move the memset to sensor_hub_get_feature()

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
hid-sensor-hub-move-the-memset-to-sensor_hub_get_feature.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 143fca77cce906d35f7a60ccef648e888df589f2 Mon Sep 17 00:00:00 2001

From: Srinivas Pandruvada <[email protected]>
Date: Tue, 27 Dec 2016 08:57:59 -0800
Subject: HID: sensor-hub: Move the memset to sensor_hub_get_feature()

From: Srinivas Pandruvada <[email protected]>

commit 143fca77cce906d35f7a60ccef648e888df589f2 upstream.

While applying patch d443a0aa3a29: "HID: hid-sensor-hub: clear memory to avoid random data", there was some issues in applying correct version of the patch. This resulted in the breakage of sensor functions as all request like power-up will be reset by the memset() in the function sensor_hub_set_feature().
The reset of caller buffer should be in the function sensor_hub_get_feature(), not in the sensor_hub_set_feature().

Fixes d443a0aa3a29 ("HID: hid-sensor-hub: clear memory to avoid random data")
---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +2 -1
@@ -212,7 +212,6 @@ int sensor_hub_set_feature(struct hid_se
 	__s32 value;
 	int ret = 0;
 
-	memset(buffer, 0, buffer_size);
 	mutex_lock(&data->mutex);
 	report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
 	if (!report || (field_index >= report->maxfield)) {
@@ -256,6 +255,8 @@ int sensor_hub_get_feature(struct hid_se
 	int buffer_index = 0;
 	int i;
 
+	memset(buffer, 0, buffer_size);
+
 	mutex_lock(&data->mutex);
 	report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
 	if (!report || (field_index >= report->maxfield) ||

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/hid-sensor-hub-move-the-memset-to-sensor_hub_get_feature.patch