From: "Sjur Brændeland" <sjurbren@gmail.com> To: Dan Carpenter <error27@gmail.com> Cc: "David S. Miller" <davem@davemloft.net>, "open list:CAIF NETWORK LAYER" <netdev@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [patch -next] caif: add error handling for allocation Date: Fri, 2 Sep 2011 11:40:23 +0200 [thread overview] Message-ID: <CAJK669Yb6V=xr9ZvQGOKGEvmzO1JGhrHD+sR69b04EQxUjOOrQ@mail.gmail.com> (raw) In-Reply-To: <20110902080716.GF2430@shale.localdomain> Hi Dan, ... > switch (phy_type) { > case CFPHYTYPE_FRAG: > phy_driver = > cfserl_create(CFPHYTYPE_FRAG, phyid, stx); > if (!phy_driver) > - goto out; > + goto out_err; > break; ... > -out: > + mutex_unlock(&cnfg->lock); > + return; > + > +out_err: > + kfree(phyinfo); > mutex_unlock(&cnfg->lock); Thank you for your patch. When reviewing this I found another potential memory leak as well. If cffrml_create fails, we might be leaking the phy_driver. So perhaps you could do kfree(phy_driver) in out_err: as well, while you are at it? Regards, Sjur
WARNING: multiple messages have this Message-ID (diff)
From: "Sjur Brændeland" <sjurbren@gmail.com> To: Dan Carpenter <error27@gmail.com> Cc: "David S. Miller" <davem@davemloft.net>, "open list:CAIF NETWORK LAYER" <netdev@vger.kernel.org>, kernel-janitors@vger.kernel.org Subject: Re: [patch -next] caif: add error handling for allocation Date: Fri, 02 Sep 2011 09:40:23 +0000 [thread overview] Message-ID: <CAJK669Yb6V=xr9ZvQGOKGEvmzO1JGhrHD+sR69b04EQxUjOOrQ@mail.gmail.com> (raw) In-Reply-To: <20110902080716.GF2430@shale.localdomain> [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 902 bytes --] Hi Dan, ... >     switch (phy_type) { >     case CFPHYTYPE_FRAG: >         phy_driver >           cfserl_create(CFPHYTYPE_FRAG, phyid, stx); >         if (!phy_driver) > -            goto out; > +            goto out_err; >         break; ... > -out: > +    mutex_unlock(&cnfg->lock); > +    return; > + > +out_err: > +    kfree(phyinfo); >     mutex_unlock(&cnfg->lock); Thank you for your patch. When reviewing this I found another potential memory leak as well. If cffrml_create fails, we might be leaking the phy_driver. So perhaps you could do kfree(phy_driver) in out_err: as well, while you are at it? Regards, Sjur ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¤z¹ÞøÚ+h®ÏâØ^nr¡ö¦zË\x1aëh¨èÚ&£ûàz¿äz¹Þú+Ê+zf£¢·h§~Ûiÿÿïêÿêçz_è®\x0fæj:+v¨þ)ߣøm
next prev parent reply other threads:[~2011-09-02 9:40 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-02 8:07 [patch -next] caif: add error handling for allocation Dan Carpenter 2011-09-02 8:07 ` Dan Carpenter 2011-09-02 9:40 ` Sjur Brændeland [this message] 2011-09-02 9:40 ` Sjur Brændeland 2011-09-02 12:19 ` [PATCH] caif: fix a potential NULL dereference Eric Dumazet 2011-09-02 13:13 ` Sjur Brændeland 2011-09-16 22:56 ` David Miller 2011-09-02 15:51 ` [patch -next] caif: add error handling for allocation Dan Carpenter 2011-09-02 15:51 ` Dan Carpenter 2011-09-21 7:21 ` [patch v2] " Dan Carpenter 2011-09-21 7:21 ` Dan Carpenter 2011-09-23 10:38 ` Sjur BRENDELAND 2011-09-23 10:38 ` Sjur BRENDELAND 2011-10-03 17:46 ` David Miller 2011-10-03 17:46 ` David Miller
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='CAJK669Yb6V=xr9ZvQGOKGEvmzO1JGhrHD+sR69b04EQxUjOOrQ@mail.gmail.com' \ --to=sjurbren@gmail.com \ --cc=davem@davemloft.net \ --cc=error27@gmail.com \ --cc=kernel-janitors@vger.kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.