Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp927368pxb; Wed, 6 Apr 2022 04:31:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7h1nsrZXYCBdahDbeTwrv1M742G6dZ29y4QvNXXGeE0oxqT7MOvYn3vUiz+bzXskUl38x X-Received: by 2002:a17:90b:3601:b0:1ca:978f:f422 with SMTP id ml1-20020a17090b360100b001ca978ff422mr9315774pjb.82.1649244705356; Wed, 06 Apr 2022 04:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244705; cv=none; d=google.com; s=arc-20160816; b=g44KO6taslNSxRMVWcCtI+c3ih0IyJPjpL3vHVoTY7kYZ+v9B6/m19Ptevaj0KgCLL LIFtnjA8m6uByRfnMEc9sLmeGIYEW6bl0vlqdJZglJkMkelUR90OnoWda4btuoJcYoGC SSHtV5xrc7E3A2slh7TquMm7BqWy747xuiLbCzAbAbYrstOkxW6ZhofNhg7MK6WFmsc1 uY6hWI+ecSR4DOSHtBfBYcBnCfW/UzVXFnadcce5oFWq0L7iRVOIPjhztXRKbdq9EzzE XFJP+Cvbe0ejcZ0tk1LyKJMMunlQayockp59T/7g8PbOBHay2a4q7+1pLFy1rnpxn7ah 8THw== 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=0KfcPYs5aHd+5keb6v/SyFrLUjfAdeFQ0iWoOFN53Wo=; b=nXBqB5V5W3T4poYzneyW1BSXGpbRMf9y4BeJIyU17AW3Dgg3QZ7TSx+GxTs4Q5yRNP hkL0qDTPEY72pzvJ8Lz1AAivD3Bb9R/5WGqHD19D+7XmLK5hv4eu1jU4aSYgOIxQ5JmW +uHQLXGdxdl+CQFE+wPNtRrwABem6NImEo2f/D8cDSaX40r5JylbLYj8X/ppq2xAi8ZF eTIiMOT3kW+Mit7jXX7QI6a/za+sKPLoY96wcxIdaFVDkZ5j+tI3ryosUSx0dnxEkwQD 6g4k5oTtr0KXfxjrfA+4ZRvnG2PMlaDdk77aapG4+Y+P5GSUaZyDRc3fX1GL2nAoTJiI I1Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gQoMCsct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c23-20020a63da17000000b003816043f0bdsi15988652pgh.690.2022.04.06.04.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gQoMCsct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 602236094BF; Wed, 6 Apr 2022 02:53:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575052AbiDEXC2 (ORCPT + 99 others); Tue, 5 Apr 2022 19:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349336AbiDEJtk (ORCPT ); Tue, 5 Apr 2022 05:49:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A84E632C; Tue, 5 Apr 2022 02:44:11 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 13629CE1C90; Tue, 5 Apr 2022 09:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 281E6C385A1; Tue, 5 Apr 2022 09:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151848; bh=mNrzE2y4jaCJIXuG3CMdKKY1QnNmRPTne+P4BnMs2vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQoMCsctWs2MwpVCDY8LRzlewIHTGNjswaGoZeNNbNW7GhmEybycHRuZMZ9S829Qj 1NJMeqSkcQ1wy3Xs8oYT5bB+QahQ4+G4Xe0xG93B73D7kCgmoGAytc3uL98Vx4ZlPf wQNbgbwf3gEn+jfMmQqYr+4LolLirxVIWB5vKT4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Rosin , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 563/913] i2c: mux: demux-pinctrl: do not deactivate a master that is not active Date: Tue, 5 Apr 2022 09:27:05 +0200 Message-Id: <20220405070356.721002310@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Rosin [ Upstream commit 1a22aabf20adf89cb216f566913196128766f25b ] Attempting to rollback the activation of the current master when the current master has not been activated is bad. priv->cur_chan and priv->cur_adap are both still zeroed out and the rollback may result in attempts to revert an of changeset that has not been applied and do result in calls to both del and put the zeroed out i2c_adapter. Maybe it crashes, or whatever, but it's bad in any case. Fixes: e9d1a0a41d44 ("i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'") Signed-off-by: Peter Rosin Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c index 5365199a31f4..f7a7405d4350 100644 --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c @@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err = device_create_file(&pdev->dev, &dev_attr_available_masters); if (err) - goto err_rollback; + goto err_rollback_activation; err = device_create_file(&pdev->dev, &dev_attr_current_master); if (err) @@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available: device_remove_file(&pdev->dev, &dev_attr_available_masters); -err_rollback: +err_rollback_activation: i2c_demux_deactivate_master(priv); +err_rollback: for (j = 0; j < i; j++) { of_node_put(priv->chan[j].parent_np); of_changeset_destroy(&priv->chan[j].chgset); -- 2.34.1