Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2674682pxj; Mon, 31 May 2021 08:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8lCm39erqOzJ4QGx3AD+L711KeZPQL0QHylNAHjBmpB23q0vE1QlPk+xCJCOuv7QsJtpo X-Received: by 2002:a17:907:1b02:: with SMTP id mp2mr23381574ejc.196.1622473236719; Mon, 31 May 2021 08:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473236; cv=none; d=google.com; s=arc-20160816; b=iq4G74BVp7Bu07TY3MauD+7bLNFDJagHaSpPYSaNRENy37/s564aGKqVxLJYkyrN7v SuJs+Dmr7Np5HXXx6JxsBAE6/qEFrAC0U7fnbkJLEUhvdpzWYCwNJsJIcmgx3l5Syef4 pSx3nksrZWWJwDH4TAuuumR0PQ8GgxT4LyFieniIMMTxWNlDCUWHWeHH1TFvkKs1xamT qKkMbvAiYZqCyL9E3LjPf6fNtw3a2pRv+s8IArbAFDUIOl831SxYBxlJZO78JOFa5r2n 0cAgmor4JYFTIrzPUHV3RIhEIn+wiI8RVNsuDQw6Ls6J+EaXgOYRQl7NhV0OstoSjit2 TCWw== 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=ehwl8OwBE/Q6CdjNeUSRiKVZUZFX1FLzyFXR+dPS+OI=; b=vO0/iFTeFlpm8lcJXujPH2qqhnHbSlFQMXgJ2YE8wGllANagPChVrRvqm2Ny/l/wLI 7x8MgX2tHT+OubRNDH8dY1p72HaxFeU5RGlh6X2i0e89tvJzjqCa6/lXYtzYArps+WiD ERAZrewHHTKbYG8i3m7mRhXpBpFelpXTEbs45aP50gs2jrRxWrc9CjrQm+7/80Z20U/U T0nwn29VCeiGTOjkG9UMHVBX/C4ZD0HIuIZ1AgO08VcdhY5ThwvA4Syxt7EdRzGoz4mv QKW5Ak+CAizUS4tlpu8Zc4ai2vP7n9Tz/k79/90TPj9G1ZrTbH89uE3HBqbftzbNmqSl /9hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MwCJAZZo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs19si549378ejb.398.2021.05.31.08.00.13; Mon, 31 May 2021 08:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MwCJAZZo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233067AbhEaPAt (ORCPT + 99 others); Mon, 31 May 2021 11:00:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:37386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbhEaOGA (ORCPT ); Mon, 31 May 2021 10:06:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8193B61963; Mon, 31 May 2021 13:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468329; bh=XPZeU7ItnRBofVGC1Ghuw4wvvrqTmfH+opkYC75BA9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwCJAZZog/ZOm/h76lwiECAtfIDyL/tUkL24sK7UYUbgpwqnwAxCWvttK+R2ut2j1 mWq7eJAGKM3c/oi75dkKxzNi8mYohGQapfMd6ahhcAxJIgsu/LCgEXIp6+NBlwH9XJ q6ShLdgwVelgo/98NaXFgs/U718VKm6/KLq5dqtI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Christophe JAILLET , Russell King , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 203/252] net: mdio: octeon: Fix some double free issues Date: Mon, 31 May 2021 15:14:28 +0200 Message-Id: <20210531130704.915054806@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit e1d027dd97e1e750669cdc0d3b016a4f54e473eb ] 'bus->mii_bus' has been allocated with 'devm_mdiobus_alloc_size()' in the probe function. So it must not be freed explicitly or there will be a double free. Remove the incorrect 'mdiobus_free' in the error handling path of the probe function and in remove function. Suggested-By: Andrew Lunn Fixes: 35d2aeac9810 ("phy: mdio-octeon: Use devm_mdiobus_alloc_size()") Signed-off-by: Christophe JAILLET Reviewed-by: Russell King Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/mdio/mdio-octeon.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/mdio/mdio-octeon.c b/drivers/net/mdio/mdio-octeon.c index d1e1009d51af..6faf39314ac9 100644 --- a/drivers/net/mdio/mdio-octeon.c +++ b/drivers/net/mdio/mdio-octeon.c @@ -71,7 +71,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev) return 0; fail_register: - mdiobus_free(bus->mii_bus); smi_en.u64 = 0; oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); return err; @@ -85,7 +84,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev) bus = platform_get_drvdata(pdev); mdiobus_unregister(bus->mii_bus); - mdiobus_free(bus->mii_bus); smi_en.u64 = 0; oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN); return 0; -- 2.30.2