From 57e222475545f457ecf4833db31f156e8b7674c7 Mon Sep 17 00:00:00 2001 From: Loic Poulain Date: Thu, 22 Apr 2021 16:06:01 +0200 Subject: [PATCH] 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 --- drivers/net/wwan/wwan_core.c | 2 ++ 1 file changed, 2 insertions(+) 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; }