LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yanjun Zhu <yanjun.zhu@oracle.com>
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: DaeRyong Jeong <threeearcat@gmail.com>,
santosh.shilimkar@oracle.com, davem@davemloft.net,
rds-devel@oss.oracle.com, kt0755@gmail.com,
linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, byoungyoung@purdue.edu
Subject: Re: [rds-devel] KASAN: null-ptr-deref Read in rds_ib_get_mr
Date: Fri, 11 May 2018 22:07:45 +0800 [thread overview]
Message-ID: <7ee8589c-97ab-6843-3095-f735040b6f13@oracle.com> (raw)
In-Reply-To: <20180511104630.GD14952@oracle.com>
On 2018/5/11 18:46, Sowmini Varadhan wrote:
> On (05/11/18 15:48), Yanjun Zhu wrote:
>> diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
>> index e678699..2228b50 100644
>> --- a/net/rds/ib_rdma.c
>> +++ b/net/rds/ib_rdma.c
>> @@ -539,11 +539,17 @@ void rds_ib_flush_mrs(void)
>> void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
>> struct rds_sock *rs, u32 *key_ret)
>> {
>> - struct rds_ib_device *rds_ibdev;
>> + struct rds_ib_device *rds_ibdev = NULL;
>> struct rds_ib_mr *ibmr = NULL;
>> - struct rds_ib_connection *ic = rs->rs_conn->c_transport_data;
>> + struct rds_ib_connection *ic = NULL;
>> int ret;
>>
>> + if (rs->rs_bound_addr == 0) {
>> + ret = -EPERM;
>> + goto out;
>> + }
>> +
>> + ic = rs->rs_conn->c_transport_data;
>> rds_ibdev = rds_ib_get_device(rs->rs_bound_addr);
>> if (!rds_ibdev) {
>> ret = -ENODEV;
>>
>> I made this raw patch. If you can reproduce this bug, please make tests
>> with it.
> I dont think this solves the problem, I think it
> just changes the timing under which it can still happen.
>
> what if the rds_remove_bound() in rds_bind() happens after the check
> for if (rs->rs_bound_addr == 0) added above by the patch
>
> I believe you need some type of synchronization (either
> through mutex, or some atomic flag in the rs or similar) to make
> sure rds_bind() and rds_ib_get_mr() are mutually exclusive.
Sure. I agree with you. Maybe mutex is a good choice.
Zhu Yanjun
>
> --Sowmini
>
>
>
next prev parent reply other threads:[~2018-05-11 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 5:20 DaeRyong Jeong
2018-05-11 7:48 ` Yanjun Zhu
2018-05-11 10:46 ` [rds-devel] " Sowmini Varadhan
2018-05-11 14:07 ` Yanjun Zhu [this message]
2018-05-11 16:58 ` Santosh Shilimkar
2018-05-12 0:47 ` Yanjun Zhu
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=7ee8589c-97ab-6843-3095-f735040b6f13@oracle.com \
--to=yanjun.zhu@oracle.com \
--cc=byoungyoung@purdue.edu \
--cc=davem@davemloft.net \
--cc=kt0755@gmail.com \
--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 \
--cc=sowmini.varadhan@oracle.com \
--cc=threeearcat@gmail.com \
--subject='Re: [rds-devel] KASAN: null-ptr-deref Read in rds_ib_get_mr' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).