Skip to content

Commit

Permalink
media: vimc: streamer: fix memory leak in vimc subdevs if kthread_run…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Dafna Hirschfeld authored and Mauro Carvalho Chehab committed Feb 24, 2020
1 parent 23c72dd commit ceeb2e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/media/platform/vimc/vimc-streamer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ceeb2e6

Please sign in to comment.