net: handle NULL ->poll gracefully
authorChristoph Hellwig <[email protected]>
Fri, 29 Jun 2018 13:37:24 +0000 (15:37 +0200)
committerLinus Torvalds <[email protected]>
Fri, 29 Jun 2018 13:51:51 +0000 (06:51 -0700)
The big aio poll revert broke various network protocols that don't
implement ->poll as a patch in the aio poll serie removed sock_no_poll
and made the common code handle this case.

Reported-by: [email protected]
Reported-by: [email protected]
Reported-by: [email protected]
Reported-by: Tetsuo Handa <[email protected]>
Fixes: a11e1d432b51 ("Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL")
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
net/socket.c

index a564c6ed19d5680e1a154c9eeb9da4de0eb71b33..85633622c94d011796517feb4d935b7ccba68445 100644 (file)
@@ -1133,6 +1133,8 @@ static __poll_t sock_poll(struct file *file, poll_table *wait)
        __poll_t events = poll_requested_events(wait);
 
        sock_poll_busy_loop(sock, events);
+       if (!sock->ops->poll)
+               return 0;
        return sock->ops->poll(file, sock, wait) | sock_poll_busy_flag(sock);
 }