From: Loic Poulain Date: Thu, 22 Apr 2021 14:06:01 +0000 (+0200) Subject: net: wwan: core: Return poll error in case of port removal X-Git-Tag: v5.13-rc1~94^2~66 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=57e222475545f457ecf4833db31f156e8b7674c7;p=linux-block.git net: wwan: core: Return poll error in case of port removal Ensure that the poll system call returns proper error flags when port is removed (nullified port ops), allowing user side to properly fail, without further read or write. Fixes: 9a44c1cc6388 ("net: Add a WWAN subsystem") Signed-off-by: Loic Poulain Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller --- diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index 5be5e1e3534c..cff04e532c1e 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -508,6 +508,8 @@ static __poll_t wwan_port_fops_poll(struct file *filp, poll_table *wait) mask |= EPOLLOUT | EPOLLWRNORM; if (!is_read_blocked(port)) mask |= EPOLLIN | EPOLLRDNORM; + if (!port->ops) + mask |= EPOLLHUP | EPOLLERR; return mask; }