History

SUNRPC: Do not dereference non-socket transports in sysfs

Do not cast the struct xprt to a sock_xprt unless we know it is a UDP or TCP transport. Otherwise the call to lock the mutex will scribble over whatever structure is actually there. This has been seen to cause hard system lockups when the underlying transport was RDMA.

Trond Myklebust committed 4 years ago

Commit 421ab1b1 parent 1d15d124 files · +54 −31Browse files

Showing the changes to include (2 of 4 files). Show all

Unified · Split

2 files
  1. include/linux/sunrpc/xprt.h +3 −0
  2. include/linux/sunrpc/xprtsock.h +0 −1
include/linux/sunrpc/xprt.h+3−0
@@ -139,6 +139,9 @@ struct rpc_xprt_ops { · 138 unmodified lines
139 void (*rpcbind)(struct rpc_task *task);139 void (*rpcbind)(struct rpc_task *task);
140 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);140 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
141 void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task);141 void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task);
142 int (*get_srcaddr)(struct rpc_xprt *xprt, char *buf,
143 size_t buflen);
144 unsigned short (*get_srcport)(struct rpc_xprt *xprt);
142 int (*buf_alloc)(struct rpc_task *task);145 int (*buf_alloc)(struct rpc_task *task);
143 void (*buf_free)(struct rpc_task *task);146 void (*buf_free)(struct rpc_task *task);
144 void (*prepare_request)(struct rpc_rqst *req);147 void (*prepare_request)(struct rpc_rqst *req);
include/linux/sunrpc/xprtsock.h+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
10 10
11int init_socket_xprt(void);11int init_socket_xprt(void);
12void cleanup_socket_xprt(void);12void cleanup_socket_xprt(void);
13unsigned short get_srcport(struct rpc_xprt *);
14 13
15#define RPC_MIN_RESVPORT (1U)14#define RPC_MIN_RESVPORT (1U)
16#define RPC_MAX_RESVPORT (65535U)15#define RPC_MAX_RESVPORT (65535U)