Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2625803pxj; Mon, 31 May 2021 06:52:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtoE0PdriEPM8y/QRM9Ws84SfsbilLfn0tggD4pXgtQ6HVSpG/uLSxxi/kyHjzotYvfgjb X-Received: by 2002:a02:cac6:: with SMTP id f6mr20910975jap.142.1622469145578; Mon, 31 May 2021 06:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469145; cv=none; d=google.com; s=arc-20160816; b=SudSxeiTacupJa3ByYBDnXToMm5fQlNmQaWMJN+rFn203ngEFh+UQn5KY2ghX7GpGb 0UGNeHLYHcdV92MX0wwybFF/T/ORsAjTv4LjB3jnBKic1PCgjv06hosdED4Q8e8cGr66 048TkVb34Ak9/VHY1hUmw+hGmD4avVMp90z9LCOV5e6PCduumoA9xUpEMcPwnQWrSnuH n2Sc8EMxX6mVGOKygtokyn1FGFMJwTRjZ0PW5Gj9JUZQz2l6KP0Gz/a2eKWm+vrKM/7y /bo7T66eL6WumGv4GhQoyFbWwDeCJuryi/ZRwJJmO/MqtIRo3pxJYW+JiLWkBYdTZWBC xxPQ== 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=urYmn+ejSmoZ1DF53HTh4+yTD8YDXlY0EGir26OM7gyE0jUrk6yXpjBeMNvO5dp2zL aKg3+yo6XHQeGe56DTnQ1+lewQgbx2igMpiB2T3bGH2kLjZjUSC8ack+lEcaHncdj/bh WGvdNYdqQS8re7nb12l3kI+lQlEsxoliCvTSXhhO2Lb1Curv0dtvynnVrOS3ZGrf0kUi 9Rjenkwa72hz28fx9JlvvMJvMv0kM4UZelm+bDdTzfW9zYqh9y1drqDZurKm8kClKLbx nNguX8MpVQnm/ohPgzom/8knDZWDtRY24CvySFYtL1N1p3J6UZw6vxmJqAPw1+yvwrgV x/dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JiEcqqlO; 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 c22si13700532ioo.82.2021.05.31.06.52.12; Mon, 31 May 2021 06:52:25 -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=JiEcqqlO; 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 S232975AbhEaNxI (ORCPT + 99 others); Mon, 31 May 2021 09:53:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232069AbhEaNfs (ORCPT ); Mon, 31 May 2021 09:35:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CF76461441; Mon, 31 May 2021 13:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467534; bh=4wBO4HH5W5Gu4Lso9HS7zxZEbBiamO6rRNPgJ3RIF9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JiEcqqlOHzaRP1N4e+Wtk1PZHNtFo53LVNb74nCFvuzCzMbt3IYVp/BF7Q5jX/PMS KksA+AR4hsawQezGV6XuKQXjaQkaieTGriiW7zixQBHfKGc9l4EHCnA1Gf/ZJTaxm7 kRVhe+M35YqmWxv1Dhcf1q6imZBGI/RhpbgtMTY0= 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.19 100/116] net: mdio: octeon: Fix some double free issues Date: Mon, 31 May 2021 15:14:36 +0200 Message-Id: <20210531130643.523849263@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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