Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536324

Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild

From Netanel Belgazal <netanel@annapurnalabs.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild
Date 2016-12-05 19:40 +0100
Message-ID <sL6lb-87B-9@gated-at.bofh.it> (permalink)
References <sKF1D-7FZ-3@gated-at.bofh.it> <sKF1E-7FZ-33@gated-at.bofh.it> <sKTei-88v-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 12/05/2016 06:29 AM, Matt Wilson wrote:
> On Sun, Dec 04, 2016 at 03:19:24PM +0200, Netanel Belgazal wrote:
>> If for some reason the device stop responding and the device reset failed
>> to recover the device, the mmio register read datastructure will not be
>> reinitialized.
> If for some reason the device stops responding, and the device reset
> fails to recover the device, the MMIO register read data structure
> will not be reinitialized.

OK
>
>> On driver removal, the driver will also tries to reset the device
>> but this time the mmio data structure will be NULL.
> On driver removal, the driver will also try to reset the device, but
> this time the MMIO data structure will be NULL.
OK
>> To solve this issue perform the device reset in the remove function only if
>> the device is runnig.
> To solve this issue, perform the device reset in the remove function
> only if the device is running.
>
> Do you have an example of the NULL pointer dereference that you can
> paste in? It can be helpful for those searching for a fix for a bug
> they've experienced.
I'll add a crash dump.

> --msw
>
>> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
>> ---
>>   drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> index 224302c..ad5f78f 100644
>> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
>> @@ -2516,6 +2516,8 @@ static void ena_fw_reset_device(struct work_struct *work)
>>   err:
>>   	rtnl_unlock();
>>   
>> +	clear_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
>> +
>>   	dev_err(&pdev->dev,
>>   		"Reset attempt failed. Can not reset the device\n");
>>   }
>> @@ -3126,7 +3128,9 @@ static void ena_remove(struct pci_dev *pdev)
>>   
>>   	cancel_work_sync(&adapter->resume_io_task);
>>   
>> -	ena_com_dev_reset(ena_dev);
>> +	/* Reset the device only if the device is running. */
>> +	if (test_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags))
>> +		ena_com_dev_reset(ena_dev);
>>   
>>   	ena_free_mgmnt_irq(adapter);
>>   

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 08/20] net/ena: add hardware hints capability to the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 17/20] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 09/20] net/ena: fix potential access to freed memory during device reset Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 12/20] net/ena: reduce the severity of ena printouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 16/20] net/ena: use napi_schedule_irqoff when possible Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 11/20] net/ena: use READ_ONCE to access completion descriptors Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 14/20] net/ena: change condition for host attribute configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 07:00 +0100
      Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
        Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 20:00 +0100
  [PATCH V2 net 15/20] net/ena: change sizeof() argument to be the type pointer Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 01/20] net/ena: remove ntuple filter support from device feature list Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 01/20] net/ena: remove ntuple filter support from  device feature list Matt Wilson <msw@amzn.com> - 2016-12-05 05:10 +0100
  [PATCH V2 net 19/20] net/ena: restructure skb allocation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 David Miller <davem@davemloft.net> - 2016-12-05 03:50 +0100
    Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Matt Wilson <msw@amzn.com> - 2016-12-05 04:40 +0100

csiph-web