Search Linux Wireless

Re: [PATCH] net/fq_impl: Switch to kvmalloc() for memory allocation

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

 



Johannes Berg <johannes@xxxxxxxxxxxxxxxx> writes:

> On Tue, 2019-11-05 at 16:49 +0100, Toke Høiland-Jørgensen wrote:
>> The FQ implementation used by mac80211 allocates memory using kmalloc(),
>> which can fail; and Johannes reported that this actually happens in
>> practice.
>> 
>> To avoid this, switch the allocation to kvmalloc() instead; this also
>> brings fq_impl in line with all the FQ qdiscs.
>> 
>> Fixes: 557fc4a09803 ("fq: add fair queuing framework")
>> Reported-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx>
>> ---
>>  include/net/fq_impl.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h
>> index 107c0d700ed6..d3873db91c71 100644
>> --- a/include/net/fq_impl.h
>> +++ b/include/net/fq_impl.h
>> @@ -313,7 +313,7 @@ static int fq_init(struct fq *fq, int flows_cnt)
>>  	fq->limit = 8192;
>>  	fq->memory_limit = 16 << 20; /* 16 MBytes */
>>  
>> -	fq->flows = kcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
>> +	fq->flows = kvcalloc(fq->flows_cnt, sizeof(fq->flows[0]), GFP_KERNEL);
>
> You need a corresponding kvfree(), no?

Oh, right, of course; silly me. Guess I was a bit too trigger-happy on
the nice one-character patch ;)

Will send a v2

-Toke





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux