lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be5ba555-31bb-8803-66fa-51bfab70bde8@huawei.com>
Date:   Thu, 25 Apr 2019 14:06:07 +0800
From:   tanhuazhong <tanhuazhong@...wei.com>
To:     Neil Horman <nhorman@...hat.com>
CC:     <davem@...emloft.net>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <salil.mehta@...wei.com>,
        <yisen.zhuang@...wei.com>, <linuxarm@...wei.com>,
        Peng Li <lipeng321@...wei.com>
Subject: Re: [PATCH V2 net-next 08/12] net: hns3: stop schedule reset service
 while unloading driver



On 2019/4/24 21:55, Neil Horman wrote:
> On Wed, Apr 24, 2019 at 07:05:27PM +0800, Huazhong Tan wrote:
>> This patch uses HCLGE_STATE_REMOVING/HCLGEVF_STATE_REMOVING flag to
>> indicate that the driver is unloading, and we should stop new coming
>> reset service to be scheduled, otherwise, reset service will access
>> some resource which has been freed by unloading.
>>
>> Signed-off-by: Huazhong Tan <tanhuazhong@...wei.com>
>> Signed-off-by: Peng Li <lipeng321@...wei.com>
>> ---
>> V1->V2: fixes a flag setting error
>> ---
>>   drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c   | 4 +++-
>>   drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +++-
>>   drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 1 +
>>   3 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> index 4d5568e..ead8308 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> @@ -2175,7 +2175,8 @@ static void hclge_mbx_task_schedule(struct hclge_dev *hdev)
>>   
>>   static void hclge_reset_task_schedule(struct hclge_dev *hdev)
>>   {
>> -	if (!test_and_set_bit(HCLGE_STATE_RST_SERVICE_SCHED, &hdev->state))
>> +	if (!test_bit(HCLGE_STATE_REMOVING, &hdev->state) &&
>> +	    !test_and_set_bit(HCLGE_STATE_RST_SERVICE_SCHED, &hdev->state))
>>   		schedule_work(&hdev->rst_service_task);
>>   }
>>   
> 
> In what use case do you need an extra bit for this?  From my read, this work
> task only gets scheduled from:
> 1) Interrupt handlers
> 2) Its own service task
> 
> Based on the fact that you are calling cancel_work_sync(...rst_service_task)
> from the pci teardown routine, irqs should all be disabled on your devices
> already (meaning interrupts shouldn't schedule it), and cancel_work_sync
> guarantees that rearming cant happen from within its own service task.
> 
> Neil
>

Beside these two cases, when the client detects an error and requests a 
reset, it will call hclge_reset_event and schedule the reset work task 
to deal with the request. This may happen after calling 
cancel_work_sync(...rst_service_task) from the pci teardown routine.

Best Regards, Huazhong

> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ