From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751411AbeBTEpI (ORCPT ); Mon, 19 Feb 2018 23:45:08 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:38772 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbeBTEpF (ORCPT ); Mon, 19 Feb 2018 23:45:05 -0500 X-Google-Smtp-Source: AH8x227pCYs3/uEZieT11TL1q+Uk9EeiHirpHHFUqFd8ID4F9GtbU6hWSj/dIze11rLNZ20cp0LOcQ== From: Alexandre Courbot To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus Cc: Gustavo Padovan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [RFCv4 08/21] [WAR] v4l2-ctrls: do not clone non-standard controls Date: Tue, 20 Feb 2018 13:44:12 +0900 Message-Id: <20180220044425.169493-9-acourbot@chromium.org> X-Mailer: git-send-email 2.16.1.291.g4437f3f132-goog In-Reply-To: <20180220044425.169493-1-acourbot@chromium.org> References: <20180220044425.169493-1-acourbot@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only standard controls can be successfully cloned: handler_new_ref, used by v4l2_ctrl_request_clone(), forcibly calls v4l2_ctrl_new_std() which fails to find custom controls names, and we eventually hit the condition that name == NULL in v4l2_ctrl_new(). This prevents us from using non-standard controls with requests, but that is enough for testing purposes. Signed-off-by: Alexandre Courbot --- drivers/media/v4l2-core/v4l2-ctrls.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 166647817efb..7a81aa5959c3 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2772,6 +2772,11 @@ int v4l2_ctrl_request_clone(struct v4l2_ctrl_handler *hdl, if (filter && !filter(ctrl)) continue; err = handler_new_ref(hdl, ctrl, &new_ref, false); + if (err) { + printk("%s: handler_new_ref on control %x (%s) returned %d\n", __func__, ctrl->id, ctrl->name, err); + err = 0; + continue; + } if (err) break; if (from->is_request) -- 2.16.1.291.g4437f3f132-goog