From: Zhu Yanjun <yanjun.zhu@oracle.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
santosh.shilimkar@oracle.com, davem@davemloft.net,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
rds-devel@oss.oracle.com, gerd.rausch@oracle.com
Subject: Re: [PATCHv2 1/1] net: rds: add service level support in rds-info
Date: Wed, 4 Sep 2019 13:08:51 +0800 [thread overview]
Message-ID: <568fde9c-8838-330b-1b41-f61c14edac90@oracle.com> (raw)
In-Reply-To: <4422c894-4182-18ba-efa2-f86a1f14a3a6@embeddedor.com>
On 2019/9/3 9:58, Gustavo A. R. Silva wrote:
> Hi,
>
> On 8/23/19 8:04 PM, Zhu Yanjun wrote:
>
> [..]
>
>> diff --git a/net/rds/ib.c b/net/rds/ib.c
>> index ec05d91..45acab2 100644
>> --- a/net/rds/ib.c
>> +++ b/net/rds/ib.c
>> @@ -291,7 +291,7 @@ static int rds_ib_conn_info_visitor(struct rds_connection *conn,
>> void *buffer)
>> {
>> struct rds_info_rdma_connection *iinfo = buffer;
>> - struct rds_ib_connection *ic;
>> + struct rds_ib_connection *ic = conn->c_transport_data;
>>
>> /* We will only ever look at IB transports */
>> if (conn->c_trans != &rds_ib_transport)
>> @@ -301,15 +301,16 @@ static int rds_ib_conn_info_visitor(struct rds_connection *conn,
>>
>> iinfo->src_addr = conn->c_laddr.s6_addr32[3];
>> iinfo->dst_addr = conn->c_faddr.s6_addr32[3];
>> - iinfo->tos = conn->c_tos;
>> + if (ic) {
> Is this null-check actually necessary? (see related comments below...)
>
>> + iinfo->tos = conn->c_tos;
>> + iinfo->sl = ic->i_sl;
>> + }
>>
>> memset(&iinfo->src_gid, 0, sizeof(iinfo->src_gid));
>> memset(&iinfo->dst_gid, 0, sizeof(iinfo->dst_gid));
>> if (rds_conn_state(conn) == RDS_CONN_UP) {
>> struct rds_ib_device *rds_ibdev;
>>
>> - ic = conn->c_transport_data;
>> -
>> rdma_read_gids(ic->i_cm_id, (union ib_gid *)&iinfo->src_gid,
> Notice that *ic* is dereferenced here without null-checking it. More
> comments below...
>
>> (union ib_gid *)&iinfo->dst_gid);
>>
>> @@ -329,7 +330,7 @@ static int rds6_ib_conn_info_visitor(struct rds_connection *conn,
>> void *buffer)
>> {
>> struct rds6_info_rdma_connection *iinfo6 = buffer;
>> - struct rds_ib_connection *ic;
>> + struct rds_ib_connection *ic = conn->c_transport_data;
>>
>> /* We will only ever look at IB transports */
>> if (conn->c_trans != &rds_ib_transport)
>> @@ -337,6 +338,10 @@ static int rds6_ib_conn_info_visitor(struct rds_connection *conn,
>>
>> iinfo6->src_addr = conn->c_laddr;
>> iinfo6->dst_addr = conn->c_faddr;
>> + if (ic) {
>> + iinfo6->tos = conn->c_tos;
>> + iinfo6->sl = ic->i_sl;
>> + }
>>
>> memset(&iinfo6->src_gid, 0, sizeof(iinfo6->src_gid));
>> memset(&iinfo6->dst_gid, 0, sizeof(iinfo6->dst_gid));
>> @@ -344,7 +349,6 @@ static int rds6_ib_conn_info_visitor(struct rds_connection *conn,
>> if (rds_conn_state(conn) == RDS_CONN_UP) {
>> struct rds_ib_device *rds_ibdev;
>>
>> - ic = conn->c_transport_data;
>> rdma_read_gids(ic->i_cm_id, (union ib_gid *)&iinfo6->src_gid,
> Again, *ic* is being dereferenced here without a previous null-check.
Please check when this "rds_conn_state(conn) = RDS_CONN_UP".
Thanks a lot.
Zhu Yanjun
>
>> (union ib_gid *)&iinfo6->dst_gid);
>> rds_ibdev = ic->rds_ibdev;
>
> --
> Gustavo
>
prev parent reply other threads:[~2019-09-04 5:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-24 1:04 [PATCHv2 1/1] net: rds: add service level support in rds-info Zhu Yanjun
2019-08-24 1:25 ` santosh.shilimkar
2019-08-24 1:36 ` Zhu Yanjun
2019-08-24 23:58 ` David Miller
2019-08-25 14:11 ` Zhu Yanjun
2019-09-03 1:58 ` Gustavo A. R. Silva
2019-09-04 5:08 ` Zhu Yanjun [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=568fde9c-8838-330b-1b41-f61c14edac90@oracle.com \
--to=yanjun.zhu@oracle.com \
--cc=davem@davemloft.net \
--cc=gerd.rausch@oracle.com \
--cc=gustavo@embeddedor.com \
--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;
as well as URLs for NNTP newsgroup(s).