[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251105134659.GM1204670@ziepe.ca>
Date: Wed, 5 Nov 2025 09:46:59 -0400
From: Jason Gunthorpe <jgg@...pe.ca>
To: Leon Romanovsky <leon@...nel.org>
Cc: Ma Ke <make24@...as.ac.cn>, haris.iqbal@...os.com, jinpu.wang@...os.com,
danil.kipnis@...ud.ionos.com, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
stable@...r.kernel.org
Subject: Re: [PATCH] RDMA/rtrs: server: Fix error handling in
get_or_create_srv
On Wed, Nov 05, 2025 at 02:57:13PM +0200, Leon Romanovsky wrote:
> On Tue, Nov 04, 2025 at 10:19:00AM +0800, Ma Ke wrote:
> > get_or_create_srv() fails to call put_device() after
> > device_initialize() when memory allocation fails. This could cause
> > reference count leaks during error handling, preventing proper device
> > cleanup and resulting in memory leaks.
>
> Nothing from above is true. put_device is preferable way to release
> memory after call to device_initialize(), but direct call to kfree is
> also fine.
Once device_initialize() happens you must call put_device(), it is one
of Greg's rules.
Jason
Powered by blists - more mailing lists