Skip to content

Commit 84c4572

Browse files
shayshyiintel-lab-lkp
authored andcommitted
IB/umad: Return EPOLLERR in case of when device disassociated
Currently, polling a umad device will always works, even if the device was disassociated. Hence, returning EPOLLERR if device was disassociated. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Shay Drory <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent d074695 commit 84c4572

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/infiniband/core/user_mad.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,14 @@ static __poll_t ib_umad_poll(struct file *filp, struct poll_table_struct *wait)
653653
/* we will always be able to post a MAD send */
654654
__poll_t mask = EPOLLOUT | EPOLLWRNORM;
655655

656+
mutex_lock(&file->mutex);
656657
poll_wait(filp, &file->recv_wait, wait);
657658

658659
if (!list_empty(&file->recv_list))
659660
mask |= EPOLLIN | EPOLLRDNORM;
661+
if (file->agents_dead)
662+
mask = EPOLLERR;
663+
mutex_unlock(&file->mutex);
660664

661665
return mask;
662666
}

0 commit comments

Comments
 (0)