Re: [PATCH] RDMA/restrack: Fix potential invalid address access

From: Leon Romanovsky
Date: Sun Mar 10 2024 - 05:25:06 EST


On Thu, Mar 07, 2024 at 10:17:59PM +0800, Wenchao Hao wrote:
> On 2024/3/7 17:13, Leon Romanovsky wrote:
> > On Fri, Mar 01, 2024 at 05:55:15PM +0800, Wenchao Hao wrote:
> > > struct rdma_restrack_entry's kern_name was set to KBUILD_MODNAME
> > > in ib_create_cq(), while if the module exited but forgot del this
> > > rdma_restrack_entry, it would cause a invalid address access in
> > > rdma_restrack_clean() when print the owner of this rdma_restrack_entry.
> > >
> > > Fix this issue by using kstrdup() to set rdma_restrack_entry's
> > > kern_name.
> >
> > I don't like kstrdup() and would like to avoid it, this rdma_restrack_clean()
> > is purely for debugging and for a long time all upstream ULPs are "clean"
> > from these not-released bugs.
> >
> > So my suggestion is to delete that part of code and it will be good enough.
> >
>
> It's OK for me. When found this issue, my first plan is to remove the code, but
> I do not know why these code is added, so decide to using kstrdup() to work around
> it.

This code helped us to find one forgotten PD release in one of the ULPs. But it is not needed anymore.

>
> Then what to do next? Do I need to post another patch or you would fix it by yourself?

Please send new patch, thanks.