]> git.baikalelectronics.ru Git - kernel.git/commit
net, socket, socket_wq: fix missing initialization of flags
authorNicolai Stange <nicstange@gmail.com>
Tue, 29 Dec 2015 12:29:55 +0000 (13:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Dec 2015 21:38:01 +0000 (16:38 -0500)
commitcc0786e7acb72735e29f0e2e83e900c3ac56fda5
tree45ed5752ed80b976203a5444e6f08ad86ec8cedd
parent8a80ad979023fcc6b5fcf9afc432f0d152ce0f1e
net, socket, socket_wq: fix missing initialization of flags

Commit 3c30db657f9c ("net: fix sock_wake_async() rcu protection") from
the current 4.4 release cycle introduced a new flags member in
struct socket_wq and moved SOCKWQ_ASYNC_NOSPACE and SOCKWQ_ASYNC_WAITDATA
from struct socket's flags member into that new place.

Unfortunately, the new flags field is never initialized properly, at least
not for the struct socket_wq instance created in sock_alloc_inode().

One particular issue I encountered because of this is that my GNU Emacs
failed to draw anything on my desktop -- i.e. what I got is a transparent
window, including the title bar. Bisection lead to the commit mentioned
above and further investigation by means of strace told me that Emacs
is indeed speaking to my Xorg through an O_ASYNC AF_UNIX socket. This is
reproducible 100% of times and the fact that properly initializing the
struct socket_wq ->flags fixes the issue leads me to the conclusion that
somehow SOCKWQ_ASYNC_WAITDATA got set in the uninitialized ->flags,
preventing my Emacs from receiving any SIGIO's due to data becoming
available and it got stuck.

Make sock_alloc_inode() set the newly created struct socket_wq's ->flags
member to zero.

Fixes: 3c30db657f9c ("net: fix sock_wake_async() rcu protection")
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c