Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1382074
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/5] input: twl6040-vibra: fix NULL pointer dereference by removing workqueue |
| Date | 2016-04-18 23:50 +0200 |
| Message-ID | <rppdn-49W-1@gated-at.bofh.it> (permalink) |
| References | <rpnuV-2F6-7@gated-at.bofh.it> <rpnuX-2F6-55@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Apr 18, 2016 at 09:55:39PM +0200, H. Nikolaus Schaller wrote:
> 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>
Applied, thank you.
> ---
> drivers/input/misc/twl6040-vibra.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
> index 1e9902d..3805129 100644
> --- a/drivers/input/misc/twl6040-vibra.c
> +++ b/drivers/input/misc/twl6040-vibra.c
> @@ -45,7 +45,6 @@
> struct vibra_info {
> struct device *dev;
> struct input_dev *input_dev;
> - struct workqueue_struct *workqueue;
> struct work_struct play_work;
> struct mutex mutex;
> int irq;
> @@ -213,7 +212,7 @@ static int vibra_play(struct input_dev *input, void *data,
> info->strong_speed = effect->u.rumble.strong_magnitude;
> info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1;
>
> - ret = queue_work(info->workqueue, &info->play_work);
> + ret = schedule_work(&info->play_work);
> if (!ret) {
> dev_info(&input->dev, "work is already on queue\n");
> return ret;
> --
> 2.7.3
>
--
Dmitry
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] fixes for twl6040-vibra "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-18 22:00 +0200
[PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-18 22:00 +0200
Re: [PATCH 5/5] input: twl6040-vibra: remove mutex Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-18 23:30 +0200
Re: [PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-19 09:50 +0200
Re: [PATCH 5/5] input: twl6040-vibra: remove mutex Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-19 10:10 +0200
Re: [PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-19 10:10 +0200
Re: [Letux-kernel] [PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-20 11:30 +0200
Re: [Letux-kernel] [PATCH 5/5] input: twl6040-vibra: remove mutex Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-20 20:00 +0200
Re: [Letux-kernel] [PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-20 20:20 +0200
Re: [Letux-kernel] [PATCH 5/5] input: twl6040-vibra: remove mutex Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-20 20:20 +0200
Re: [Letux-kernel] [PATCH 5/5] input: twl6040-vibra: remove mutex "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-20 21:10 +0200
[PATCH 3/5] input: twl6040-vibra: fix NULL pointer dereference by removing workqueue "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-18 22:00 +0200
Re: [PATCH 3/5] input: twl6040-vibra: fix NULL pointer dereference by removing workqueue Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-18 23:50 +0200
[PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-18 22:00 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-18 23:20 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-19 09:40 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-19 10:00 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-19 10:10 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-19 19:00 +0200
Re: [PATCH 2/5] input: twl6040-vibra: add handler to unregister input if module is removed "H. Nikolaus Schaller" <hns@goldelico.com> - 2016-04-20 11:20 +0200
csiph-web