X-Received: by 2002:a17:90b:3806:b0:1b8:e628:d88 with SMTP id mq6-20020a17090b380600b001b8e6280d88mr2226424pjb.32.1645502880583; Mon, 21 Feb 2022 20:08:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645502880; cv=none; d=google.com; s=arc-20160816; b=n13LfA+LtKtLpdRN01ZplPH8kBb/8qSGeQrgenFDv487mG33S81F9YADfhAX6Nv8ax LSNxOw88RbY1DwSI9VVOKmIGKETAaLg462byRhQ72Qs2yDMRpEGgVqapHelZDzmZlMkF JvhXDj0fVaNlw82JAjH3P0y+CenBhxrf9wBbfsRqCDD7W40/ghVpbNr6qcgSm9TBgi+q O4y1V9TyFR9KiH8UGP14HqyrtkYY7c88qk6TPu2uEDqLoSsEZ6znnxDSk4zEq73EvZ64 Ac8Z7Bhw+b7bgXdbgSJMS8+wPrxpiGYKP0ArE0jcqubRuUproipejKLCHY3A+1pWPGlu HTJw== 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=hzGHC9SKRUVvcEc97/YFiea29I6E9Jz2E5MuWC5UtaE=; b=uB5O5X0XoMBM2EHk4jid5LomaGgkvgE/4q/E7cr6MGruGNZFFQBCdFV1AocahuPoB7 vXYXToK3duTvUbUG5nN2Y9piIUcOt/2mpAQ57O6T6RcFNY9pPoV6FYxPu+kYh0sxkCR7 iar82hhClfCNVWeHX5QCAaE2raGQpF97s/v3nZh+YGFx8AeBUi+qc3sGWUa3RPqdBvFa O4pFqyGiHJ70m7TnNZxyv9SxvKhuELnVIQuiMkXjooFqRqLsC3JA/F0biPr41IBUWKfx ikX8fvRSe/7T5juo8pHNKpQU3Bmi4uOazk0h9jweD7iQxFRVthevfC5WWW0JgkuTTDQd /JBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdJsH0j2; 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 s29si18813258pgo.648.2022.02.21.20.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:08:00 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdJsH0j2; 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 4DEED6D853; Mon, 21 Feb 2022 20:07:49 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352329AbiBUJzK (ORCPT + 99 others); Mon, 21 Feb 2022 04:55:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353081AbiBUJsL (ORCPT ); Mon, 21 Feb 2022 04:48:11 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A6022B0F; Mon, 21 Feb 2022 01:22:20 -0800 (PST) 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 37DEACE0EAD; Mon, 21 Feb 2022 09:22:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18764C340EB; Mon, 21 Feb 2022 09:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435337; bh=a292F22ich2hR+K5m+shwMroaVcVa7kwvVPUJP6WEck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdJsH0j2VGDblkpOkU3vAkbIuG6hknMs7EXtgld1EHzMeO1K83FPopGySwrUnHvQF JpUd4vn2Op8Ks6sSxEmXR05JOl0eZRoBYN4ZeO/KJgGuw2A4QLJv3kHCkOdw4qHc8s 0zoaNfoxEyju1Dp5cSv021u4bqkLkSGZEqjng0vg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.16 111/227] net: dsa: lantiq_gswip: fix use after free in gswip_remove() Date: Mon, 21 Feb 2022 09:48:50 +0100 Message-Id: <20220221084938.551272179@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@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: Alexey Khoroshilov commit 8c6ae46150a453f8ae9a6cd49b45f354f478587d upstream. of_node_put(priv->ds->slave_mii_bus->dev.of_node) should be done before mdiobus_free(priv->ds->slave_mii_bus). Signed-off-by: Alexey Khoroshilov Fixes: 0d120dfb5d67 ("net: dsa: lantiq_gswip: don't use devres for mdiobus") Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/1644921768-26477-1-git-send-email-khoroshilov@ispras.ru Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/lantiq_gswip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -2217,8 +2217,8 @@ static int gswip_remove(struct platform_ if (priv->ds->slave_mii_bus) { mdiobus_unregister(priv->ds->slave_mii_bus); - mdiobus_free(priv->ds->slave_mii_bus); of_node_put(priv->ds->slave_mii_bus->dev.of_node); + mdiobus_free(priv->ds->slave_mii_bus); } for (i = 0; i < priv->num_gphy_fw; i++)