Skip to content

Commit 2e0ce54

Browse files
Hans Verkuilgregkh
authored andcommitted
Revert "media: v4l2-ctrls: show all owned controls in log_status"
commit eba63df upstream. This reverts commit 9801b5b. This patch introduced a potential deadlock scenario: [Wed May 8 10:02:06 2024] Possible unsafe locking scenario: [Wed May 8 10:02:06 2024] CPU0 CPU1 [Wed May 8 10:02:06 2024] ---- ---- [Wed May 8 10:02:06 2024] lock(vivid_ctrls:1620:(hdl_vid_cap)->_lock); [Wed May 8 10:02:06 2024] lock(vivid_ctrls:1608:(hdl_user_vid)->_lock); [Wed May 8 10:02:06 2024] lock(vivid_ctrls:1620:(hdl_vid_cap)->_lock); [Wed May 8 10:02:06 2024] lock(vivid_ctrls:1608:(hdl_user_vid)->_lock); For now just revert. Fixes: 9801b5b ("media: v4l2-ctrls: show all owned controls in log_status") Cc: stable@vger.kernel.org Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 36c79eb commit 2e0ce54

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

drivers/media/v4l2-core/v4l2-ctrls-core.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,8 +2504,7 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl)
25042504
EXPORT_SYMBOL(v4l2_ctrl_handler_setup);
25052505

25062506
/* Log the control name and value */
2507-
static void log_ctrl(const struct v4l2_ctrl_handler *hdl,
2508-
struct v4l2_ctrl *ctrl,
2507+
static void log_ctrl(const struct v4l2_ctrl *ctrl,
25092508
const char *prefix, const char *colon)
25102509
{
25112510
if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY))
@@ -2515,11 +2514,7 @@ static void log_ctrl(const struct v4l2_ctrl_handler *hdl,
25152514

25162515
pr_info("%s%s%s: ", prefix, colon, ctrl->name);
25172516

2518-
if (ctrl->handler != hdl)
2519-
v4l2_ctrl_lock(ctrl);
25202517
ctrl->type_ops->log(ctrl);
2521-
if (ctrl->handler != hdl)
2522-
v4l2_ctrl_unlock(ctrl);
25232518

25242519
if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE |
25252520
V4L2_CTRL_FLAG_GRABBED |
@@ -2538,7 +2533,7 @@ static void log_ctrl(const struct v4l2_ctrl_handler *hdl,
25382533
void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
25392534
const char *prefix)
25402535
{
2541-
struct v4l2_ctrl_ref *ref;
2536+
struct v4l2_ctrl *ctrl;
25422537
const char *colon = "";
25432538
int len;
25442539

@@ -2550,12 +2545,9 @@ void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
25502545
if (len && prefix[len - 1] != ' ')
25512546
colon = ": ";
25522547
mutex_lock(hdl->lock);
2553-
list_for_each_entry(ref, &hdl->ctrl_refs, node) {
2554-
if (ref->from_other_dev ||
2555-
(ref->ctrl->flags & V4L2_CTRL_FLAG_DISABLED))
2556-
continue;
2557-
log_ctrl(hdl, ref->ctrl, prefix, colon);
2558-
}
2548+
list_for_each_entry(ctrl, &hdl->ctrls, node)
2549+
if (!(ctrl->flags & V4L2_CTRL_FLAG_DISABLED))
2550+
log_ctrl(ctrl, prefix, colon);
25592551
mutex_unlock(hdl->lock);
25602552
}
25612553
EXPORT_SYMBOL(v4l2_ctrl_handler_log_status);

0 commit comments

Comments
 (0)