]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
net/rds: fix WARNING in rds_conn_connect_if_down
authorEdward Adam Davis <eadavis@qq.com>
Tue, 5 Mar 2024 00:13:08 +0000 (08:13 +0800)
committerSasha Levin <sashal@kernel.org>
Fri, 15 Mar 2024 14:48:15 +0000 (10:48 -0400)
[ Upstream commit c055fc00c07be1f0df7375ab0036cebd1106ed38 ]

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@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/rds/rdma.c
net/rds/send.c

index fba82d36593add3317e89104aabbd69a0281cb33..a4e3c5de998be4c756cb0dc423ee9a7e7fa3e1a9 100644 (file)
@@ -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;
        }
 
index 0c5504068e3c2da92eeb61305e4c95fbc90a4ee2..a4ba45c430d818f5b84c61dc382c275d9b0b3282 100644 (file)
@@ -1314,12 +1314,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",