]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: wwan: core: Return poll error in case of port removal
authorLoic Poulain <loic.poulain@linaro.org>
Thu, 22 Apr 2021 14:06:01 +0000 (16:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Apr 2021 20:26:02 +0000 (13:26 -0700)
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 <loic.poulain@linaro.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wwan/wwan_core.c

index 5be5e1e3534cf17d418ea88861954ccac96b9cdc..cff04e532c1e0778800c0bb255f1a61bf20d8e59 100644 (file)
@@ -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;
 }