Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c79a93e1 authored by Ashwini Muduganti's avatar Ashwini Muduganti
Browse files

dma-buf: Use task_lock instead of taking reference to file_struct



We take reference to files_struct while browsing files, putting
down the reference in put_file_struct could result in sleep when
close_file is called this results in a kernel BUG as sleep is not
allowed with in the critical section protected by read_lock. so,
remove both get_file_struct and put_file_struct calls instead use
task_lock while iterating through files as this lock protects the
file_struct.Also fix the thread handling code to properly iterate
over all the threads.

Change-Id: Ib432918a0355053c9f977fd72d6b99c60d2f6362
Signed-off-by: default avatarVijayanand Jitta <vjitta@codeaurora.org>
Signed-off-by: default avatarAshwini Muduganti <amudug@codeaurora.org>
parent 48310991
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1401,11 +1401,11 @@ static int dma_procs_debug_show(struct seq_file *s, void *unused)
		}
		INIT_LIST_HEAD(&tmp->dma_bufs);
		for_each_thread(task, thread) {
			files = get_files_struct(task);
			if (!files)
				continue;
			task_lock(thread);
			files = thread->files;
			if (files)
				ret = iterate_fd(files, 0, get_dma_info, tmp);
			put_files_struct(files);
			task_unlock(thread);
		}
		if (ret || list_empty(&tmp->dma_bufs))
			goto skip;