lkml.org 
[lkml]   [2021]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] net/rds: Fix a use after free in rds_message_map_pages
From
From: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Date: Tue, 30 Mar 2021 03:16:02 -0700

> @@ -348,7 +348,7 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
> rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs);
> if (IS_ERR(rm->data.op_sg)) {
> rds_message_put(rm);
> - return ERR_CAST(rm->data.op_sg);
> + return ERR_PTR(-ENOMEM);
> }
>
> for (i = 0; i < rm->data.op_nents; ++i) {

Maybe instead do:

int err = ERR_CAST(rm->data.op_sg);
rds_message_put(rm);
return err;

Then if rds_message_alloc_sgs() starts to return other errors, they will propagate.

Thank you.

\
 
 \ /
  Last update: 2021-03-31 02:04    [W:0.026 / U:2.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site