[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2024092637-unthawed-vending-c39b@gregkh>
Date: Thu, 26 Sep 2024 10:17:39 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: cuigaosheng <cuigaosheng1@...wei.com>
Cc: rafael@...nel.org, akpm@...ux-foundation.org,
thunder.leizhen@...wei.com, wangweiyang2@...wei.com,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH -next 1/2] kobject: fix memory leak in kset_register()
due to uninitialized kset->kobj.ktype
On Thu, Sep 26, 2024 at 10:56:24AM +0800, cuigaosheng wrote:
> On 2024/9/25 20:19, Greg KH wrote:
>
> > On Wed, Sep 25, 2024 at 08:07:46PM +0800, Gaosheng Cui wrote:
> > > If a kset with uninitialized kset->kobj.ktype be registered,
> > Does that happen today with any in-kernel code? If so, let's fix those
> > kset instances, right?
>
> I didn't find this kset instance in kernel code,itwas discovered through code review.
Great, then it is not a real issue :)
> > > kset_register() will return error, and the kset.kobj.name allocated
> > > by kobject_set_name() will be leaked.
> > >
> > > To mitigate this, we free the name in kset_register() when an error
> > > is encountered due to uninitialized kset->kobj.ktype.
> > How did you hit this?
>
> I am testing kernel functionality through fault injection, and I discovered
> it whenI was locating the issue fixed by another patch, I haven't found this
> wrong usage in the kernel, but we can construct it by fault injection,
"fault injection" also shows things that are impossible to ever have
happen as well, so our "need" to fix them is usually very low, right?
thanks,
greg k-h
Powered by blists - more mailing lists