stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "HID: sensor-hub: Move the memset to sensor_hub_get_feature()" has been added to the 4.9-stable tree
@ 2017-01-09  8:36 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-09  8:36 UTC (permalink / raw)
  To: srinivas.pandruvada, gregkh, jkosina; +Cc: stable, stable-commits


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 <stable@vger.kernel.org> know about it.


>From 143fca77cce906d35f7a60ccef648e888df589f2 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Tue, 27 Dec 2016 08:57:59 -0800
Subject: HID: sensor-hub: Move the memset to sensor_hub_get_feature()

From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

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")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -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 srinivas.pandruvada@linux.intel.com are

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-09  8:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09  8:36 Patch "HID: sensor-hub: Move the memset to sensor_hub_get_feature()" has been added to the 4.9-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).