[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2024101539-ravage-talon-d70c@gregkh>
Date: Tue, 15 Oct 2024 08:54:54 +0200
From: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
To: Ryder Wang <rydercoding@...mail.com>
Cc: Chenyuan Yang <chenyuan0y@...il.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"richard@....at" <richard@....at>,
"miquel.raynal@...tlin.com" <miquel.raynal@...tlin.com>,
Zhihao Cheng <chengzhihao1@...wei.com>,
"vigneshr@...com" <vigneshr@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"syzkaller@...glegroups.com" <syzkaller@...glegroups.com>,
Zijie Zhao <zzjas98@...il.com>,
"rafael@...nel.org" <rafael@...nel.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [Linux Kernel Bug] memory leak in ubi_attach
On Tue, Oct 15, 2024 at 03:41:24AM +0000, Ryder Wang wrote:
> By walking through all the related code, it looks to be a bug in slub.c rather than kobject or ubifs.
>
> sysfs_slab_add() calls kobject_init_and_add():
> - If kobject_init_and_add fails, sysfs_slab_add() will go to *out*. But unluckily, *out* code block will never release s->kobj, but it is expected to do so.
>
> Below is the function comment of kobject_init_and_add():
> * If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. *
> ==> It means sysfs_slab_add() shall release the related kobject.
Yup, that's a bug, please send a patch to fix this!
thanks,
greg k-h
Powered by blists - more mailing lists