Re: [CFT][PATCH] ucounts: Fix signal ucount refcounting

From: Eric W. Biederman
Date: Mon Oct 18 2021 - 11:42:18 EST


Yu Zhao <yuzhao@xxxxxxxxxx> writes:

> On Sat, Oct 16, 2021 at 11:35 AM Eric W. Biederman
> <ebiederm@xxxxxxxxxxxx> wrote:
>>
>> Alexey Gladkov <legion@xxxxxxxxxx> writes:
>>
>> > On Fri, Oct 15, 2021 at 05:10:58PM -0500, Eric W. Biederman wrote:
>> >> + goto dec_unwind;
>> >> + }
>> >> + return ret;
>> >> +dec_unwind:
>> >> + dec = atomic_long_add_return(1, &iter->ucount[type]);
>> >
>> > Should be -1 ?
>>
>> Yes it should. I will fix and resend.
>
> Or just atomic_long_dec_return().

It would have to be atomic_long_sub_return().

Even then I would want to change all of kernel/ucount.c to use
the same helper function so discrepancies can easily be spotted.

It is a good idea, just not I think for this particular patch.

Eric