mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lyl2019@mail.ustc.edu.cn
To: "David Miller" <davem@davemloft.net>
Cc: santosh.shilimkar@oracle.com, kuba@kernel.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] net/rds: Fix a use after free in rds_message_map_pages
Date: Wed, 31 Mar 2021 10:02:57 +0800 (GMT+08:00)	[thread overview]
Message-ID: <3c258c4e.20f4b.1788604fd68.Coremail.lyl2019@mail.ustc.edu.cn> (raw)
In-Reply-To: <20210330.170228.191449180243560631.davem@davemloft.net>




> -----原始邮件-----
> 发件人: "David Miller" <davem@davemloft.net>
> 发送时间: 2021-03-31 08:02:28 (星期三)
> 收件人: lyl2019@mail.ustc.edu.cn
> 抄送: santosh.shilimkar@oracle.com, kuba@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org
> 主题: Re: [PATCH] net/rds: Fix a use after free in rds_message_map_pages
> 
> 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.

The type of ERR_CAST() is void *, not int. 
I think the correct patch is:

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

I have submitted the PATCH v2 for you to review.

Thanks.

      reply	other threads:[~2021-03-31  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 10:16 Lv Yunlong
2021-03-31  0:02 ` David Miller
2021-03-31  2:02   ` lyl2019 [this message]

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=3c258c4e.20f4b.1788604fd68.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®