Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp813514pxb; Wed, 6 Apr 2022 00:24:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEZGUsTtWKy5GFI74eQw3eMOXyogd8LhADf/tZ+wKJfdKvfqrIos9Yo9Y5X4cachkWtFPn X-Received: by 2002:a17:902:ef45:b0:156:1858:71fc with SMTP id e5-20020a170902ef4500b00156185871fcmr7372289plx.23.1649229857712; Wed, 06 Apr 2022 00:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649229857; cv=none; d=google.com; s=arc-20160816; b=vE8/m28JTuYpkc06PXfNl7+u5Da2pWphX80T+0yn1rZU8IvDllMkHt+Tj3uZc3TqHp S2I9F+ohahNPlQ8R1Y+u6N4kvxcsZX3PxFNhA2JP+gQ8TBlxT4ECQZ/riJ64PfHmLKqp BMDPwF2PwhNj94sB6fcs+ZUxxn4K/FarvLF0KZLIoTuk045L7BfhtD16H+R44QzpJSDb +tnB6aUJqF3jbid/ajernecgcWkZcvOIj17PLI6sUwF1Zzsj4nbpDeP9okjPCPM5zg57 w0l6iSVvCnD8EKFVjIx2LmMMTiPhsq5M/cB3x92RuqggWKhRkOugVCH0mjelAvHN1r61 hgEg== 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=/FWEKqJ1jRPNF9wUV3Y/lff624iEl2cKeuach41SOT0=; b=T3gP/uEhRE8Y2rjKBNBbRpUOBwplNfLqg/IP24UbD9AfPbvHKjmUadtzy/W5Bbpjdh SDxMwq/ggChY/oeqyQdnUCuGz1AwpiDVuwWDZgCFinHKJNXsSwmC91bekJ7T6Iw05/n6 Omxgc2Xa5WsNvybgg69KVomaksgbkIcm5iTxnau/tiPZCtVEPOCEvgm5GfjlEygknjiq LZa8gh3ihBYD1TK4uGvqbv4IiTBdpEU/2xT3xmWGhZzJQdwG5hr6SoQjo4hfvksLhlQA yDXYjE8oSvbsgOc7+igQItSgZGVGYJeql+TgLXdC0w4u+43tWde6RgILwvF/bPMvG3Z9 WRCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irblOKDd; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ls9-20020a17090b350900b001c785d86222si4911569pjb.45.2022.04.06.00.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 00:24:17 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irblOKDd; 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; 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 459341F95C4; Wed, 6 Apr 2022 00:04:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392178AbiDEWJ2 (ORCPT + 99 others); Tue, 5 Apr 2022 18:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349473AbiDEJtz (ORCPT ); Tue, 5 Apr 2022 05:49:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A27215809; Tue, 5 Apr 2022 02:46:56 -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 ams.source.kernel.org (Postfix) with ESMTPS id ED104B81B14; Tue, 5 Apr 2022 09:46:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38E75C385A2; Tue, 5 Apr 2022 09:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152013; bh=2xrrqqAmurLYBbNH7gEODCEGzcqKSrwq1J93E5yRers=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irblOKDdx5TPwfPPV8xanHFkqVhVvUDSoBtAhA66ge1vohFU8eeaXZ23tT/xIInhT lC+uZKdaE9YVUa++4pRlm96xeNLok4kKQElrjmKvD+4YZN3/ia3etyGZ9Uad6md6tK fdAATaTql/vRemPArdg34fp3EJdMlgVPYZuelntA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Sondhauss , Vignesh Raghavendra , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 575/913] drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool Date: Tue, 5 Apr 2022 09:27:17 +0200 Message-Id: <20220405070357.082424924@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: Sondhauß, Jan [ Upstream commit 2844e2434385819f674d1fb4130c308c50ba681e ] cpsw_ethtool_begin directly returns the result of pm_runtime_get_sync when successful. pm_runtime_get_sync returns -error code on failure and 0 on successful resume but also 1 when the device is already active. So the common case for cpsw_ethtool_begin is to return 1. That leads to inconsistent calls to pm_runtime_put in the call-chain so that pm_runtime_put is called one too many times and as result leaving the cpsw dev behind suspended. The suspended cpsw dev leads to an access violation later on by different parts of the cpsw driver. Fix this by calling the return-friendly pm_runtime_resume_and_get function. Fixes: d43c65b05b84 ("ethtool: runtime-resume netdev parent in ethnl_ops_begin") Signed-off-by: Jan Sondhauss Reviewed-by: Vignesh Raghavendra Link: https://lore.kernel.org/r/20220323084725.65864-1-jan.sondhauss@wago.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/ti/cpsw_ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c index 158c8d3793f4..b5bae6324970 100644 --- a/drivers/net/ethernet/ti/cpsw_ethtool.c +++ b/drivers/net/ethernet/ti/cpsw_ethtool.c @@ -364,11 +364,9 @@ int cpsw_ethtool_op_begin(struct net_device *ndev) struct cpsw_common *cpsw = priv->cpsw; int ret; - ret = pm_runtime_get_sync(cpsw->dev); - if (ret < 0) { + ret = pm_runtime_resume_and_get(cpsw->dev); + if (ret < 0) cpsw_err(priv, drv, "ethtool begin failed %d\n", ret); - pm_runtime_put_noidle(cpsw->dev); - } return ret; } -- 2.34.1