ocfs2/o2net: o2net_listen_data_ready should do nothing if socket state is not TCP_LISTEN
authorTariq Saeed <tariq.x.saeed@oracle.com>
Thu, 3 Apr 2014 21:47:11 +0000 (14:47 -0700)
committerDanny Wood <danwood76@gmail.com>
Thu, 15 Jul 2021 09:45:35 +0000 (10:45 +0100)
commitc67803c60b3aa4337b790760b978b648e1aac3c3
tree1af54c9ce8d29fdd6aac5e2d48c407af62a707d7
parent12ead65060709ac8fc8ce57924596684ebee9ff1
ocfs2/o2net: o2net_listen_data_ready should do nothing if socket state is not TCP_LISTEN

Orabug: 17330860

When accepting an incomming connection o2net_accept_one clones a child
data socket from the parent listening socket.  It then proceeds to setup
the child with callback o2net_data_ready() and sk_user_data to NULL.  If
data arrives in this window, o2net_listen_data_ready will be called with
some non-deterministic value in sk_user_data (not inherited).  We panic
when we page fault on sk_user_data -- in parent it is
sock_def_readable().

The fix is to recognize that this is a data socket being set up by
looking at the socket state and do nothing.

Change-Id: Iffbed59cbec1499e67e6b41ddfdcdc663957c6f5
Signed-off-by: Tariq Saseed <tariq.x.saeed@oracle.com>
Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/cluster/tcp.c