Skip to content

Commit

Permalink
net/rds: fix WARNING in rds_conn_connect_if_down
Browse files Browse the repository at this point in the history
If connection isn't established yet, get_mr() will fail, trigger connection after
get_mr().

Fixes: 584a827 ("RDS: RDMA: return appropriate error on rdma map failures")
Reported-and-tested-by: syzbot+d4faee732755bba9838e@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Edward Adam Davis authored and davem330 committed Mar 6, 2024
1 parent f287d6a commit c055fc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions net/rds/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
kfree(sg);
}
ret = PTR_ERR(trans_private);
/* Trigger connection so that its ready for the next retry */
if (ret == -ENODEV)
rds_conn_connect_if_down(cp->cp_conn);
goto out;
}

Expand Down
6 changes: 1 addition & 5 deletions net/rds/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,12 +1313,8 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)

/* Parse any control messages the user may have included. */
ret = rds_cmsg_send(rs, rm, msg, &allocated_mr, &vct);
if (ret) {
/* Trigger connection so that its ready for the next retry */
if (ret == -EAGAIN)
rds_conn_connect_if_down(conn);
if (ret)
goto out;
}

if (rm->rdma.op_active && !conn->c_trans->xmit_rdma) {
printk_ratelimited(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n",
Expand Down

0 comments on commit c055fc0

Please sign in to comment.