diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/cache.c | 13 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 18 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 5 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 29 |
5 files changed, 45 insertions, 22 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index c2173ebdb33c..58de76c8540c 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/sunrpc/cache.h> | 34 | #include <linux/sunrpc/cache.h> |
35 | #include <linux/sunrpc/stats.h> | 35 | #include <linux/sunrpc/stats.h> |
36 | #include <linux/sunrpc/rpc_pipe_fs.h> | 36 | #include <linux/sunrpc/rpc_pipe_fs.h> |
37 | #include <linux/smp_lock.h> | ||
37 | 38 | ||
38 | #define RPCDBG_FACILITY RPCDBG_CACHE | 39 | #define RPCDBG_FACILITY RPCDBG_CACHE |
39 | 40 | ||
@@ -1545,12 +1546,18 @@ static unsigned int cache_poll_pipefs(struct file *filp, poll_table *wait) | |||
1545 | return cache_poll(filp, wait, cd); | 1546 | return cache_poll(filp, wait, cd); |
1546 | } | 1547 | } |
1547 | 1548 | ||
1548 | static int cache_ioctl_pipefs(struct inode *inode, struct file *filp, | 1549 | static long cache_ioctl_pipefs(struct file *filp, |
1549 | unsigned int cmd, unsigned long arg) | 1550 | unsigned int cmd, unsigned long arg) |
1550 | { | 1551 | { |
1552 | struct inode *inode = filp->f_dentry->d_inode; | ||
1551 | struct cache_detail *cd = RPC_I(inode)->private; | 1553 | struct cache_detail *cd = RPC_I(inode)->private; |
1554 | long ret; | ||
1552 | 1555 | ||
1553 | return cache_ioctl(inode, filp, cmd, arg, cd); | 1556 | lock_kernel(); |
1557 | ret = cache_ioctl(inode, filp, cmd, arg, cd); | ||
1558 | unlock_kernel(); | ||
1559 | |||
1560 | return ret; | ||
1554 | } | 1561 | } |
1555 | 1562 | ||
1556 | static int cache_open_pipefs(struct inode *inode, struct file *filp) | 1563 | static int cache_open_pipefs(struct inode *inode, struct file *filp) |
@@ -1573,7 +1580,7 @@ const struct file_operations cache_file_operations_pipefs = { | |||
1573 | .read = cache_read_pipefs, | 1580 | .read = cache_read_pipefs, |
1574 | .write = cache_write_pipefs, | 1581 | .write = cache_write_pipefs, |
1575 | .poll = cache_poll_pipefs, | 1582 | .poll = cache_poll_pipefs, |
1576 | .ioctl = cache_ioctl_pipefs, /* for FIONREAD */ | 1583 | .unlocked_ioctl = cache_ioctl_pipefs, /* for FIONREAD */ |
1577 | .open = cache_open_pipefs, | 1584 | .open = cache_open_pipefs, |
1578 | .release = cache_release_pipefs, | 1585 | .release = cache_release_pipefs, |
1579 | }; | 1586 | }; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 20e30c6f8355..95ccbcf45d3e 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
28 | #include <linux/sunrpc/rpc_pipe_fs.h> | 28 | #include <linux/sunrpc/rpc_pipe_fs.h> |
29 | #include <linux/sunrpc/cache.h> | 29 | #include <linux/sunrpc/cache.h> |
30 | #include <linux/smp_lock.h> | ||
30 | 31 | ||
31 | static struct vfsmount *rpc_mount __read_mostly; | 32 | static struct vfsmount *rpc_mount __read_mostly; |
32 | static int rpc_mount_count; | 33 | static int rpc_mount_count; |
@@ -309,8 +310,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait) | |||
309 | } | 310 | } |
310 | 311 | ||
311 | static int | 312 | static int |
312 | rpc_pipe_ioctl(struct inode *ino, struct file *filp, | 313 | rpc_pipe_ioctl_unlocked(struct file *filp, unsigned int cmd, unsigned long arg) |
313 | unsigned int cmd, unsigned long arg) | ||
314 | { | 314 | { |
315 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); | 315 | struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode); |
316 | int len; | 316 | int len; |
@@ -331,13 +331,25 @@ rpc_pipe_ioctl(struct inode *ino, struct file *filp, | |||
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | static long | ||
335 | rpc_pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
336 | { | ||
337 | long ret; | ||
338 | |||
339 | lock_kernel(); | ||
340 | ret = rpc_pipe_ioctl_unlocked(filp, cmd, arg); | ||
341 | unlock_kernel(); | ||
342 | |||
343 | return ret; | ||
344 | } | ||
345 | |||
334 | static const struct file_operations rpc_pipe_fops = { | 346 | static const struct file_operations rpc_pipe_fops = { |
335 | .owner = THIS_MODULE, | 347 | .owner = THIS_MODULE, |
336 | .llseek = no_llseek, | 348 | .llseek = no_llseek, |
337 | .read = rpc_pipe_read, | 349 | .read = rpc_pipe_read, |
338 | .write = rpc_pipe_write, | 350 | .write = rpc_pipe_write, |
339 | .poll = rpc_pipe_poll, | 351 | .poll = rpc_pipe_poll, |
340 | .ioctl = rpc_pipe_ioctl, | 352 | .unlocked_ioctl = rpc_pipe_ioctl, |
341 | .open = rpc_pipe_open, | 353 | .open = rpc_pipe_open, |
342 | .release = rpc_pipe_release, | 354 | .release = rpc_pipe_release, |
343 | }; | 355 | }; |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 121105355f60..dac219a56ae1 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -783,7 +783,7 @@ static int rpcb_dec_getport(struct rpc_rqst *req, __be32 *p, | |||
783 | port = ntohl(*p); | 783 | port = ntohl(*p); |
784 | dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid, | 784 | dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid, |
785 | task->tk_msg.rpc_proc->p_name, port); | 785 | task->tk_msg.rpc_proc->p_name, port); |
786 | if (unlikely(port > USHORT_MAX)) | 786 | if (unlikely(port > USHRT_MAX)) |
787 | return -EIO; | 787 | return -EIO; |
788 | 788 | ||
789 | rpcb->r_port = port; | 789 | rpcb->r_port = port; |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 3fc325399ee4..dcd0132396ba 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -166,7 +166,6 @@ EXPORT_SYMBOL_GPL(xprt_unregister_transport); | |||
166 | int xprt_load_transport(const char *transport_name) | 166 | int xprt_load_transport(const char *transport_name) |
167 | { | 167 | { |
168 | struct xprt_class *t; | 168 | struct xprt_class *t; |
169 | char module_name[sizeof t->name + 5]; | ||
170 | int result; | 169 | int result; |
171 | 170 | ||
172 | result = 0; | 171 | result = 0; |
@@ -178,9 +177,7 @@ int xprt_load_transport(const char *transport_name) | |||
178 | } | 177 | } |
179 | } | 178 | } |
180 | spin_unlock(&xprt_list_lock); | 179 | spin_unlock(&xprt_list_lock); |
181 | strcpy(module_name, "xprt"); | 180 | result = request_module("xprt%s", transport_name); |
182 | strncat(module_name, transport_name, sizeof t->name); | ||
183 | result = request_module(module_name); | ||
184 | out: | 181 | out: |
185 | return result; | 182 | return result; |
186 | } | 183 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index b7cd8cccbe72..2a9675136c68 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2293,6 +2293,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args) | |||
2293 | struct sockaddr *addr = args->dstaddr; | 2293 | struct sockaddr *addr = args->dstaddr; |
2294 | struct rpc_xprt *xprt; | 2294 | struct rpc_xprt *xprt; |
2295 | struct sock_xprt *transport; | 2295 | struct sock_xprt *transport; |
2296 | struct rpc_xprt *ret; | ||
2296 | 2297 | ||
2297 | xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); | 2298 | xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); |
2298 | if (IS_ERR(xprt)) | 2299 | if (IS_ERR(xprt)) |
@@ -2330,8 +2331,8 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args) | |||
2330 | xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6); | 2331 | xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6); |
2331 | break; | 2332 | break; |
2332 | default: | 2333 | default: |
2333 | kfree(xprt); | 2334 | ret = ERR_PTR(-EAFNOSUPPORT); |
2334 | return ERR_PTR(-EAFNOSUPPORT); | 2335 | goto out_err; |
2335 | } | 2336 | } |
2336 | 2337 | ||
2337 | if (xprt_bound(xprt)) | 2338 | if (xprt_bound(xprt)) |
@@ -2346,10 +2347,11 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args) | |||
2346 | 2347 | ||
2347 | if (try_module_get(THIS_MODULE)) | 2348 | if (try_module_get(THIS_MODULE)) |
2348 | return xprt; | 2349 | return xprt; |
2349 | 2350 | ret = ERR_PTR(-EINVAL); | |
2351 | out_err: | ||
2350 | kfree(xprt->slot); | 2352 | kfree(xprt->slot); |
2351 | kfree(xprt); | 2353 | kfree(xprt); |
2352 | return ERR_PTR(-EINVAL); | 2354 | return ret; |
2353 | } | 2355 | } |
2354 | 2356 | ||
2355 | static const struct rpc_timeout xs_tcp_default_timeout = { | 2357 | static const struct rpc_timeout xs_tcp_default_timeout = { |
@@ -2368,6 +2370,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
2368 | struct sockaddr *addr = args->dstaddr; | 2370 | struct sockaddr *addr = args->dstaddr; |
2369 | struct rpc_xprt *xprt; | 2371 | struct rpc_xprt *xprt; |
2370 | struct sock_xprt *transport; | 2372 | struct sock_xprt *transport; |
2373 | struct rpc_xprt *ret; | ||
2371 | 2374 | ||
2372 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); | 2375 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); |
2373 | if (IS_ERR(xprt)) | 2376 | if (IS_ERR(xprt)) |
@@ -2403,8 +2406,8 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
2403 | xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6); | 2406 | xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6); |
2404 | break; | 2407 | break; |
2405 | default: | 2408 | default: |
2406 | kfree(xprt); | 2409 | ret = ERR_PTR(-EAFNOSUPPORT); |
2407 | return ERR_PTR(-EAFNOSUPPORT); | 2410 | goto out_err; |
2408 | } | 2411 | } |
2409 | 2412 | ||
2410 | if (xprt_bound(xprt)) | 2413 | if (xprt_bound(xprt)) |
@@ -2420,10 +2423,11 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
2420 | 2423 | ||
2421 | if (try_module_get(THIS_MODULE)) | 2424 | if (try_module_get(THIS_MODULE)) |
2422 | return xprt; | 2425 | return xprt; |
2423 | 2426 | ret = ERR_PTR(-EINVAL); | |
2427 | out_err: | ||
2424 | kfree(xprt->slot); | 2428 | kfree(xprt->slot); |
2425 | kfree(xprt); | 2429 | kfree(xprt); |
2426 | return ERR_PTR(-EINVAL); | 2430 | return ret; |
2427 | } | 2431 | } |
2428 | 2432 | ||
2429 | /** | 2433 | /** |
@@ -2437,6 +2441,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | |||
2437 | struct rpc_xprt *xprt; | 2441 | struct rpc_xprt *xprt; |
2438 | struct sock_xprt *transport; | 2442 | struct sock_xprt *transport; |
2439 | struct svc_sock *bc_sock; | 2443 | struct svc_sock *bc_sock; |
2444 | struct rpc_xprt *ret; | ||
2440 | 2445 | ||
2441 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); | 2446 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); |
2442 | if (IS_ERR(xprt)) | 2447 | if (IS_ERR(xprt)) |
@@ -2476,8 +2481,8 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | |||
2476 | RPCBIND_NETID_TCP6); | 2481 | RPCBIND_NETID_TCP6); |
2477 | break; | 2482 | break; |
2478 | default: | 2483 | default: |
2479 | kfree(xprt); | 2484 | ret = ERR_PTR(-EAFNOSUPPORT); |
2480 | return ERR_PTR(-EAFNOSUPPORT); | 2485 | goto out_err; |
2481 | } | 2486 | } |
2482 | 2487 | ||
2483 | if (xprt_bound(xprt)) | 2488 | if (xprt_bound(xprt)) |
@@ -2499,9 +2504,11 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) | |||
2499 | 2504 | ||
2500 | if (try_module_get(THIS_MODULE)) | 2505 | if (try_module_get(THIS_MODULE)) |
2501 | return xprt; | 2506 | return xprt; |
2507 | ret = ERR_PTR(-EINVAL); | ||
2508 | out_err: | ||
2502 | kfree(xprt->slot); | 2509 | kfree(xprt->slot); |
2503 | kfree(xprt); | 2510 | kfree(xprt); |
2504 | return ERR_PTR(-EINVAL); | 2511 | return ret; |
2505 | } | 2512 | } |
2506 | 2513 | ||
2507 | static struct xprt_class xs_udp_transport = { | 2514 | static struct xprt_class xs_udp_transport = { |