[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080721082857.GB28946@ZenIV.linux.org.uk>
Date: Mon, 21 Jul 2008 09:28:57 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: Li Zefan <lizf@...fujitsu.com>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfs: use kstrdup()
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...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists