Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2819340pxb; Mon, 11 Jan 2021 22:12:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkc+lShNSAn1fkI+hIh08IrspAWG9LsyN7oV7V9dmtVw69XdSz9zm+RdKHj2fyJpoKbv5Y X-Received: by 2002:a17:906:8594:: with SMTP id v20mr2034541ejx.470.1610431970764; Mon, 11 Jan 2021 22:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610431970; cv=none; d=google.com; s=arc-20160816; b=rFA/g10Ayn3WPh+P5oVhh1bgPPRXxACiedXBz5zf2jzh2KzM37HoNTjTnvT1YYO7s5 kQQz/SA27/4Dg9pc2IWUj/kkfFuVl6LWo/3a7nHt6pdsKqklgn93V6xR5KBmM/TVQVxp dYeMI9gzjR1M/ijNRlfj7Y1jKxoyewkQCW+zQdYieC/TeEqVIc7mm4rk6ttOLJPU3WrH WWmhZIz9DFJWZyL2APSw7lB+alitZKkOpGRq638gqS4ZuCVLk+SWjhWHfqN6TAteAZ38 ODlvviX4aTrTcPTgX3cQfcyB0ENGnEk7+b1blhpOUttIYDvGfMLPCw5mRNKEVde+/Tsq c9bQ== 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=uZmLpTEA/6Vxz72WCk4xw54PG1hzajLx+yRf16PwfOU=; b=AqwWFY+eVXg5fOX4kONWrgl4NIm+p62GfBrL3ONwSAWxUdj0sLjrRH/cGo1iH+cjB+ zVk6CCvh9uAEFlEpprvqOkiRx4Kb7I+wAoGy4YB72wgkAiorQKO2oYph1Au3jwYWOf7x TEgmaci6sq413wEwXc/a2NYOIt6ru7qbuTAYwvE6WHN6oDYND7O6Z3mw4KWxCK0VlXY9 0iXRV+lgOTCnzSp5cmNNH/yanNYYsPHYWgqAYZjgKIg2G+nv0L714SfdLpALL9gQ9jv4 v8HFblVSxMPcn6ENStSF2bFUuREAq2MUILWnaZh6UustoFuXNzlGkIsMJOAVV3wYE4gn 00Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CeSzpiMn; 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 s20si788685eji.387.2021.01.11.22.12.26; Mon, 11 Jan 2021 22:12:50 -0800 (PST) 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=CeSzpiMn; 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 S2387729AbhAKNsd (ORCPT + 99 others); Mon, 11 Jan 2021 08:48:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:57186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731143AbhAKNKN (ORCPT ); Mon, 11 Jan 2021 08:10:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1ED0F225AB; Mon, 11 Jan 2021 13:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370597; bh=dfNV/FXTT4rsVzj5Jdw+OKC/W6560auufiveX5B7YXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeSzpiMncHFrOnPyDv+kij9nQT2JQE/owcOduhwV2MnQXbjPWpK/IUS1WozROHHhf 5TU8WXVEv/6ODj/qdOZ7pgrWVDiv8JHIL+CWtslmdIyQ9NcVBJK3R8Jz93KvkuZbS+ fShu8f6RVlACcsbZryy3tTfUROHOtx245SKytdNU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rasmus Villemoes , Jakub Kicinski Subject: [PATCH 5.4 15/92] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() Date: Mon, 11 Jan 2021 14:01:19 +0100 Message-Id: <20210111130039.895843678@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@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: Rasmus Villemoes [ Upstream commit e925e0cd2a705aaacb0b907bb3691fcac3a973a4 ] ugeth is the netdiv_priv() part of the netdevice. Accessing the memory pointed to by ugeth (such as done by ucc_geth_memclean() and the two of_node_puts) after free_netdev() is thus use-after-free. Fixes: 80a9fad8e89a ("ucc_geth: fix module removal") Signed-off-by: Rasmus Villemoes Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3935,12 +3935,12 @@ static int ucc_geth_remove(struct platfo struct device_node *np = ofdev->dev.of_node; unregister_netdev(dev); - free_netdev(dev); ucc_geth_memclean(ugeth); if (of_phy_is_fixed_link(np)) of_phy_deregister_fixed_link(np); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); + free_netdev(dev); return 0; }