Skip to content

Commit 1598e9e

Browse files
shayshyigregkh
authored andcommitted
IB/umad: Return EIO in case of when device disassociated
[ Upstream commit 4fc5461 ] 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: 1da177e ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 48e6713 commit 1598e9e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/infiniband/core/user_mad.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
379379

380380
mutex_lock(&file->mutex);
381381

382+
if (file->agents_dead) {
383+
mutex_unlock(&file->mutex);
384+
return -EIO;
385+
}
386+
382387
while (list_empty(&file->recv_list)) {
383388
mutex_unlock(&file->mutex);
384389

@@ -524,7 +529,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
524529

525530
agent = __get_agent(file, packet->mad.hdr.id);
526531
if (!agent) {
527-
ret = -EINVAL;
532+
ret = -EIO;
528533
goto err_up;
529534
}
530535

0 commit comments

Comments
 (0)