Re: [PATCH] net/rds: Avoid potential use after free in rds_send_remove_from_sock

From: Leon Romanovsky
Date: Tue Apr 20 2021 - 05:11:52 EST


On Tue, Apr 20, 2021 at 12:09:06PM +0300, Leon Romanovsky wrote:
> On Tue, Apr 06, 2021 at 07:09:12PM -0500, Aditya Pakki wrote:
> > In case of rs failure in rds_send_remove_from_sock(), the 'rm' resource
> > is freed and later under spinlock, causing potential use-after-free.
> > Set the free pointer to NULL to avoid undefined behavior.
> >
> > Signed-off-by: Aditya Pakki <pakki001@xxxxxxx>
> > ---
> > net/rds/message.c | 1 +
> > net/rds/send.c | 2 +-
> > 2 files changed, 2 insertions(+), 1 deletion(-)
>
> Dave, Jakub
>
> Please revert this patch, given responses from Eric and Al together
> with this response from Greg here https://lore.kernel.org/lkml/YH5/i7OvsjSmqADv@xxxxxxxxx

https://lore.kernel.org/lkml/YH5%2Fi7OvsjSmqADv@xxxxxxxxx/

>
> BTW, I looked on the rds code too and agree with Eric, this patch
> is a total garbage.
>
> Thanks