Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2710433pxj; Mon, 31 May 2021 08:49:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsToi0I66ghnszXpxC/rW/QSH8srIpgSdRaEz9gpWhjrofQbDIXhrHYw69KBas/HB4YwX9 X-Received: by 2002:a17:906:fa13:: with SMTP id lo19mr15397490ejb.468.1622476157436; Mon, 31 May 2021 08:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476157; cv=none; d=google.com; s=arc-20160816; b=PchXtI9AuUp/BWv+0Wo2eIIxpLyf0HGuf23EzhhJ6zuFshbnafT+G2BFnT/2LQaVms 58enOz18b9J7LU0MRk8ua/zoyLLX+83+12FZO1ungV5upU8lZ28u5LpxeeZ4SE83I+Km xbeX7XPSUzGQN2FczlawEKpG0oybat6Aub82W4r5QkvWphQ+HjQ7MNs5fgHGnVzYVXKj sC4LtJiDC6L7o6NB9O8SaSpxdPB/baE0hTEZUc4Ut5Q7zEHGC6O6R8axdkLZPSzf5S1z wmY6E9MNkeImd/FoyAwKe4vJXGHzY1uhklq2+eZD9AUSZplAifFjndWhv0DfmZwsvHsf ip4Q== 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=P4a8t1cUTLbsdgnc1fzeB9yrbDN3WXOyQjVL4ptr0qg=; b=kLTEQ9KQtIM0ZZ+Q6MzSIIOP/lW4+OC1JuePI180fHX6hOm5y9PCDxF5BDjTJ/IkZV uIUKvyTiF84qxj/TmvkI+2mQg8v7ifxocq49S+KIcZlFuOZE5L/RyortlW4eMn4xfv81 CMA+Z6rKPT4n19VAim3TZI0DQNRtpKgepA0lJKUH9vEYEmfCEUm6kw05hzsp8EzbgI1Y rjI6aE5CA0saDZMz+YnG6aaQYEWkcaGl6GmvDpghER3VYzjxFoO+AkLaVsWHyX5OBn0m 5Hva3U/zhJpvhIGCKMs1psqYbSChSeQ+jx/Ky5/ie8UgVE2+zL4QLkbRfX1JIJgHBtdk x30A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YLTiOkBc; 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 k3si13890264eds.334.2021.05.31.08.48.53; Mon, 31 May 2021 08:49:17 -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=YLTiOkBc; 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 S231860AbhEaPsH (ORCPT + 99 others); Mon, 31 May 2021 11:48:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:55732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233625AbhEaO1E (ORCPT ); Mon, 31 May 2021 10:27:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EC4F61C17; Mon, 31 May 2021 13:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468823; bh=cUkw0qjG7kiX+pmn/gAfEEiyJM1R+QsQ4474B0sxByE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YLTiOkBcipXJxiR1fwDHLHBLe3ld8jjKgtGBSRE/0mdWPTJSCV2gsGRvoC3+hTCuH ccwZd50RW0wwX8Ajc5P43cVUjA9ZsXqWkaZQozlg+9x1hCZmVTTYq5tL0r/rayecDq f6c6SBGxHM2+WvcU0bHnKHvJvfYx8kwOtrdL9z8k= 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.4 142/177] net: mdio: octeon: Fix some double free issues Date: Mon, 31 May 2021 15:14:59 +0200 Message-Id: <20210531130652.846779246@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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 8327382aa568..088c73731652 100644 --- a/drivers/net/phy/mdio-octeon.c +++ b/drivers/net/phy/mdio-octeon.c @@ -72,7 +72,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; @@ -86,7 +85,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