From: lyl2019@mail.ustc.edu.cn
To: "Lv Yunlong" <lyl2019@mail.ustc.edu.cn>
Cc: santosh.shilimkar@oracle.com, davem@davemloft.net,
kuba@kernel.org, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/rds: Fix a use after free in rds_message_map_pages
Date: Fri, 19 Mar 2021 10:25:05 +0800 (GMT+08:00) [thread overview]
Message-ID: <22401612.2e0b.178484cf3b6.Coremail.lyl2019@mail.ustc.edu.cn> (raw)
In-Reply-To: <20210311084616.12356-1-lyl2019@mail.ustc.edu.cn>
Just as a reminder,
there has been no reply to this message for more than a week.
Could someone help to fix this issue?
> -----原始邮件-----
> 发件人: "Lv Yunlong" <lyl2019@mail.ustc.edu.cn>
> 发送时间: 2021-03-11 16:46:16 (星期四)
> 收件人: santosh.shilimkar@oracle.com, davem@davemloft.net, kuba@kernel.org
> 抄送: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org, "Lv Yunlong" <lyl2019@mail.ustc.edu.cn>
> 主题: [PATCH] net/rds: Fix a use after free in rds_message_map_pages
>
> In rds_message_map_pages, rds_message_put() will free rm.
> Maybe store the value of rm->data.op_sg ahead of rds_message_put()
> is better. Otherwise other threads could allocate the freed chunk
> and may change the value of rm->data.op_sg.
>
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
> ---
> net/rds/message.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/rds/message.c b/net/rds/message.c
> index 071a261fdaab..392e3a2f41a0 100644
> --- a/net/rds/message.c
> +++ b/net/rds/message.c
> @@ -347,8 +347,9 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
> rm->data.op_nents = DIV_ROUND_UP(total_len, PAGE_SIZE);
> rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs);
> if (IS_ERR(rm->data.op_sg)) {
> + struct scatterlist *tmp = rm->data.op_sg;
> rds_message_put(rm);
> - return ERR_CAST(rm->data.op_sg);
> + return ERR_CAST(tmp);
> }
>
> for (i = 0; i < rm->data.op_nents; ++i) {
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-03-19 2:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 8:46 Lv Yunlong
2021-03-19 2:25 ` lyl2019 [this message]
2021-03-30 10:16 Lv Yunlong
2021-03-31 0:02 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22401612.2e0b.178484cf3b6.Coremail.lyl2019@mail.ustc.edu.cn \
--to=lyl2019@mail.ustc.edu.cn \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rds-devel@oss.oracle.com \
--cc=santosh.shilimkar@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®