Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2639558pxj; Mon, 31 May 2021 07:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAVDetQAdXDi0AM5qmInQYztwfD0pcPCYoEV9blwOfJT/4cImnii+WEB7CUsT0lMTPnUuJ X-Received: by 2002:a92:d403:: with SMTP id q3mr12281408ilm.282.1622470191157; Mon, 31 May 2021 07:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470191; cv=none; d=google.com; s=arc-20160816; b=r9IHiOp9IJLVZU0Fg7m5FWf/TGoFQFDyf3z/ckw3/6FoHNideEDKMCquBpqRnvK4L8 9h051QA+a8UpMK+7nhyGCxzVA8AGLGY4JTHUEwvylY6xND1tnBhTLqc3RqzaXetXOTJX BvJM6Tm1bdVADjsS5rkIu2LDsPhA5FLae6EwKc/ZYvwLjZV0kXWhmI+BzJFmSDGG6Kf2 3m39Vt7nWVlTwVevjUSQARuclYnNv+aFeFmj7hSK8lzapg8CuO3215XKmY1z513JXTM5 1WoPqtpLoibLpztMzzFv+xuoobepInf1XnETfGGL7CaH0A/gF3NQm5KuxbbQLxiKPtQ8 c2DA== 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=MG7a1ceCHU+PxbjLnlyHZWtmqnYIOdkmpy1q6Qu5slk=; b=sFT+J9UlrwFRmQpRTNvqMT2GpgOfVBuspqHu0/EsssSLQy9YC1TOwKQGQIjs9eUTvc klFvVS2QsuAU6emk+nbwv9JpuAu0qGBLbnTZ6R6Nah34NI+zpbaxLDmlTz6+ml+LmJ74 ujYwfbQVGKzdHxx8mYmCWLEdgN8KA0jf01/XmOG6dcjts950gNVjHc4Eosy1RS0ADrUD uma+ZuNP9hwk376pK86LeunAohi+TbG2cuTuh8kS5yhPb1kcT2f/0xqc/P7FSmEKIN/S lwAB/Tm1sLTFVtIiiSWocAiLOz6+NxHxa9FCovEx8u2R971WgqrHM96+pLXfqzdFNyxE jJcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXB2Uzt+; 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 g12si11831981ila.56.2021.05.31.07.09.37; Mon, 31 May 2021 07:09:51 -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=AXB2Uzt+; 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 S233565AbhEaOJo (ORCPT + 99 others); Mon, 31 May 2021 10:09:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:50206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232501AbhEaNnm (ORCPT ); Mon, 31 May 2021 09:43:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21A3F61493; Mon, 31 May 2021 13:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467747; bh=4wBO4HH5W5Gu4Lso9HS7zxZEbBiamO6rRNPgJ3RIF9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXB2Uzt+g/ukIoORCWS33gx3fTU490/vA21KIydkvF3dte/1TYe3+8sb/JSLcc5ES PyI5hgdrSoSxFHGNwD6ywMuZHyvG23pDGiFPIdubxP+Jdi/RJKMuDM3B824S0ywe/c iXGf8cn9KS+RKm93GpF8mnQL0wtnVVdmsFj+s9nw= 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 4.14 65/79] net: mdio: octeon: Fix some double free issues Date: Mon, 31 May 2021 15:14:50 +0200 Message-Id: <20210531130638.074234119@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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/phy/mdio-octeon.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/phy/mdio-octeon.c b/drivers/net/phy/mdio-octeon.c index ab6914f8bd50..1da104150f44 100644 --- a/drivers/net/phy/mdio-octeon.c +++ b/drivers/net/phy/mdio-octeon.c @@ -75,7 +75,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; @@ -89,7 +88,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