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: 15604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp276748vqb; Thu, 19 Oct 2023 03:11:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbusQstEMLFLkiorkv577v9hj3MqdnXY8zXeAkGxUnfSVbR5/Lp5GSJGn9ocK4ddqG61m6 X-Received: by 2002:a05:6a21:9987:b0:17a:f2ed:e921 with SMTP id ve7-20020a056a21998700b0017af2ede921mr1415008pzb.55.1697710260788; Thu, 19 Oct 2023 03:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697710260; cv=none; d=google.com; s=arc-20160816; b=dLJ/mCk+wmqmi5D7xHq+akJs63vzK0MqpeyEUmZMdRJUHXzUq+sW1eaxoD3oaE8tmF ejtoVlBT3VGzdPqG1bTo5QCg8qFPcPeB0VxJfycGbMwXx/Cl7YLVRBrbq1USOdg3f2wN 3deX/4fbeLW3qz5OrSceT5ZP7McS3MPJ7hT4NeexT0ObhaIzOKoT0krbKRHjB5/auf1i UsLq6PGmliZym0ZPodV9ab9je56LSQp7Q4us7KpZZrEcvsh9X274mjUonRzPjrCMDX3b jnnNbQabsSGSD24b03YKGSkgitSFir0UQsh1kqteDuwEu6vLPQnepoVH7d7WRZGTfgsi 8ndw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=+QL1vCu0aBMDA8mdjFy+OQgIj/mtB+gsf9+18KdaYWI=; fh=i3WS+6AgTKP10/eUP7j46CA4B/XR5qlEIT9hV1ltHe4=; b=g2OTWcBY/lw4U44iTiQsJoWCi4fyPUI2KSWkuJhBgvl+5Wf0M0aNr2IVA7bRSt8K5o vkl7e3qbYg9UrVPkmiLOKGbk5+8HU1D1ghGw5Wz0uAg/p2NA0dO2O01nz4h/Qw03cYvm pEfAbsIURl8k/PReR5KrJHltOVB9JtVlMkrXHBn33QAToVhvWeJpzrQ1DCt1S89DUfAm 10KPJ6xeIEspqNnF6vKk/W2ja6Gx9V+NPA7O+TILU9dwZ6j7iyJfWAtSRwIuAG76hNwF jUWWMgPYyO84jVdxMUkrTtuE7BWHKV9M0tiLZ2esHgbH/mh5oidozk/mR6TRgzaxYnNv q8Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ds1OJJ0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id gf23-20020a17090ac7d700b00278ee2b717fsi1740761pjb.85.2023.10.19.03.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 03:11:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ds1OJJ0e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 33963803D588; Thu, 19 Oct 2023 03:10:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345227AbjJSKK1 (ORCPT + 24 others); Thu, 19 Oct 2023 06:10:27 -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 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 03:10:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780168499148974996 X-GMAIL-MSGID: 1780178234840514127 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(-)