Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp275812pxm; Wed, 2 Mar 2022 15:11:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkKdIGBBqMYCvP7pYB4lycA0VGfFsJtTBgNt/QntZBwKIdNaenZjvIDYEW+dShLmEqgIk+ X-Received: by 2002:a17:903:2441:b0:151:95e2:aa44 with SMTP id l1-20020a170903244100b0015195e2aa44mr5853971pls.150.1646262692971; Wed, 02 Mar 2022 15:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646262692; cv=none; d=google.com; s=arc-20160816; b=D05q0D9tc8E+l3EDeUOz/3GqVJWouPQg9JzN2CpHVlSiA96x3SLrnddq5XrioKnQJd nL4sJlgXNOE+dCQMDGMhA3nrQ8T5g/5gX9iMAIs73EpQsW+2LWLId16nHA3hBdkMnpt1 Rley/WNwIuErBlyXh7vHtn6S5Z4nX7Y3c+QMYMqe2TIDRFYukWqBtgItP+j/U1PhaEXN IBaBn6aVZ3dvcoHWNx61wGMzd19d4V8z2warbAdAm1nICim7UrWBV59LlY+EbC4xvyo6 XtTVUtm/UFdNFNe0alqIZpZF099qW3AEYyHFr8EXzvCDV2vE1+Dv3xoWtgZAfEOUgj64 eqjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=+dcLUI7aRWmCH+Ebblf104IgjJ21v7ZvmdkMwB6r7JE=; b=wKSS3H/Pe41EpyRzZ+19Clbor+nGrjNWltTmFUI6Th1POOJHRVW5o5PFuR5F9f4le9 JGM0Jh0SY4spH4ycaOR8BJQ0kA6UJkBEB9BhrXEeDTpKRsiHn0h4LssNsquNl/CUQ0Be ruCVsoCmYXA9EFWxTLmPLj1utERXyZMQ19I1dAAP/AL7p4yfGC5PbV0CVvcynZ34cYPc KcfVzRt6IhyZURRumK1xQBy4gG1/JPxPkQzFP/6U3JXcK2ksf1peRN8iv6TP3FoVuBsN IVINaRKa6GSBwIF3uhnS+TIi9fxV9IZMYtcLU2StuXi10l/p/CLTPukbpkdEU0js0m0h /8Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g4-20020a170902868400b0014fa4ceef76si360304plo.114.2022.03.02.15.11.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:11:32 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E3E6812D927; Wed, 2 Mar 2022 14:52:01 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241874AbiCBTnE (ORCPT + 99 others); Wed, 2 Mar 2022 14:43:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241971AbiCBTm5 (ORCPT ); Wed, 2 Mar 2022 14:42:57 -0500 Received: from smtp.smtpout.orange.fr (smtp06.smtpout.orange.fr [80.12.242.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D78CC7D5D for ; Wed, 2 Mar 2022 11:42:12 -0800 (PST) Received: from [192.168.1.18] ([90.126.236.122]) by smtp.orange.fr with ESMTPA id PUrQnnTCySrXTPUrRnhqIB; Wed, 02 Mar 2022 20:42:09 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 02 Mar 2022 20:42:09 +0100 X-ME-IP: 90.126.236.122 Message-ID: Date: Wed, 2 Mar 2022 20:42:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: *** SPAM *** [PATCH] i2c: mux: demux-pinctrl: do not deactivate a master that is not active Content-Language: en-US To: Peter Rosin , "linux-i2c@vger.kernel.org" Cc: Wolfram Sang , "linux-kernel@vger.kernel.org" References: From: Marion & Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 Le 02/03/2022 à 12:22, Peter Rosin a écrit : > 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()'") > Cc: Christophe JAILLET > Signed-off-by: Peter Rosin > --- > drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > Hi! > > Either that, or I'm missing something. I found this issue when > reading code, and have made no tests to verify if my analysis > is correct. > > Cheers, > Peter > > 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); For what it worth, LGTM. CJ