Skip to content

Commit ceeb2e6

Browse files
Dafna Hirschfeldmchehab
authored andcommitted
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>
1 parent 23c72dd commit ceeb2e6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎drivers/media/platform/vimc/vimc-streamer.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
207207
stream->kthread = kthread_run(vimc_streamer_thread, stream,
208208
"vimc-streamer thread");
209209

210-
if (IS_ERR(stream->kthread))
211-
return PTR_ERR(stream->kthread);
210+
if (IS_ERR(stream->kthread)) {
211+
ret = PTR_ERR(stream->kthread);
212+
dev_err(ved->dev, "kthread_run failed with %d\n", ret);
213+
vimc_streamer_pipeline_terminate(stream);
214+
stream->kthread = NULL;
215+
return ret;
216+
}
212217

213218
} else {
214219
if (!stream->kthread)

0 commit comments

Comments
 (0)