aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/user_mad.c
diff options
context:
space:
mode:
authorShay Drory <shayd@nvidia.com>2021-01-25 14:13:38 +0200
committerJason Gunthorpe <jgg@nvidia.com>2021-01-28 15:27:08 -0400
commit4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5 (patch)
tree244e411dbe7d74fb4ed38e6741e7657d839de7c3 /drivers/infiniband/core/user_mad.c
parentRDMA/mlx5: Allow creating all QPs even when non RDMA profile is used (diff)
downloadlinux-dev-4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5.tar.xz
linux-dev-4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5.zip
IB/umad: Return EIO in case of when device disassociated
MAD message received by the user has EINVAL error in all flows including when the device is disassociated. That makes it impossible for the applications to treat such flow differently. Change it to return EIO, so the applications will be able to perform disassociation recovery. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Link: https://lore.kernel.org/r/20210125121339.837518-2-leon@kernel.org Signed-off-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/user_mad.c')
-rw-r--r--drivers/infiniband/core/user_mad.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 19104a675691..7ec1918431f7 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -379,6 +379,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
mutex_lock(&file->mutex);
+ if (file->agents_dead) {
+ mutex_unlock(&file->mutex);
+ return -EIO;
+ }
+
while (list_empty(&file->recv_list)) {
mutex_unlock(&file->mutex);
@@ -524,7 +529,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
agent = __get_agent(file, packet->mad.hdr.id);
if (!agent) {
- ret = -EINVAL;
+ ret = -EIO;
goto err_up;
}