diff options
author | Dafna Hirschfeld <dafna.hirschfeld@collabora.com> | 2020-01-13 21:59:33 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-02-24 18:16:20 +0300 |
commit | ceeb2e6166dddf3c9757abbbf84032027e2fa2d2 (patch) | |
tree | 1a422c08a75e7f244c34acbd608459b5ee18ae4e | |
parent | 23c72dd9ffd22d8a17ec1b432eafa4caf3d8ccb6 (diff) | |
download | linux-ceeb2e6166dddf3c9757abbbf84032027e2fa2d2.tar.xz |
media: vimc: streamer: fix memory leak in vimc subdevs if kthread_run fails
In case kthread_run fails, the vimc subdevices
should be notified that streaming stopped so they can
release the memory for the streaming. Also, kthread should be
set to NULL.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r-- | drivers/media/platform/vimc/vimc-streamer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c index cd6b55433c9e..43e494df61d8 100644 --- a/drivers/media/platform/vimc/vimc-streamer.c +++ b/drivers/media/platform/vimc/vimc-streamer.c @@ -207,8 +207,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream, stream->kthread = kthread_run(vimc_streamer_thread, stream, "vimc-streamer thread"); - if (IS_ERR(stream->kthread)) - return PTR_ERR(stream->kthread); + if (IS_ERR(stream->kthread)) { + ret = PTR_ERR(stream->kthread); + dev_err(ved->dev, "kthread_run failed with %d\n", ret); + vimc_streamer_pipeline_terminate(stream); + stream->kthread = NULL; + return ret; + } } else { if (!stream->kthread) |