Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2672342pxb; Mon, 11 Jan 2021 16:45:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmyjRtfrUnF8rYxegVNottfPvuuuEjgc+S2+qWin5gutG2w2Vk92vq0rG6VaU8PEf5c/Bq X-Received: by 2002:aa7:cb42:: with SMTP id w2mr83572edt.21.1610412354198; Mon, 11 Jan 2021 16:45:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610412354; cv=none; d=google.com; s=arc-20160816; b=gbzZ0K9tnmavTNgP6yKhcbvE5sRcQ65uX0Pb4xDIkBQa6587Wxoj8ZzwC0atiTAynn 0JXOSlPcGKPeIws8ovomyovr1eHqiebjFKiI6r0m/1nJLHTSexSadZKxenkgLQT9WMTn rwJCT0iC57YSETGlj5HfWAUITL6EiiXYnXjsRtZ43FgD37SSh/t1Nvm75kmd063NNwbY 8Ox5vlW7cOzBVBXIp51w3EdInq7VayHAd926elLsvkvxFoYUePH7NjqERgzohtbA4+Oh NHVMBrN0au8idQsyc0Oml46mFWNqqfj3YDd/RDE12UNrkYPrLYMUP+vUIvlLkP9FQGu4 0bwg== 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=cbmh94xvdForoHbqkSi1jBRQmyJu0rTduqQks1H44Qs=; b=NkEf3OIhmenKaiM+CjR4wKEL3p+O1duYv3Hata/SdNiSYmSCadnZdm2CnDmnV3CLvE PvzQEirXKMdZCsqUUTmdvS9VmEEVVjU6s/vK5CB9nUWq91VcN9Ns6O8JDBdYmPlA8QCk A6Cd7BxzlVyopzVmn/OujEhdwBKo9BT+PTeI++yLj2cHi9foLvmgKKflhmZ5AWduw2z2 0s9uPboRLHtmlyfaAnxqVB/klz3dQFMAT0A1v+rgghLu1N+vdkCIqzljh3qDn3CGX4l9 x0NNoCxGSw/gTrChwlOiw9tSI+u07VkCW3f6Q5NoeVneoJXl4pfVJEjc06w/XpsNeWWx KPeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tbeZBM09; 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 x17si609381edq.154.2021.01.11.16.45.29; Mon, 11 Jan 2021 16:45:54 -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=tbeZBM09; 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 S1728028AbhAKNBU (ORCPT + 99 others); Mon, 11 Jan 2021 08:01:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbhAKNBU (ORCPT ); Mon, 11 Jan 2021 08:01:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D98492253A; Mon, 11 Jan 2021 13:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370016; bh=F4ZPefPJpbj2ZBdsZA7UoVUvMOexsWORvGNt+yHtzIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbeZBM09m6rco/HfWaUvcsEYjjeeoOgR3m9MFbDvj5OYlqCcg2IT49AB3eE+h2Aiz lVkrDCsEtSFTo5idUmSgxR3mKMkQtZKYDaMnLcRuudP8TV0vqNQL2Ypy6jt4ra0Uvw TLRRcHPvzPXbBGCpI9Ku4V/14G35ie5Rb634CASc= 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.4 14/38] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove() Date: Mon, 11 Jan 2021 14:00:46 +0100 Message-Id: <20210111130033.153153905@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130032.469630231@linuxfoundation.org> References: <20210111130032.469630231@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 @@ -3934,10 +3934,10 @@ static int ucc_geth_remove(struct platfo struct ucc_geth_private *ugeth = netdev_priv(dev); unregister_netdev(dev); - free_netdev(dev); ucc_geth_memclean(ugeth); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); + free_netdev(dev); return 0; }