Browse Source

RDMA/core: Check error status of rdma_find_ndev_for_src_ip_rcu

rdma_find_ndev_for_src_ip_rcu() returns either valid netdev pointer or
ERR_PTR().  Instead of checking for NULL, check for error.

Fixes: caf1e3ae9fa6 ("RDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu")
Reported-by: syzbot+20c32fa6ff84a2d28c36@syzkaller.appspotmail.com
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Parav Pandit 6 years ago
parent
commit
fe33507ec3
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/infiniband/core/addr.c

+ 1 - 1
drivers/infiniband/core/addr.c

@@ -513,7 +513,7 @@ static int rdma_set_src_addr_rcu(struct rdma_dev_addr *dev_addr,
 		 * loopback IP address.
 		 */
 		ndev = rdma_find_ndev_for_src_ip_rcu(dev_net(ndev), dst_in);
-		if (!ndev)
+		if (IS_ERR(ndev))
 			return -ENODEV;
 	}