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


Groups > linux.kernel > #1508136

Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check in IOCTL path

From Hannes Reinecke <hare@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check in IOCTL path
Date 2016-10-25 12:00 +0200
Message-ID <sw6Gt-3S0-7@gated-at.bofh.it> (permalink)
References <sukDU-7vO-15@gated-at.bofh.it> <sukDU-7vO-23@gated-at.bofh.it> <svOJz-qi-5@gated-at.bofh.it> <sw63L-3ER-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/25/2016 11:19 AM, Suganath Prabu Subramani wrote:
> Hi Hannes,
> 
> Please give us little more info on the third comment. It ll help us to
> understand better and
> incorporate required changes.
> 
> Comment is  "Why don't you need to check for the size of the bitmap here?"
> 
> i have taken care of other two comments in this patch.
> 
>>       /* check if device is present */
>> @@ -5467,6 +5482,7 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num,
>>         sas_device = mpt3sas_get_sdev_by_addr(ioc,
>>                                         sas_address);
>>         if (sas_device) {
>> +               clear_bit(handle, ioc->pend_os_device_add);
>>                 sas_device_put(sas_device);
>>                 return -1;
>>         }
> 
> Why don't you need to check for the size of the bitmap here?
> 
> 
Thing is, you are using 'ioc->pend_os_device_add' as a bitmap to track
which devices to add.
Which in turn means that the overall number of devices you _can_ add is
restricted by the size of the bitmap.
But as you're adding devices you (might) increase the number of devices,
potentially overflowing the bitmap.
Hence the question: is it possible that you can add _more_ devices than
the bitmap can hold?
Or, to put it the other way round: Why don't you need to check the size
of the bitmap to avoid accessing an invalid bit beyond the end of the mask?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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


Thread

[PATCH 03/10] mpt3sas: Implement device_remove_in_progress check in  IOCTL path Suganath Prabu S <suganath-prabu.subramani@broadcom.com> - 2016-10-20 14:30 +0200
  Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check  in IOCTL path Hannes Reinecke <hare@suse.de> - 2016-10-24 16:50 +0200
    Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check  in IOCTL path Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> - 2016-10-25 11:20 +0200
      Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check  in IOCTL path Hannes Reinecke <hare@suse.de> - 2016-10-25 12:00 +0200
        Re: [PATCH 03/10] mpt3sas: Implement device_remove_in_progress check  in IOCTL path Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com> - 2016-10-25 12:40 +0200

csiph-web