Commit 319050d
committed
SUNRPC: Fix error handling in svc_setup_socket()
Dan points out that sock_alloc_file() releases @sock on error, but
so do all of svc_setup_socket's callers, resulting in a double-
release if sock_alloc_file() returns an error.
Rather than allocating a struct file for all new sockets, allocate
one only for sockets created during a TCP accept. For the moment,
those are the only ones that will ever be used with RPC-with-TLS.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: ae0d777 ("SUNRPC: Ensure server-side sockets have a sock->file")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>1 parent 29cd292 commit 319050d
1 file changed
Lines changed: 4 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
898 | 901 | | |
899 | 902 | | |
900 | 903 | | |
| |||
935 | 938 | | |
936 | 939 | | |
937 | 940 | | |
938 | | - | |
| 941 | + | |
939 | 942 | | |
940 | 943 | | |
941 | 944 | | |
| |||
1430 | 1433 | | |
1431 | 1434 | | |
1432 | 1435 | | |
1433 | | - | |
1434 | 1436 | | |
1435 | 1437 | | |
1436 | 1438 | | |
| |||
1439 | 1441 | | |
1440 | 1442 | | |
1441 | 1443 | | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | 1444 | | |
1451 | 1445 | | |
1452 | 1446 | | |
| |||
1456 | 1450 | | |
1457 | 1451 | | |
1458 | 1452 | | |
1459 | | - | |
1460 | | - | |
1461 | 1453 | | |
1462 | 1454 | | |
1463 | 1455 | | |
| |||
0 commit comments