Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2289281pxb; Mon, 11 Jan 2021 06:09:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkZzU+DD3B7TE8aodQ+nRXv1fxDvcsL8HvVzEtVbPg1ltUZ4L2vahJg0LZYnPPuEaLlmkX X-Received: by 2002:a17:906:2798:: with SMTP id j24mr11055137ejc.328.1610374169924; Mon, 11 Jan 2021 06:09:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610374169; cv=none; d=google.com; s=arc-20160816; b=u6/FZiVQXdLUTdlx0SeKsDgLWcePkXHe+bpe5geah9j2SeDGAcwbNI72I5/YBhxbyU NoLbEFfLYcPpvYcFEzHP0UnUylsOONSl5KMAoqqjqHWKAHfwDqYyYu6bhR9nSxrPd5yo M09n39KdfD1ePSbp1FJU47zT+YYyvFmB5+mqJW8hDLg3VxupN0vm3BxMM45LFVZb7h4Z mxt20pEoCLuiRP1LBHTQbBdpwXO2KFlb6Yqtdi5xK/8bK7Xw7B6b63gkUVQBlilAAwf4 o4ZexTYARVtO79AiwjyPimfRxDE1E/VLBtuUCt9W1i/VNLkU++pcxg4Erag7jy0DhTDt VpLQ== 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=u2uxI0v/7m/fIxRhq1Qvs1DQT/O1nranhbI4gLvPQ88=; b=ilMYLzbD9I/7iLaBGjyXLygr46D0fZV0fe2w7DHyWe/auOod0xfh8vH/jLqna9vwVK DjGAwmv10XKMB5cADz4ZGDCPIqciQaYWxFZ8p7eP02r7kDrembicI9HMa8jeEJB9HwyZ uMbpwikekT48+vYT8ewKS3hko6imOPqVYmdr0R4uRLx7qHCPZvkzEy0jAXLRhs3hopL2 mVEGDEgESpZ1BJ8dbnnyDplQ4ibNYKNuu0RZb5WyAQwJxpgA9H9W0QNCbrfFVXD8ZoYF YnxoLb3m/fzNfey9n7mwH7+MZVaL/vYAtmscgh0NkOr86pAlqmWjtmakPwfC32mbkrvO 1qpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ADxl226i; 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 k8si6550935ejg.191.2021.01.11.06.08.58; Mon, 11 Jan 2021 06:09:29 -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=ADxl226i; 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 S1728899AbhAKOFt (ORCPT + 99 others); Mon, 11 Jan 2021 09:05:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:50872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730086AbhAKNEA (ORCPT ); Mon, 11 Jan 2021 08:04:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DD1E22BEF; Mon, 11 Jan 2021 13:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370189; bh=pvktK5twh1eD4hu/UnoolytctEESt00y1DIetfJD+fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADxl226iDAykrKg0Qdh/lpVx9NET5lGgq8fFUyKN5dh3nn7pX213DbOPF0wQhYB4d IBWVwFPe7bMN2SPHKQmGUlK1udOtC0a5HUMLgKP1zTJzWslNjtZwza+97ADcKli8Xs JbblHjgwuwiFfFY454qtIDwgsLrK6TsO6m29n1jM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rasmus Villemoes , Jakub Kicinski Subject: [PATCH 4.9 05/45] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() Date: Mon, 11 Jan 2021 14:00:43 +0100 Message-Id: <20210111130033.943663385@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130033.676306636@linuxfoundation.org> References: <20210111130033.676306636@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 @@ -3939,12 +3939,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; }