Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4354031rwl; Mon, 3 Apr 2023 03:55:08 -0700 (PDT) X-Google-Smtp-Source: AK7set8V73NJnp087Yh2+fTLc17AFTkD9uin7kwq697UUQSqXirW4UScGnG/ORAxJYMk8i5Dav4Q X-Received: by 2002:a05:6a20:1994:b0:da:6e45:6056 with SMTP id bz20-20020a056a20199400b000da6e456056mr28268295pzb.43.1680519307873; Mon, 03 Apr 2023 03:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680519307; cv=none; d=google.com; s=arc-20160816; b=qH7eTAg2WzWMBLrX2b10Sv1In7o8t8Vz5DuYc6AkULGO/huAwm9DFIArwINUNVsmND CEkrpT9qajy/MCkiOO73oFxZKrv0SRhuT2ePmV6cFjC3ovEhQ4oPLgrGdu0YHuhobomm iRUEGbbr9LhtshnKnvaRG6j8wLhPS+Zo00zNqiBjwBtuAfspW5g1AoHq/CytMCm0Qz2i TC4r6Tm9mJO0pdUTD73vyU5q5F6fhwbrq4WfT/BgiEWCwmpWiVve+kIfNV7CZxhbtAuB B1gMrPX8nO7937RZcWViTwPWu1ejWpw5ruCnLbiXywlTBC3vFbrRjMNHB1d/kWh8rmVw XNnw== 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:dkim-signature; bh=nTQGHtdXlz7byZ1wvpj73USs4e2S5vxOkxNipIXJcC4=; b=E3bgbYaBGpfLBekeNPFuWh+2sn0xy9l5oC1kXMIr3ZcnoVJE8KAGG5j/mjs8w73ypm hL3gqT9JQrtRKcju2bnHkwHseVR5bo69HD8kdHRKTM7nGvq/7/9ArngiRdwKUTyYVlNA FGEPTuFXOuaNB05XXnfSCPWmwa3xA+66nqG5B9TUtpyVtn1B/os+eA2N/Cy/biC9I/Uz jDxnd4MNghgI8U/WMFqpMtXOj/nCRuys4ISHBECDLetuB+YSBawVMdA/AyjCTesF758I paJ9Q5Y5Stqszr/T3eRadbaPIlbGhF37sHRpCd1QP92f9e2kJBRwi4WRS5sqzmvyQcgd keqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X51H2bz4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b00502e7016655si7947786pgw.377.2023.04.03.03.54.56; Mon, 03 Apr 2023 03:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X51H2bz4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbjDCKuU (ORCPT + 99 others); Mon, 3 Apr 2023 06:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbjDCKuG (ORCPT ); Mon, 3 Apr 2023 06:50:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0660C8690; Mon, 3 Apr 2023 03:50:05 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8B2A0618BC; Mon, 3 Apr 2023 10:50:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB1B1C433EF; Mon, 3 Apr 2023 10:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680519004; bh=pNoXpE9oUqa30A0KIh7PGSKM0DPrQpMrz2J5xReqjiw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=X51H2bz4u4kSFa/6GcJsMQnoOvyO/426SZUpoL9HU1q4GMqaCLSwUYFIKyk6lq2+w PHwC9yF0UZMxinls8SeBj2bDeTTG3uHpORIgzJU+dF1d2T+YPnEQnpz/HiwCDmFT/T xe+9IakCZEjDp8y51tP/X+HLKuLccu3/6mdp6gQpxm26MaUpW/AzR7zk2t3FScQMyN YnzYWA7+swoxzOd9p6EMK9pL7LVXV9YpjNYoK3jExmkt4RURTc894c8V0fF6WCGmtK LqhorJPHaZKgi+yAtZqOETDMh7INlDNOlTwziwm5JLdI8cgRfWAVR9t8LSVljxPMTw uhJURqqWpT8yQ== Message-ID: Date: Mon, 3 Apr 2023 13:49:58 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH net] net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe Content-Language: en-US To: Siddharth Vadapalli , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, srk@ti.com References: <20230403090321.835877-1-s-vadapalli@ti.com> From: Roger Quadros In-Reply-To: <20230403090321.835877-1-s-vadapalli@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/04/2023 12:03, Siddharth Vadapalli wrote: > In the am65_cpsw_nuss_probe() function's cleanup path, the call to > of_platform_device_destroy() for the common->mdio_dev device is invoked > unconditionally. It is possible that either the MDIO node is not present > in the device-tree, or the MDIO node is disabled in the device-tree. In > both these cases, the MDIO device is not created, resulting in a NULL > pointer dereference when the of_platform_device_destroy() function is > invoked on the common->mdio_dev device on the cleanup path. > > Fix this by ensuring that the common->mdio_dev device exists, before > attempting to invoke of_platform_device_destroy(). > > Fixes: a45cfcc69a25 ("net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio") > Signed-off-by: Siddharth Vadapalli Reviewed-by: Roger Quadros