Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2281257pxb; Mon, 11 Jan 2021 05:59:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZzzmVaAjMUnazQ9ftpc06rWjfDtVNYNFDL27Ew6joZ/San6Wj/3dQyAHRd3VxkNkA+DdT X-Received: by 2002:a50:b246:: with SMTP id o64mr13535279edd.132.1610373597270; Mon, 11 Jan 2021 05:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610373597; cv=none; d=google.com; s=arc-20160816; b=Pmc3cO+hntHTt+5DAx82YSzEER9N3vZB+wNJy6Dx6DnT3CPs2z3OJfoQYrrzittDxB dkoWmBCRaihm6U1J08w9GNHI9FI2l/YUX9tyhhtrz9sAKEiLuUp1o0dWpzXUDoTg52ij awxRYSv/Y0EZ2bQwLV7tUULaBEBhC72359ne+D4GCQmj+hmvR9uPcS+/oxQJm9TruPpm eg1LQFOVamqYAA7mkcLvNwwIDSSRKJVuDQxXxcpNBzXUauT5SWPlMmRmy2VB4AY62gsF zfIpHyrVf/E844nfcsAo235H2Da9R6acxQ6v/AZAR7yt1aJhCyv9nmZDRzRi5GYfbVN4 OEig== 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=Oneeo9G17SBiCjqaD+rygbBB+rOGtYIE2qknpqOwB/s=; b=tLHAZjQOrQIMpcTV9xrlN1UQZAd/lVe9rfpR3wMtSoti0cbI8f/3B3oKma21dGNpkE SHnSamJXw7/ZGaLiGq5nv/LPBApcqUH0lEkze1/3bywq3j4YJn3HccGNihrdsuUSc+NV 8kwDbNPp3w1lGxk8IOC8DS+bjXztAbetg1mXgZgaMWuqM8EsMPTbo6lxr5NNo6G95Ljd LCvOj1d762qJPBDKsWhM3DvJq4z+AcQKOOoiB/AHp7Ge8WVT1t5GsLyIfSbB5c1Z43dR 7WME03Gw/bw5FK8N5yEyQ9QME+QgmI7IV+5YQ8vordkYeVDYGqn5P2P17coOYCyCjnwq ukcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uZHsZcfq; 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 f24si7282640edq.247.2021.01.11.05.59.32; Mon, 11 Jan 2021 05:59:57 -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=uZHsZcfq; 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 S1730991AbhAKN4v (ORCPT + 99 others); Mon, 11 Jan 2021 08:56:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:54288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730437AbhAKNHP (ORCPT ); Mon, 11 Jan 2021 08:07:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F27B22AAB; Mon, 11 Jan 2021 13:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370419; bh=D6CLflUG2o00D2RxO9E2QgxP/uHuqvdfAnb5fqv4eLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZHsZcfqhzt1ik/NBGzRURa5kltwBGYkVU/L9Z1LoPncTqas2Frlyc/ks1uHoMhCS X59q6cHSWBKusHGBwpBfJCmSeGWkidUBBkT2XRO8B8+Udfw50oQRpNrw6D9iA2HpMe OvKyEkCtnRMQXXgQeUPOMRXDvojhn9t1Hi9hre74= 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.19 14/77] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() Date: Mon, 11 Jan 2021 14:01:23 +0100 Message-Id: <20210111130037.103404477@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130036.414620026@linuxfoundation.org> References: <20210111130036.414620026@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 @@ -3947,12 +3947,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; }