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

Commit 249f5a58 authored by Ricardo Ribalda Delgado's avatar Ricardo Ribalda Delgado Committed by Mauro Carvalho Chehab
Browse files

[media] vb2: Check if there are buffers before streamon



This patch adds a test preventing streamon() if there is no buffer
ready.

Without this patch, a user could call streamon() before
preparing any buffer. This leads to a situation where if he calls
close() before calling streamoff() the device is kept streaming.

Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent c897df0e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1832,6 +1832,11 @@ static int vb2_internal_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
		return -EINVAL;
	}

	if (!q->num_buffers) {
		dprintk(1, "streamon: no buffers have been allocated\n");
		return -EINVAL;
	}

	/*
	 * If any buffers were queued before streamon,
	 * we can now pass them to driver for processing.