diff mbox series

[net-next,v2] net: wwan: core: Return poll error in case of port removal

Message ID 1619100361-1330-1-git-send-email-loic.poulain@linaro.org
State New
Headers show
Series [net-next,v2] net: wwan: core: Return poll error in case of port removal | expand

Commit Message

Loic Poulain April 22, 2021, 2:06 p.m. UTC
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>

---
 v2: get rid of useless locking for accessing port->ops

 drivers/net/wwan/wwan_core.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.7.4

Comments

Leon Romanovsky April 22, 2021, 3:02 p.m. UTC | #1
On Thu, Apr 22, 2021 at 04:06:01PM +0200, Loic Poulain wrote:
> 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>

> ---

>  v2: get rid of useless locking for accessing port->ops

> 

>  drivers/net/wwan/wwan_core.c | 2 ++

>  1 file changed, 2 insertions(+)

> 


Please take my ROB with a grain of salt.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
patchwork-bot+netdevbpf@kernel.org April 22, 2021, 8:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 22 Apr 2021 16:06:01 +0200 you wrote:
> 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>

> 

> [...]


Here is the summary with links:
  - [net-next,v2] net: wwan: core: Return poll error in case of port removal
    https://git.kernel.org/netdev/net-next/c/57e222475545

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

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;
 }