[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20160727.010719.1596635131969198811.davem@davemloft.net>
Date: Wed, 27 Jul 2016 01:07:19 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: sathya.perla@...adcom.com
Cc: netdev@...r.kernel.org
Subject: Re: [net-next PATCH 4/4] be2net: replace polling with sleeping in
the FW completion path
From: Sathya Perla <sathya.perla@...adcom.com>
Date: Wed, 27 Jul 2016 13:33:19 +0530
>> -----Original Message-----
>> From: Sathya Perla [mailto:sathya.perla@...adcom.com]
>> > >
>> > > > @@ -4477,6 +4551,22 @@ static int be_if_create(struct be_adapter
>> > *adapter)
>> > > > u32 cap_flags = be_if_cap_flags(adapter);
>> > > > int status;
>> > > >
>> > > > + /* alloc required memory for other filtering fields */
>> > > > + adapter->pmac_id = kcalloc(be_max_uc(adapter),
>> > > > + sizeof(*adapter->pmac_id), GFP_KERNEL);
>> > > > + if (!adapter->pmac_id)
>> > > > + return -ENOMEM;
>> > > > +
>> > > > + adapter->mc_list = kcalloc(be_max_mc(adapter),
>> > > > + sizeof(*adapter->mc_list), GFP_KERNEL);
>> > > > + if (!adapter->mc_list)
>> > > > + return -ENOMEM;
>> > > > +
>> > > > + adapter->uc_list = kcalloc(be_max_uc(adapter),
>> > > > + sizeof(*adapter->uc_list), GFP_KERNEL);
>> > > > + if (!adapter->uc_list)
>> > > > + return -ENOMEM;
>> > >
>> > > These error paths are leaking memory, please audit this in the rest
>> > > of
>> > your change as well.
>> >
>> > David, thanks for catching this; will fix this (and others if any) and
>> > send out a v2.
>>
>> David, actually, when be_if_create() returns an error, it falls back into
>> the error path of
>> be_setup() (the caller) and be_clear() is called. be_clear() calls
>> be_if_destroy() which frees the allocated memory.
>> So, this code will not leak memory in the error path.
>
> David, can you accept the v1 patch set as-is, as it doesn't have the memory
> leaks that you suspected initially?
Please resubmit, thanks.
Powered by blists - more mailing lists