From: Sathya Perla <sathya.perla@broadcom.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: RE: [net-next PATCH 4/4] be2net: replace polling with sleeping in the FW completion path
Date: Wed, 27 Jul 2016 13:33:19 +0530 [thread overview]
Message-ID: <105bbdcd07774b849f1636904db3e8f6@mail.gmail.com> (raw)
In-Reply-To: <afdbd734835da306de6859a1495c87d6@mail.gmail.com>
> -----Original Message-----
> From: Sathya Perla [mailto:sathya.perla@broadcom.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?
thanks,
-Sathya
next prev parent reply other threads:[~2016-07-27 8:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 10:55 [net-next PATCH 0/4] be2net: patch set Sathya Perla
2016-07-22 10:55 ` [net-next PATCH 1/4] be2net: clear vlan-promisc setting before programming the vlan list Sathya Perla
2016-07-22 10:55 ` [net-next PATCH 2/4] be2net: do not remove vids from driver table if be_vid_config() fails Sathya Perla
2016-07-22 10:55 ` [net-next PATCH 3/4] be2net: Avoid unnecessary firmware updates of multicast list Sathya Perla
2016-07-22 10:55 ` [net-next PATCH 4/4] be2net: replace polling with sleeping in the FW completion path Sathya Perla
2016-07-25 17:51 ` David Miller
2016-07-26 7:18 ` Sathya Perla
2016-07-26 8:10 ` Sathya Perla
2016-07-27 8:03 ` Sathya Perla [this message]
2016-07-27 8:07 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2016-07-27 9:26 [net-next PATCH 0/4] be2net: patch set Sathya Perla
2016-07-27 9:26 ` [net-next PATCH 4/4] be2net: replace polling with sleeping in the FW completion path Sathya Perla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=105bbdcd07774b849f1636904db3e8f6@mail.gmail.com \
--to=sathya.perla@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).