[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_AFA7C146CBD2DFC65989A8EEDAAED20CB106@qq.com>
Date: Tue, 5 Mar 2024 08:13:08 +0800
From: Edward Adam Davis <eadavis@...com>
To: horms@...nel.org
Cc: allison.henderson@...cle.com,
davem@...emloft.net,
eadavis@...com,
edumazet@...gle.com,
kuba@...nel.org,
linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org,
netdev@...r.kernel.org,
pabeni@...hat.com,
rds-devel@....oracle.com,
santosh.shilimkar@...cle.com,
syzbot+d4faee732755bba9838e@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: [PATCH V2] net/rds: fix WARNING in rds_conn_connect_if_down
If connection isn't established yet, get_mr() will fail, trigger connection after
get_mr().
Fixes: 584a8279a44a ("RDS: RDMA: return appropriate error on rdma map failures")
Reported-and-tested-by: syzbot+d4faee732755bba9838e@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
net/rds/rdma.c | 3 +++
net/rds/send.c | 6 +-----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index fba82d36593a..a4e3c5de998b 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -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;
}
diff --git a/net/rds/send.c b/net/rds/send.c
index 5e57a1581dc6..fa1640628b2f 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -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",
--
2.43.0
Powered by blists - more mailing lists