lkml.org 
[lkml]   [2008]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] vfs: use kstrdup()
[Al Viro - Mon, Jul 21, 2008 at 09:28:57AM +0100]
| On Mon, Jul 21, 2008 at 12:04:27PM +0400, Cyrill Gorcunov wrote:
| > err = mnt_alloc_id(mnt);
| > - if (err) {
| > - kmem_cache_free(mnt_cache, mnt);
| > - return NULL;
| > + if (err)
| > + goto err;
|
| Ugh... Labels are in a separate namespace, but really...
|
| > + if (name) {
| > + mnt->mnt_devname = kstrdup(name, GFP_KERNEL);
| > + if (!mnt->mnt_devname)
| > + goto err;
|
| > +err:
| > + kmem_cache_free(mnt_cache, mnt);
| > + return NULL;
|
| Leak; note the mnt_alloc_id() above. Either do that kstrdup() first and
| kfree the result on mnt_alloc_id() failure or do mnt_free_id() on kstrdup()
| one...
|

oh my, that stupid from my side - will update shortly

- Cyrill -


\
 
 \ /
  Last update: 2008-07-21 10:37    [W:1.455 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site