From patchwork Thu Oct 19 10:10:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 736469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC893CDB465 for ; Thu, 19 Oct 2023 10:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345218AbjJSKK0 (ORCPT ); Thu, 19 Oct 2023 06:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345206AbjJSKKZ (ORCPT ); Thu, 19 Oct 2023 06:10:25 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA6911F; Thu, 19 Oct 2023 03:10:23 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id CEEAEC0003; Thu, 19 Oct 2023 10:10:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697710221; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+QL1vCu0aBMDA8mdjFy+OQgIj/mtB+gsf9+18KdaYWI=; b=Ds1OJJ0eeiL4VRdf2eS6s9Ljng/TBpOqfT2PgqU5widgB7GOb4ws4XinErF1rxi0EgDyV7 iWt7tSaobsU7voEZrtNtQRR/3sIPJ5uxjjt5eNjp7WgDodxVjfoHkK+mJ757RuEFvQrucS BjtEc5u6ykbWRtk0ImRY+DRppb0F28MatC7EKssjWe0PN5AOpchiSXob3HLOBQqyZDPvth zE+QMJrP1BETufYs7Gb/W1r8L66kI5raPR5P6Jie43r+EO8fL/B3oWNFPgZDGHpy8jVVGi MUnpEW0+D0eHG0aahTU6ejX4gKMVPoQICutpZvrrSxj0rcEguhKYBHWjRjw2dw== From: Herve Codina To: Wolfram Sang , Peter Rosin , Stephen Warren , Rob Herring , Greg Kroah-Hartman , Jonathan Cameron Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 0/3] Fix i2c mux module refcount issues Date: Thu, 19 Oct 2023 12:10:13 +0200 Message-ID: <20231019101017.425284-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Hi, Some i2c mux drivers wrongly use the pair of_find_i2c_adapter_by_node() / i2c_put_adapter() to lock the parent adapter. Indeed, i2c_put_adapter() decrements the module refcount while of_find_i2c_adapter_by_node() does not increment it. This leads to an overflow over zero of the parent adapter user counter. Identified mux drivers impacted are: - i2c-mux-gpmux - i2c-demux-pinctrl - i2c-mux-pinctrl Commit 48e9743dd648 ("i2c: core: add and export of_get_i2c_adapter_by_node() interface") introduces of_get_i2c_adapter_by_node() to correctly handle this refcount issue. This series fixes the 3 identified mux drivers replacing the of_find_i2c_adapter_by_node() call by an of_get_i2c_adapter_by_node() call. Compare to the previous iteration https://lore.kernel.org/linux-kernel/20231019073533.386563-1-herve.codina@bootlin.com/ This v2 series: - Fixes commit log message - Add Fixes and Acked-by tags Best regards, Hervé Changes v1 -> v2: - All patches Fix commit log Add relevant Fixes tag Add 'Acked-by: Peter Rosin ' Herve Codina (3): i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node() i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node() drivers/i2c/muxes/i2c-demux-pinctrl.c | 2 +- drivers/i2c/muxes/i2c-mux-gpmux.c | 2 +- drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)