lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220331085016.628747-1-wenst@chromium.org>
Date:   Thu, 31 Mar 2022 16:50:16 +0800
From:   Chen-Yu Tsai <wenst@...omium.org>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Hans Verkuil <hverkuil-cisco@...all.nl>
Cc:     Chen-Yu Tsai <wenst@...omium.org>,
        Nicolas Dufresne <nicolas.dufresne@...labora.com>,
        Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH RFT] media: vicodec: Fix encoder has stopped condition check in encoder_cmd

Before commit d4d137de5f31 ("media: vicodec: use v4l2-mem2mem draining,
stopped and next-buf-is-last states handling"), the vicoded tracked the
"has stopped" condition itself, and only updated it after checks and
actions were done.

With the move to v4l2-mem2mem helpers, the state tracking moved into
the mem2mem context, and was updated by v4l2_m2m_ioctl_encoder_cmd()
before checks and actions were done in vicodec. As a result, the
has_stopped condition is now always false.

In the original code, vb2_clear_last_buffer_dequeued() is called if
the stream is successfully started. Since this is now always the case
if the callback did not error out at v4l2_m2m_ioctl_encoder_cmd(),
we can drop the "has stopped" condition check. This restores the
original behavior.

Fixes: d4d137de5f31 ("media: vicodec: use v4l2-mem2mem draining, stopped and next-buf-is-last states handling")
Signed-off-by: Chen-Yu Tsai <wenst@...omium.org>
---

This arose from the review of my Hantro encoder cmd support patch [1].

I haven't used vicodec before, so this is only compile tested. Actual
testing requested.

[1] https://lore.kernel.org/linux-media/YjcbnmTUaWDtkIb%2F@eze-laptop/

 drivers/media/test-drivers/vicodec/vicodec-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index be43f7d32df9..898fa8e284f7 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -1231,8 +1231,7 @@ static int vicodec_encoder_cmd(struct file *file, void *fh,
 	    v4l2_m2m_has_stopped(ctx->fh.m2m_ctx))
 		v4l2_event_queue_fh(&ctx->fh, &vicodec_eos_event);
 
-	if (ec->cmd == V4L2_ENC_CMD_START &&
-	    v4l2_m2m_has_stopped(ctx->fh.m2m_ctx))
+	if (ec->cmd == V4L2_ENC_CMD_START)
 		vb2_clear_last_buffer_dequeued(&ctx->fh.m2m_ctx->cap_q_ctx.q);
 
 	return 0;
-- 
2.35.1.1021.g381101b075-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ