* [PATCHv2 2/3] HID: hid-lg4ff: Fix sysfs vs memory deallocation race condition
@ 2012-03-14 17:32 Michal Malý
0 siblings, 0 replies; only message in thread
From: Michal Malý @ 2012-03-14 17:32 UTC (permalink / raw)
To: linux-input; +Cc: jkosina, simon
[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]
The device specific data stored in the linked list were removed before the sysfs attrs were
properly removed. This patch corrects this issue
Signed-off-by: Michal Malý <madcatxster@gmail.com>
>From 267123534c3605011cebde0244e384de210cf901 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Mal=C3=BD?= <madcatxster@gmail.com>
Date: Wed, 14 Mar 2012 18:15:37 +0100
Subject: [PATCH 2/2] HID: lg4ff: Remove the sysfs interface before
deallocating memory
---
drivers/hid/hid-lg4ff.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 6ecc9e2..f70ae41 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -466,6 +466,9 @@ int lg4ff_deinit(struct hid_device *hid)
bool found = 0;
struct lg4ff_device_entry *entry;
struct list_head *h, *g;
+
+ device_remove_file(&hid->dev, &dev_attr_range);
+
list_for_each_safe(h, g, &device_list.list) {
entry = list_entry(h, struct lg4ff_device_entry, list);
if (strcmp(entry->device_id, (&hid->dev)->kobj.name) == 0) {
@@ -478,11 +481,10 @@ int lg4ff_deinit(struct hid_device *hid)
}
if (!found) {
- dbg_hid("Device entry not found!\n");
+ dbg_err("Device entry not found!\n");
return -1;
}
- device_remove_file(&hid->dev, &dev_attr_range);
dbg_hid("Device successfully unregistered\n");
return 0;
}
--
1.7.9.4
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-14 17:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 17:32 [PATCHv2 2/3] HID: hid-lg4ff: Fix sysfs vs memory deallocation race condition Michal Malý
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).