Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2023723imu; Fri, 14 Dec 2018 04:40:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/WXbT765soWpombe2zM6Nw5xWX0/PTD2Bfh3FLEZ91bxIDuQPYCvJc+cGW/oRAOUNBYe6Y6 X-Received: by 2002:a62:6b85:: with SMTP id g127mr2842564pfc.42.1544791235644; Fri, 14 Dec 2018 04:40:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544791235; cv=none; d=google.com; s=arc-20160816; b=tADg5pH9Cm6ZPXPuDffLbEzYU2nEi7WK/ocS2ISbP+EU43ln8zki+Jywltt9U0ZMok QliiCt2Uj02InbelvcLmCh/Jhyoq4ITD2MKmMeYD+7Fk/zuyNpAE2cm7dfJsmrL6Qi8d lL+M7kL1GLKAHww8iauRTc42eU9aNLUVOcXWPiwAYkTdjNNb0lkqjoIS0SQ0auZZ3sqA /yRjmrhVIpfbZvvQcCasoYwlusqmV1Cog8vXO9iayZA6Qh94XJwQEVPIBr9X4k0v9/e9 xzOjie68Y8P/RNYiw32ayyn7dzBf/H507zavbQhSmB90QenhBJgzmmonviRy1kJVlQee 37Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+IIpyy80BY7/Ur0U2tZsJBIRFsTxAyBYc/A1rQUtvww=; b=AZ3EiGVrZrCkoSGw5K5d5GlC05zyPHn8sD6zRCgdKf+7WJ7U/P1QDhX81v+WqBp/JS bIpPfBWRSb1CWTFxCUn+Y3kPAm5vhJE41CAgq+/vkQnBwmO2Uc5S8VePjkLs8SFcpwX3 p/8qGFWoH3Yo95P+BZESAF+PKLJGcJ9Zixem+xhRs/TVLCHH+Q2I2H9Xn8wGAfQL2QLA CiLOPJu0ZtfdlX16k2bd3jEWF0UeoNxboYlh1L83+VIDqu65gikRj0MUokIQl3bfJ8+d y5oxufmoyIAxmBynxk+oUPCOToy6GeZnspZm+sT+cP43gE4G5Hbd/5tal5B1wPRxkB0P sXbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jm4aOWpT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3961671plz.233.2018.12.14.04.40.21; Fri, 14 Dec 2018 04:40:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jm4aOWpT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730756AbeLNMFl (ORCPT + 99 others); Fri, 14 Dec 2018 07:05:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:50498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbeLNMFj (ORCPT ); Fri, 14 Dec 2018 07:05:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0AB0E21479; Fri, 14 Dec 2018 12:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789138; bh=rreMxHsbuAgGyciKzb8/ZB7dJskN29t4BmNNZYJCWAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jm4aOWpTPW7HhleG569matkkRaA8sJEtbq4xD1fFJlBwZBY0sFbYzrxvqI+oj7/aC aNSZiX1Pnp6Cx/kOxJt53s9EbLI1VuHPVQ7/DAKAKNuIevqOzONAdx6LI9WVdm/4Vb YcUm76gPyYiPhkXro5dEytYutFN+7RDRulPIJ6bo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 109/142] net: hisilicon: remove unexpected free_netdev Date: Fri, 14 Dec 2018 12:59:54 +0100 Message-Id: <20181214115751.407900304@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit c758940158bf29fe14e9d0f89d5848f227b48134 ] The net device ndev is freed via free_netdev when failing to register the device. The control flow then jumps to the error handling code block. ndev is used and freed again. Resulting in a use-after-free bug. Signed-off-by: Pan Bian Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c index 14374a856d30..6127697ede12 100644 --- a/drivers/net/ethernet/hisilicon/hip04_eth.c +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c @@ -914,10 +914,8 @@ static int hip04_mac_probe(struct platform_device *pdev) } ret = register_netdev(ndev); - if (ret) { - free_netdev(ndev); + if (ret) goto alloc_fail; - } return 0; -- 2.19.1