From patchwork Tue Apr 4 12:32:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 40582 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvNdg-0000yg-TE; Tue, 04 Apr 2017 12:32:48 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-6) with esmtp id 1cvNde-0006ne-5T; Tue, 04 Apr 2017 14:32:48 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754291AbdDDMco (ORCPT + 1 other); Tue, 4 Apr 2017 08:32:44 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:35227 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799AbdDDMcm (ORCPT ); Tue, 4 Apr 2017 08:32:42 -0400 Received: by mail-wr0-f174.google.com with SMTP id k6so208594373wre.2 for ; Tue, 04 Apr 2017 05:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K+S1hDM3WJymnv7EMKcB5eZV6MFyszw7GY8hBApHglM=; b=kAU1LFC+QlOWhk4d7wUJBdTxtG1DFvZOh5hN75IxrK9NIviiFCLk+ggpXVVMJBHCAW C7iqTecblqSzNPlhR0GBqj7VHMCs7bY9Kpve7ei/jF1jme0v/iVJN4xDjKpERmN2hwRe LL64pBAVNLYXbYJn/FBpopKJALVceaoxaSdDg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K+S1hDM3WJymnv7EMKcB5eZV6MFyszw7GY8hBApHglM=; b=me5o67G/7Rj7LGaXAZcokkoy8HyRGkdclZfIW40uWoB4IzbimqGxWenzFG65qHPB4r vsKV+VoI4KcnPavicqZlCjMLT6EYN1tJ5KV+erBrKu4WLzM3UbbyMhG/pj07Z1RLvvST mbgx2kcnFOoZSc5PB46gwVQkhZwTn/Dxf0gakQG/3TofB3b8eYfjVe301CQc67MJoHGg keY0MVs2qJnKNVQZry21u87h76Nm4DsvTygENkgbIrU2Tw1+8LbgWquALwzgRg9WPWw4 ibHxY1ZFyfuse9xfy4l/5pFcN7vpe+zSMHhaJwrfdt/2Pm14phbD7iGJJTGxrzR8y6F5 zg9w== X-Gm-Message-State: AFeK/H3UMrTqPHlKpMlQUrppCgq44/uaqbzgipcyT9bButeB10xkxa1TlqyfIaL4zM8QPbQb X-Received: by 10.223.142.18 with SMTP id n18mr20288862wrb.188.1491309146366; Tue, 04 Apr 2017 05:32:26 -0700 (PDT) Received: from localhost.localdomain ([2.31.167.174]) by smtp.gmail.com with ESMTPSA id 75sm21479249wmp.2.2017.04.04.05.32.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 05:32:25 -0700 (PDT) From: Lee Jones To: hans.verkuil@cisco.com, mchehab@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, patrice.chotard@st.com, linux-media@vger.kernel.org, benjamin.gaignard@st.com, Lee Jones Subject: [PATCH 2/2] [media] cec: Fix runtime BUG when (CONFIG_RC_CORE && !CEC_CAP_RC) Date: Tue, 4 Apr 2017 13:32:19 +0100 Message-Id: <20170404123219.22040-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404123219.22040-1-lee.jones@linaro.org> References: <20170404123219.22040-1-lee.jones@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.4.4.122715 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MULTIPLE_RCPTS_CC_X2 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' Currently when the RC Core is enabled (reachable) core code located in cec_register_adapter() attempts to populate the RC structure with a pointer to the 'parent' passed in by the caller. Unfortunately if the caller did not specify RC capibility when calling cec_allocate_adapter(), then there will be no RC structure to populate. This causes a "NULL pointer dereference" error. Fixes: f51e80804f0 ("[media] cec: pass parent device in register(), not allocate()") Signed-off-by: Lee Jones --- drivers/media/cec/cec-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c index 06a312c..d64937b 100644 --- a/drivers/media/cec/cec-core.c +++ b/drivers/media/cec/cec-core.c @@ -286,8 +286,8 @@ int cec_register_adapter(struct cec_adapter *adap, adap->devnode.dev.parent = parent; #if IS_REACHABLE(CONFIG_RC_CORE) - adap->rc->dev.parent = parent; if (adap->capabilities & CEC_CAP_RC) { + adap->rc->dev.parent = parent; res = rc_register_device(adap->rc); if (res) {