Re: [PATCH v12 2/3] ipc: Conserve sequence numbers in ipcmni_extend mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/16/2019 02:52 PM, Manfred Spraul wrote:
> Hi,
>
> On 2/28/19 7:47 PM, Waiman Long wrote:
>> @@ -216,10 +221,11 @@ static inline int ipc_idr_alloc(struct ipc_ids
>> *ids, struct kern_ipc_perm *new)
>>        */
>>         if (next_id < 0) { /* !CHECKPOINT_RESTORE or next_id is unset */
>> -        new->seq = ids->seq++;
>> -        if (ids->seq > IPCID_SEQ_MAX)
>> -            ids->seq = 0;
>>           idx = idr_alloc(&ids->ipcs_idr, new, 0, 0, GFP_NOWAIT);
>> +        if ((idx <= ids->last_idx) && (++ids->seq > IPCID_SEQ_MAX))
>> +            ids->seq = 0;
>
> I'm always impressed by such lines:
>
> Everything in just two lines, use "++a", etc.
>
> But: How did you test it?
>
> idr_alloc() can fail, the code doesn't handle that :-(
>
>

You are right. I should have checked for the error case.

Thanks for spotting that.

Cheers,
Longman




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux