Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9928033ybi; Wed, 24 Jul 2019 12:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxj3VBcyuwiEypFkTd734OtCTUrCridBy8thyLkMC1OVx+QAswSnCl3ZaGQyiiV9EbyGOnn X-Received: by 2002:a17:902:8205:: with SMTP id x5mr88695407pln.279.1563996568414; Wed, 24 Jul 2019 12:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996568; cv=none; d=google.com; s=arc-20160816; b=SSRb1rjH3y+HW4zxBmh2KZRNdFGZCXt1hXAHU7bLZWeXI0G5bxQ2vtsY6jxsRcb2bI 0X6qW8vAaNyQHwiZ4X5sjzEBpyKxTUeERi2Sl/cHA6CSCrKRPnjv8bEHhCUBR+UihSaC Zu8Y6GjsOWtxuo8XgW8W+BGxOU0Hd8mMSG4E9uK2/xHlWo/1KDlkng2mysbBEfCCJ27L KulUWadKGKWMO74NnnwKfGwoe/mNE7AnAlxr8Q6KkCZ4bDJKrMhb94tkFkaEEMwF25Q1 gDWqN8TVWdv8FMgeYtl2H6p3BlHYzyvskPcjFfdQBff0ed2kOczeFnNbgAFhoCnXKpqM ojpw== 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=9lfHbttC8Jc32UrLa/woaITSRzd3+TiPfxISsEP9klM=; b=u5mk4056l57g5GrYhTn50ZlA3GYoi1uSGvyuZhdR3W8GWTpTu6RhvvLDcbvt2w95lG mGRrcmJhvS62ttl4bLc1KI/Jj0N6lVfX4Lg5JZGwvl3hgS/jjuK1otX9F3Mt0uxXc3Yc PCHLzf0wLJTBmxfLj8OILO29J4Vj7Df0NGz0ICWHnUZYbpcJKRbX0mJQ2jeTAT7MyZUN FjWn/yc+0QI9EBxzI33hmzYHG6IF7E6vfjDVgWuVHtrpao0VhvViaA4eg5coWRn5eyhI vFp2ElWFYXm8aHorar+R7ktZeXqaLDfWUSYh2pwlYVOHANGeUeszNbAYJ8ioc5XzwOs/ xMtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F7WElPsF; 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 200si14876741pfy.101.2019.07.24.12.29.14; Wed, 24 Jul 2019 12:29:28 -0700 (PDT) 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=F7WElPsF; 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 S1729197AbfGXTZr (ORCPT + 99 others); Wed, 24 Jul 2019 15:25:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:42562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbfGXTZn (ORCPT ); Wed, 24 Jul 2019 15:25:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 2DADB218F0; Wed, 24 Jul 2019 19:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996342; bh=fw0wvUTuomp5nvFm8q/m7DfHxdR4geJp3N56qtnQP8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7WElPsFgDXOHr4SrZCKz9uwpjYaJU6PunAmIJo8+w8O4TMwMKObAEwLwNJpz77o1 6OBfExIEc04QEVfgjJBMEr9hjqF+oNmup0a10qNGJ3unHhKkNRafmgjNTWvyTOCHty a01rYLSuj5aAnA80SRXNaYPNImrXdFFC7ZeDE2i0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weihang Li , Peng Li , Huazhong Tan , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 062/413] net: hns3: set ops to null when unregister ad_dev Date: Wed, 24 Jul 2019 21:15:53 +0200 Message-Id: <20190724191739.696773486@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 594a81b39525f0a17e92c2e0b167ae1400650380 ] The hclge/hclgevf and hns3 module can be unloaded independently, when hclge/hclgevf unloaded firstly, the ops of ae_dev should be set to NULL, otherwise it will cause an use-after-free problem. Fixes: 38caee9d3ee8 ("net: hns3: Add support of the HNAE3 framework") Signed-off-by: Weihang Li Signed-off-by: Peng Li Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hnae3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c index fa8b8506b120..738e01393b68 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c @@ -251,6 +251,7 @@ void hnae3_unregister_ae_algo(struct hnae3_ae_algo *ae_algo) ae_algo->ops->uninit_ae_dev(ae_dev); hnae3_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0); + ae_dev->ops = NULL; } list_del(&ae_algo->node); @@ -351,6 +352,7 @@ void hnae3_unregister_ae_dev(struct hnae3_ae_dev *ae_dev) ae_algo->ops->uninit_ae_dev(ae_dev); hnae3_set_bit(ae_dev->flag, HNAE3_DEV_INITED_B, 0); + ae_dev->ops = NULL; } list_del(&ae_dev->node); -- 2.20.1