Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Ignore data_ready callbacks during TLS handshakes

The RPC header parser doesn't recognize TLS handshake traffic, so it
will close the connection prematurely with an error. To avoid that,
shunt the transport's data_ready callback when there is a TLS
handshake in progress.

The XPRT_SOCK_IGNORE_RECV flag will be toggled by code added in a
subsequent patch.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Chuck Lever and committed by
Trond Myklebust
0d3ca07f 12072652

+7
+1
include/linux/sunrpc/xprtsock.h
··· 90 90 #define XPRT_SOCK_WAKE_DISCONNECT (7) 91 91 #define XPRT_SOCK_CONNECT_SENT (8) 92 92 #define XPRT_SOCK_NOSPACE (9) 93 + #define XPRT_SOCK_IGNORE_RECV (10) 93 94 94 95 #endif /* _LINUX_SUNRPC_XPRTSOCK_H */
+6
net/sunrpc/xprtsock.c
··· 700 700 { 701 701 702 702 clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state); 703 + if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) 704 + return; 703 705 if (!xs_poll_socket_readable(transport)) 704 706 return; 705 707 if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) ··· 1387 1385 trace_xs_data_ready(xprt); 1388 1386 1389 1387 transport->old_data_ready(sk); 1388 + 1389 + if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) 1390 + return; 1391 + 1390 1392 /* Any data means we had a useful conversation, so 1391 1393 * then we don't need to delay the next reconnect 1392 1394 */