diff options
author | H. Nikolaus Schaller <hns@goldelico.com> | 2016-04-18 17:46:30 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-04-19 12:24:19 -0400 |
commit | 52dee2c9f0850704327d976ea5c5fa7f4696dab5 (patch) | |
tree | 84114ac3bb8fe9b36f4ff8c40ec812c6f09b1d32 /drivers/input | |
parent | eda5ecc0a6b865561997e177c393f0b0136fe3b7 (diff) |
Input: twl6040-vibra - fix NULL pointer dereference by removing workqueue
commit 21fb9f0d5e91 ("Input: twl6040-vibra - use system workqueue")
says that it switches to use the system workqueue but it did neither
- remove the workqueue struct variable
- replace code to really use the system workqueue
Instead it calls queue_work() on uninitialized info->workqueue.
The result is a NULL pointer dereference in vibra_play().
Solution: use schedule_work
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/twl6040-vibra.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index ea63fad48de6..3a196ada6892 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -45,7 +45,6 @@ | |||
45 | struct vibra_info { | 45 | struct vibra_info { |
46 | struct device *dev; | 46 | struct device *dev; |
47 | struct input_dev *input_dev; | 47 | struct input_dev *input_dev; |
48 | struct workqueue_struct *workqueue; | ||
49 | struct work_struct play_work; | 48 | struct work_struct play_work; |
50 | struct mutex mutex; | 49 | struct mutex mutex; |
51 | int irq; | 50 | int irq; |
@@ -213,7 +212,7 @@ static int vibra_play(struct input_dev *input, void *data, | |||
213 | info->strong_speed = effect->u.rumble.strong_magnitude; | 212 | info->strong_speed = effect->u.rumble.strong_magnitude; |
214 | info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; | 213 | info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; |
215 | 214 | ||
216 | ret = queue_work(info->workqueue, &info->play_work); | 215 | ret = schedule_work(&info->play_work); |
217 | if (!ret) { | 216 | if (!ret) { |
218 | dev_info(&input->dev, "work is already on queue\n"); | 217 | dev_info(&input->dev, "work is already on queue\n"); |
219 | return ret; | 218 | return ret; |