[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1619100361-1330-1-git-send-email-loic.poulain@linaro.org>
Date: Thu, 22 Apr 2021 16:06:01 +0200
From: Loic Poulain <loic.poulain@...aro.org>
To: kuba@...nel.org, davem@...emloft.net, leon@...nel.org
Cc: netdev@...r.kernel.org, Loic Poulain <loic.poulain@...aro.org>
Subject: [PATCH net-next v2] 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 <loic.poulain@...aro.org>
---
v2: get rid of useless locking for accessing port->ops
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 5be5e1e..cff04e5 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;
}
--
2.7.4
Powered by blists - more mailing lists