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 (mailing list archive)
State Accepted
Commit 57e222475545f457ecf4833db31f156e8b7674c7
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: wwan: core: Return poll error in case of port removal | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

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(+)

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