Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3600673pxb; Mon, 24 Jan 2022 13:14:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJysdNVxP5SFwyCjmk3Kodb0FtjS3xpf9xhdLgqOv8c0Mnc2Jx80yqFqJN9jGUEHmxRGrfiD X-Received: by 2002:a63:1d4c:: with SMTP id d12mr13095629pgm.72.1643058841622; Mon, 24 Jan 2022 13:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058841; cv=none; d=google.com; s=arc-20160816; b=DBmp9E/Iik2vknvy2Qtok88cRiUg0BW01kWj8NXCEYHbGwROvuzuzlb0xue//+rSYF 5pMz8laK+cNmTZGKSOgD8Np4HWXVYfZYMPyYp7FsvBM5YIVhIDPQDGyx5C7Th0j/4Gie zlfb1GbjS766CP7mAjCLvocPQ7/qhwdRnI+F9Pd0i1XJgJofKKjCRYdO7dEorwKNkz0/ S5Y9Xz6dqRvJ1NYeA42Y1xACENWjssE/7Z54jWmw/isD/7yH88uRaF4RtiK6Uk0SAyiB AuaB5gowLuXByU/vdZae/je6DXkf5TwBpvlYhqOT4ClmTgi6SLFZG8cvQe9FCE874Fn6 DUiw== 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=YYXU3RC/ts4QViKDfdZvjVBkc6M3x13Qxbsa+LDlV6U=; b=toaL3gmC2+fQr74Yw0WLni0+KqQTD6s8agJ/eoh1/bwygGxpzQ+LhiwcpBNyoMiIX2 h8Vh62sKQSP1GmbCOLVufcwNizvyqGj+aWjuCgE1Vjk6pXIHCzWyPkG3EGahDkHXoZug 42Qx93+vf+gtJBnrVuC6ZNu9ZukvqPixxHV0k9nSGDCyVRk7CS/jvpdSLEucpEVGSiXB 7x9WW+X9KXlaXjJOIH5LcXtdM52ZXqC8WA5O2GqC7LuQ/MvZaq9eTi/tDLWZARvmXicN pI4AyfTy+e3QksPMYnUaiMuz3LoPHHu5iVQ1wzKQRZPeLxUEOnesC6lrJ64759jtcuP7 mBoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SeGqEkZA; 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 c8si13189253pfr.68.2022.01.24.13.13.49; Mon, 24 Jan 2022 13:14:01 -0800 (PST) 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=SeGqEkZA; 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 S1388514AbiAXUjD (ORCPT + 99 others); Mon, 24 Jan 2022 15:39:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57132 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349285AbiAXURw (ORCPT ); Mon, 24 Jan 2022 15:17:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26F55B812AA; Mon, 24 Jan 2022 20:17:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BF32C340E5; Mon, 24 Jan 2022 20:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055469; bh=RQ5Ca9+CytE6FpXfdzRkzs6Fgfx0IT5jkMAAFnh6LJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeGqEkZA2sNUb0CfgaymO3RUZORy1vcCqHfyzZCOSjvqkyNO2Q3IK61+25x2JtrkL uvKxnW6ZyBSq0uQNvd4cFPN9MNFgKweAEkUtrlcIzgfiq6lkPORZkVqdW6Rjr32+jk qvlqnTzPDq296ZIaaDhqwLxrRUZvyWpMg+5xW3iM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 162/846] media: i2c: ov8865: Fix lockdep error Date: Mon, 24 Jan 2022 19:34:39 +0100 Message-Id: <20220124184106.572115467@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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: Hans de Goede [ Upstream commit 6e1c9bc9ae96e57bcd8807174f2c0f44f9ef7938 ] ov8865_state_init() calls ov8865_state_mipi_configure() which uses __v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which is also sensor->ctrls.handler.lock) must be locked before calling ov8865_state_init(). Note ov8865_state_mipi_configure() is also used in other places where the lock is already held so it cannot be changed itself. This fixes the following lockdep kernel WARN: [ 13.233421] WARNING: CPU: 0 PID: 8 at drivers/media/v4l2-core/v4l2-ctrls-api.c:833 __v4l2_ctrl_s_ctrl+0x4d/0x60 [videodev] ... [ 13.234063] Call Trace: [ 13.234074] ov8865_state_configure+0x98b/0xc00 [ov8865] [ 13.234095] ov8865_probe+0x4b1/0x54c [ov8865] [ 13.234117] i2c_device_probe+0x13c/0x2d0 Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov8865.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2893,7 +2893,9 @@ static int ov8865_probe(struct i2c_clien if (ret) goto error_mutex; + mutex_lock(&sensor->mutex); ret = ov8865_state_init(sensor); + mutex_unlock(&sensor->mutex); if (ret) goto error_ctrls;