mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
IB/umad: Return EIO in case of when device disassociated
[ Upstream commit4fc5461823
] 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:1da177e4c3
("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>
This commit is contained in:
parent
f337e5947a
commit
40d9bcab50
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue