Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2522183pxj; Mon, 10 May 2021 05:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGdH7vyGMBMd09a8PV07qpa9FIHUJpIx2SwQbqtKzNdWcZMduq+yEq8B7cfmIOXN1izfuK X-Received: by 2002:a7b:c7c6:: with SMTP id z6mr26163489wmk.24.1620648474758; Mon, 10 May 2021 05:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620648474; cv=none; d=google.com; s=arc-20160816; b=CIf8U76Qdu5M+GNk6xK29sSSPc9Bm9a3vYTq+ZqBi8QOaUqTpXbMavzWnKpOHiWdhY Om/Cs4VITTgrSgVtaLEg/wLA0oHUIcQgMTuyrDNqut+IpBHY/RsNE8rTd9rEaBvjJzXN n+Iy1LYzRYgah3souc4KVFfJDTYh+O36eYejmJQj8CQEupWLinvKdZNHY2RMyvLQFes9 6xV7XTkUTx95lGSHoOYC5kJjQr2YgMM2s05t/bY6860dprf2mEbFgePOaz7VNOW9i3eY WnQ1xjdTU/J8mBlPK6SqVXkQgnm9pG4dmWIV+X/JWAhGkhUiP9/bnKNc/q3HD36dbEIF ic9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0JxTDcJt4ZQGTCNWCRdSDB8Z+nRWfx33Y2/7KYxP+D8=; b=rivb4Pd3UaTiJeejxhlWRuPJ8LcokKwXiLFwEoZtGMQl+M3DuPLD/K6iIJrZj3IwDd m/uky6o1V1TeEcftqkNRhmR6TI3lh4fRZ06oNHKhMCs/VcS4exImPOkVhUFXs3xqD8zk TpfCjDtAq6EzNNmU4AAimeA+erRLHSQSZZfBkLr01BJiv/f87wc81ZWk14Nd5kZCAjHt M9xOdCEQDymS2PV8gGSYAhugaWT7h72oHS7430jzFLy+giEnj2d+OTY8VspT99FDocFV rL8e0yk0byKKGaNLuwIS5+6+68/8unJ2GwDzERh8RViROCoImZhRXHqHjb/Dvk54E4fS Bwxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W212EQvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si15146452edv.400.2021.05.10.05.07.28; Mon, 10 May 2021 05:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W212EQvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244058AbhEJL6K (ORCPT + 99 others); Mon, 10 May 2021 07:58:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:36910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235809AbhEJLGN (ORCPT ); Mon, 10 May 2021 07:06:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97532614A7; Mon, 10 May 2021 10:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644184; bh=fv4anlzDpP6hMcyLFnxxphDWL1hisyfY/aZq70Zqxxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W212EQvUBBBuEYdgV+tjI4jHGmpel74t4RnroQfCJmBHa+vdr03Kr+UoLd9SaGHYj vN91X+ffLwVukfDn3CaZSPlOjHYHsgbPLCY34TWYVdVS2E5wAyLVAMxagdCj7yXVje +AmBfrE0mGQAnu29myOUiLuU3cwkmc2+sLw2s5Wg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Felsch , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.11 320/342] media: coda: fix macroblocks count control usage Date: Mon, 10 May 2021 12:21:50 +0200 Message-Id: <20210510102020.691293597@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102010.096403571@linuxfoundation.org> References: <20210510102010.096403571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marco Felsch commit 0b276e470a4d43e1365d3eb53c608a3d208cabd4 upstream. Commit b2d3bef1aa78 ("media: coda: Add a V4L2 user for control error macroblocks count") add the control for the decoder devices. But during streamon() this ioctl gets called for all (encoder and decoder) devices and on encoder devices this causes a null pointer exception. Fix this by setting the control only if it is really accessible. Fixes: b2d3bef1aa78 ("media: coda: Add a V4L2 user for control error macroblocks count") Signed-off-by: Marco Felsch Cc: Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/coda/coda-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -2062,7 +2062,9 @@ static int coda_start_streaming(struct v if (q_data_dst->fourcc == V4L2_PIX_FMT_JPEG) ctx->params.gop_size = 1; ctx->gopcounter = ctx->params.gop_size - 1; - v4l2_ctrl_s_ctrl(ctx->mb_err_cnt_ctrl, 0); + /* Only decoders have this control */ + if (ctx->mb_err_cnt_ctrl) + v4l2_ctrl_s_ctrl(ctx->mb_err_cnt_ctrl, 0); ret = ctx->ops->start_streaming(ctx); if (ctx->inst_type == CODA_INST_DECODER) {