diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 155 | ||||
-rw-r--r-- | net/9p/mod.c | 4 | ||||
-rw-r--r-- | net/9p/protocol.c | 44 | ||||
-rw-r--r-- | net/9p/trans_virtio.c | 4 | ||||
-rw-r--r-- | net/iucv/iucv.c | 7 | ||||
-rw-r--r-- | net/netfilter/xt_RATEEST.c | 8 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 11 | ||||
-rw-r--r-- | net/unix/af_unix.c | 38 |
8 files changed, 165 insertions, 106 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 9e3b0e640da1..0505a03c374c 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -72,23 +72,22 @@ inline int p9_is_proto_dotu(struct p9_client *clnt) | |||
72 | EXPORT_SYMBOL(p9_is_proto_dotu); | 72 | EXPORT_SYMBOL(p9_is_proto_dotu); |
73 | 73 | ||
74 | /* Interpret mount option for protocol version */ | 74 | /* Interpret mount option for protocol version */ |
75 | static int get_protocol_version(const substring_t *name) | 75 | static int get_protocol_version(char *s) |
76 | { | 76 | { |
77 | int version = -EINVAL; | 77 | int version = -EINVAL; |
78 | 78 | ||
79 | if (!strncmp("9p2000", name->from, name->to-name->from)) { | 79 | if (!strcmp(s, "9p2000")) { |
80 | version = p9_proto_legacy; | 80 | version = p9_proto_legacy; |
81 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n"); | 81 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: Legacy\n"); |
82 | } else if (!strncmp("9p2000.u", name->from, name->to-name->from)) { | 82 | } else if (!strcmp(s, "9p2000.u")) { |
83 | version = p9_proto_2000u; | 83 | version = p9_proto_2000u; |
84 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n"); | 84 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.u\n"); |
85 | } else if (!strncmp("9p2000.L", name->from, name->to-name->from)) { | 85 | } else if (!strcmp(s, "9p2000.L")) { |
86 | version = p9_proto_2000L; | 86 | version = p9_proto_2000L; |
87 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.L\n"); | 87 | P9_DPRINTK(P9_DEBUG_9P, "Protocol version: 9P2000.L\n"); |
88 | } else { | 88 | } else |
89 | P9_DPRINTK(P9_DEBUG_ERROR, "Unknown protocol version %s. ", | 89 | printk(KERN_INFO "9p: Unknown protocol version %s.\n", s); |
90 | name->from); | 90 | |
91 | } | ||
92 | return version; | 91 | return version; |
93 | } | 92 | } |
94 | 93 | ||
@@ -106,6 +105,7 @@ static int parse_opts(char *opts, struct p9_client *clnt) | |||
106 | char *p; | 105 | char *p; |
107 | substring_t args[MAX_OPT_ARGS]; | 106 | substring_t args[MAX_OPT_ARGS]; |
108 | int option; | 107 | int option; |
108 | char *s; | ||
109 | int ret = 0; | 109 | int ret = 0; |
110 | 110 | ||
111 | clnt->proto_version = p9_proto_2000u; | 111 | clnt->proto_version = p9_proto_2000u; |
@@ -141,22 +141,41 @@ static int parse_opts(char *opts, struct p9_client *clnt) | |||
141 | clnt->msize = option; | 141 | clnt->msize = option; |
142 | break; | 142 | break; |
143 | case Opt_trans: | 143 | case Opt_trans: |
144 | clnt->trans_mod = v9fs_get_trans_by_name(&args[0]); | 144 | s = match_strdup(&args[0]); |
145 | if(clnt->trans_mod == NULL) { | 145 | if (!s) { |
146 | ret = -ENOMEM; | ||
146 | P9_DPRINTK(P9_DEBUG_ERROR, | 147 | P9_DPRINTK(P9_DEBUG_ERROR, |
147 | "Could not find request transport: %s\n", | 148 | "problem allocating copy of trans arg\n"); |
148 | (char *) &args[0]); | 149 | goto free_and_return; |
150 | } | ||
151 | clnt->trans_mod = v9fs_get_trans_by_name(s); | ||
152 | if (clnt->trans_mod == NULL) { | ||
153 | printk(KERN_INFO | ||
154 | "9p: Could not find " | ||
155 | "request transport: %s\n", s); | ||
149 | ret = -EINVAL; | 156 | ret = -EINVAL; |
157 | kfree(s); | ||
150 | goto free_and_return; | 158 | goto free_and_return; |
151 | } | 159 | } |
160 | kfree(s); | ||
152 | break; | 161 | break; |
153 | case Opt_legacy: | 162 | case Opt_legacy: |
154 | clnt->proto_version = p9_proto_legacy; | 163 | clnt->proto_version = p9_proto_legacy; |
155 | break; | 164 | break; |
156 | case Opt_version: | 165 | case Opt_version: |
157 | ret = get_protocol_version(&args[0]); | 166 | s = match_strdup(&args[0]); |
158 | if (ret == -EINVAL) | 167 | if (!s) { |
168 | ret = -ENOMEM; | ||
169 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
170 | "problem allocating copy of version arg\n"); | ||
159 | goto free_and_return; | 171 | goto free_and_return; |
172 | } | ||
173 | ret = get_protocol_version(s); | ||
174 | if (ret == -EINVAL) { | ||
175 | kfree(s); | ||
176 | goto free_and_return; | ||
177 | } | ||
178 | kfree(s); | ||
160 | clnt->proto_version = ret; | 179 | clnt->proto_version = ret; |
161 | break; | 180 | break; |
162 | default: | 181 | default: |
@@ -280,7 +299,8 @@ struct p9_req_t *p9_tag_lookup(struct p9_client *c, u16 tag) | |||
280 | * buffer to read the data into */ | 299 | * buffer to read the data into */ |
281 | tag++; | 300 | tag++; |
282 | 301 | ||
283 | BUG_ON(tag >= c->max_tag); | 302 | if(tag >= c->max_tag) |
303 | return NULL; | ||
284 | 304 | ||
285 | row = tag / P9_ROW_MAXTAG; | 305 | row = tag / P9_ROW_MAXTAG; |
286 | col = tag % P9_ROW_MAXTAG; | 306 | col = tag % P9_ROW_MAXTAG; |
@@ -749,7 +769,7 @@ static int p9_client_version(struct p9_client *c) | |||
749 | err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); | 769 | err = p9pdu_readf(req->rc, c->proto_version, "ds", &msize, &version); |
750 | if (err) { | 770 | if (err) { |
751 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); | 771 | P9_DPRINTK(P9_DEBUG_9P, "version error %d\n", err); |
752 | p9pdu_dump(1, req->rc); | 772 | P9_DUMP_PKT(1, req->rc); |
753 | goto error; | 773 | goto error; |
754 | } | 774 | } |
755 | 775 | ||
@@ -821,8 +841,8 @@ struct p9_client *p9_client_create(const char *dev_name, char *options) | |||
821 | if (err) | 841 | if (err) |
822 | goto destroy_fidpool; | 842 | goto destroy_fidpool; |
823 | 843 | ||
824 | if ((clnt->msize+P9_IOHDRSZ) > clnt->trans_mod->maxsize) | 844 | if (clnt->msize > clnt->trans_mod->maxsize) |
825 | clnt->msize = clnt->trans_mod->maxsize-P9_IOHDRSZ; | 845 | clnt->msize = clnt->trans_mod->maxsize; |
826 | 846 | ||
827 | err = p9_client_version(clnt); | 847 | err = p9_client_version(clnt); |
828 | if (err) | 848 | if (err) |
@@ -911,7 +931,7 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | |||
911 | 931 | ||
912 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); | 932 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); |
913 | if (err) { | 933 | if (err) { |
914 | p9pdu_dump(1, req->rc); | 934 | P9_DUMP_PKT(1, req->rc); |
915 | p9_free_req(clnt, req); | 935 | p9_free_req(clnt, req); |
916 | goto error; | 936 | goto error; |
917 | } | 937 | } |
@@ -971,7 +991,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, | |||
971 | 991 | ||
972 | err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); | 992 | err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); |
973 | if (err) { | 993 | if (err) { |
974 | p9pdu_dump(1, req->rc); | 994 | P9_DUMP_PKT(1, req->rc); |
975 | p9_free_req(clnt, req); | 995 | p9_free_req(clnt, req); |
976 | goto clunk_fid; | 996 | goto clunk_fid; |
977 | } | 997 | } |
@@ -1038,7 +1058,7 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
1038 | 1058 | ||
1039 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1059 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1040 | if (err) { | 1060 | if (err) { |
1041 | p9pdu_dump(1, req->rc); | 1061 | P9_DUMP_PKT(1, req->rc); |
1042 | goto free_and_error; | 1062 | goto free_and_error; |
1043 | } | 1063 | } |
1044 | 1064 | ||
@@ -1081,7 +1101,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | |||
1081 | 1101 | ||
1082 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); | 1102 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); |
1083 | if (err) { | 1103 | if (err) { |
1084 | p9pdu_dump(1, req->rc); | 1104 | P9_DUMP_PKT(1, req->rc); |
1085 | goto free_and_error; | 1105 | goto free_and_error; |
1086 | } | 1106 | } |
1087 | 1107 | ||
@@ -1126,7 +1146,7 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | |||
1126 | 1146 | ||
1127 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); | 1147 | err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); |
1128 | if (err) { | 1148 | if (err) { |
1129 | p9pdu_dump(1, req->rc); | 1149 | P9_DUMP_PKT(1, req->rc); |
1130 | goto free_and_error; | 1150 | goto free_and_error; |
1131 | } | 1151 | } |
1132 | 1152 | ||
@@ -1165,7 +1185,7 @@ int p9_client_symlink(struct p9_fid *dfid, char *name, char *symtgt, gid_t gid, | |||
1165 | 1185 | ||
1166 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 1186 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
1167 | if (err) { | 1187 | if (err) { |
1168 | p9pdu_dump(1, req->rc); | 1188 | P9_DUMP_PKT(1, req->rc); |
1169 | goto free_and_error; | 1189 | goto free_and_error; |
1170 | } | 1190 | } |
1171 | 1191 | ||
@@ -1249,9 +1269,11 @@ int p9_client_clunk(struct p9_fid *fid) | |||
1249 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCLUNK fid %d\n", fid->fid); | 1269 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCLUNK fid %d\n", fid->fid); |
1250 | 1270 | ||
1251 | p9_free_req(clnt, req); | 1271 | p9_free_req(clnt, req); |
1252 | p9_fid_destroy(fid); | ||
1253 | |||
1254 | error: | 1272 | error: |
1273 | /* | ||
1274 | * Fid is not valid even after a failed clunk | ||
1275 | */ | ||
1276 | p9_fid_destroy(fid); | ||
1255 | return err; | 1277 | return err; |
1256 | } | 1278 | } |
1257 | EXPORT_SYMBOL(p9_client_clunk); | 1279 | EXPORT_SYMBOL(p9_client_clunk); |
@@ -1281,6 +1303,29 @@ error: | |||
1281 | } | 1303 | } |
1282 | EXPORT_SYMBOL(p9_client_remove); | 1304 | EXPORT_SYMBOL(p9_client_remove); |
1283 | 1305 | ||
1306 | int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags) | ||
1307 | { | ||
1308 | int err = 0; | ||
1309 | struct p9_req_t *req; | ||
1310 | struct p9_client *clnt; | ||
1311 | |||
1312 | P9_DPRINTK(P9_DEBUG_9P, ">>> TUNLINKAT fid %d %s %d\n", | ||
1313 | dfid->fid, name, flags); | ||
1314 | |||
1315 | clnt = dfid->clnt; | ||
1316 | req = p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->fid, name, flags); | ||
1317 | if (IS_ERR(req)) { | ||
1318 | err = PTR_ERR(req); | ||
1319 | goto error; | ||
1320 | } | ||
1321 | P9_DPRINTK(P9_DEBUG_9P, "<<< RUNLINKAT fid %d %s\n", dfid->fid, name); | ||
1322 | |||
1323 | p9_free_req(clnt, req); | ||
1324 | error: | ||
1325 | return err; | ||
1326 | } | ||
1327 | EXPORT_SYMBOL(p9_client_unlinkat); | ||
1328 | |||
1284 | int | 1329 | int |
1285 | p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, | 1330 | p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, |
1286 | u32 count) | 1331 | u32 count) |
@@ -1318,11 +1363,12 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset, | |||
1318 | 1363 | ||
1319 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); | 1364 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); |
1320 | if (err) { | 1365 | if (err) { |
1321 | p9pdu_dump(1, req->rc); | 1366 | P9_DUMP_PKT(1, req->rc); |
1322 | goto free_and_error; | 1367 | goto free_and_error; |
1323 | } | 1368 | } |
1324 | 1369 | ||
1325 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); | 1370 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREAD count %d\n", count); |
1371 | P9_DUMP_PKT(1, req->rc); | ||
1326 | 1372 | ||
1327 | if (!req->tc->pbuf_size) { | 1373 | if (!req->tc->pbuf_size) { |
1328 | if (data) { | 1374 | if (data) { |
@@ -1386,7 +1432,7 @@ p9_client_write(struct p9_fid *fid, char *data, const char __user *udata, | |||
1386 | 1432 | ||
1387 | err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); | 1433 | err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); |
1388 | if (err) { | 1434 | if (err) { |
1389 | p9pdu_dump(1, req->rc); | 1435 | P9_DUMP_PKT(1, req->rc); |
1390 | goto free_and_error; | 1436 | goto free_and_error; |
1391 | } | 1437 | } |
1392 | 1438 | ||
@@ -1426,7 +1472,7 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) | |||
1426 | 1472 | ||
1427 | err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); | 1473 | err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); |
1428 | if (err) { | 1474 | if (err) { |
1429 | p9pdu_dump(1, req->rc); | 1475 | P9_DUMP_PKT(1, req->rc); |
1430 | p9_free_req(clnt, req); | 1476 | p9_free_req(clnt, req); |
1431 | goto error; | 1477 | goto error; |
1432 | } | 1478 | } |
@@ -1477,7 +1523,7 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, | |||
1477 | 1523 | ||
1478 | err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); | 1524 | err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); |
1479 | if (err) { | 1525 | if (err) { |
1480 | p9pdu_dump(1, req->rc); | 1526 | P9_DUMP_PKT(1, req->rc); |
1481 | p9_free_req(clnt, req); | 1527 | p9_free_req(clnt, req); |
1482 | goto error; | 1528 | goto error; |
1483 | } | 1529 | } |
@@ -1625,7 +1671,7 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb) | |||
1625 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, | 1671 | &sb->bsize, &sb->blocks, &sb->bfree, &sb->bavail, |
1626 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); | 1672 | &sb->files, &sb->ffree, &sb->fsid, &sb->namelen); |
1627 | if (err) { | 1673 | if (err) { |
1628 | p9pdu_dump(1, req->rc); | 1674 | P9_DUMP_PKT(1, req->rc); |
1629 | p9_free_req(clnt, req); | 1675 | p9_free_req(clnt, req); |
1630 | goto error; | 1676 | goto error; |
1631 | } | 1677 | } |
@@ -1643,7 +1689,8 @@ error: | |||
1643 | } | 1689 | } |
1644 | EXPORT_SYMBOL(p9_client_statfs); | 1690 | EXPORT_SYMBOL(p9_client_statfs); |
1645 | 1691 | ||
1646 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name) | 1692 | int p9_client_rename(struct p9_fid *fid, |
1693 | struct p9_fid *newdirfid, const char *name) | ||
1647 | { | 1694 | { |
1648 | int err; | 1695 | int err; |
1649 | struct p9_req_t *req; | 1696 | struct p9_req_t *req; |
@@ -1670,6 +1717,36 @@ error: | |||
1670 | } | 1717 | } |
1671 | EXPORT_SYMBOL(p9_client_rename); | 1718 | EXPORT_SYMBOL(p9_client_rename); |
1672 | 1719 | ||
1720 | int p9_client_renameat(struct p9_fid *olddirfid, const char *old_name, | ||
1721 | struct p9_fid *newdirfid, const char *new_name) | ||
1722 | { | ||
1723 | int err; | ||
1724 | struct p9_req_t *req; | ||
1725 | struct p9_client *clnt; | ||
1726 | |||
1727 | err = 0; | ||
1728 | clnt = olddirfid->clnt; | ||
1729 | |||
1730 | P9_DPRINTK(P9_DEBUG_9P, ">>> TRENAMEAT olddirfid %d old name %s" | ||
1731 | " newdirfid %d new name %s\n", olddirfid->fid, old_name, | ||
1732 | newdirfid->fid, new_name); | ||
1733 | |||
1734 | req = p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid, | ||
1735 | old_name, newdirfid->fid, new_name); | ||
1736 | if (IS_ERR(req)) { | ||
1737 | err = PTR_ERR(req); | ||
1738 | goto error; | ||
1739 | } | ||
1740 | |||
1741 | P9_DPRINTK(P9_DEBUG_9P, "<<< RRENAMEAT newdirfid %d new name %s\n", | ||
1742 | newdirfid->fid, new_name); | ||
1743 | |||
1744 | p9_free_req(clnt, req); | ||
1745 | error: | ||
1746 | return err; | ||
1747 | } | ||
1748 | EXPORT_SYMBOL(p9_client_renameat); | ||
1749 | |||
1673 | /* | 1750 | /* |
1674 | * An xattrwalk without @attr_name gives the fid for the lisxattr namespace | 1751 | * An xattrwalk without @attr_name gives the fid for the lisxattr namespace |
1675 | */ | 1752 | */ |
@@ -1701,7 +1778,7 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, | |||
1701 | } | 1778 | } |
1702 | err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); | 1779 | err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); |
1703 | if (err) { | 1780 | if (err) { |
1704 | p9pdu_dump(1, req->rc); | 1781 | P9_DUMP_PKT(1, req->rc); |
1705 | p9_free_req(clnt, req); | 1782 | p9_free_req(clnt, req); |
1706 | goto clunk_fid; | 1783 | goto clunk_fid; |
1707 | } | 1784 | } |
@@ -1780,7 +1857,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset) | |||
1780 | 1857 | ||
1781 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); | 1858 | err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); |
1782 | if (err) { | 1859 | if (err) { |
1783 | p9pdu_dump(1, req->rc); | 1860 | P9_DUMP_PKT(1, req->rc); |
1784 | goto free_and_error; | 1861 | goto free_and_error; |
1785 | } | 1862 | } |
1786 | 1863 | ||
@@ -1817,7 +1894,7 @@ int p9_client_mknod_dotl(struct p9_fid *fid, char *name, int mode, | |||
1817 | 1894 | ||
1818 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 1895 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
1819 | if (err) { | 1896 | if (err) { |
1820 | p9pdu_dump(1, req->rc); | 1897 | P9_DUMP_PKT(1, req->rc); |
1821 | goto error; | 1898 | goto error; |
1822 | } | 1899 | } |
1823 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, | 1900 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, |
@@ -1848,7 +1925,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | |||
1848 | 1925 | ||
1849 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); | 1926 | err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); |
1850 | if (err) { | 1927 | if (err) { |
1851 | p9pdu_dump(1, req->rc); | 1928 | P9_DUMP_PKT(1, req->rc); |
1852 | goto error; | 1929 | goto error; |
1853 | } | 1930 | } |
1854 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, | 1931 | P9_DPRINTK(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, |
@@ -1883,7 +1960,7 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status) | |||
1883 | 1960 | ||
1884 | err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); | 1961 | err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); |
1885 | if (err) { | 1962 | if (err) { |
1886 | p9pdu_dump(1, req->rc); | 1963 | P9_DUMP_PKT(1, req->rc); |
1887 | goto error; | 1964 | goto error; |
1888 | } | 1965 | } |
1889 | P9_DPRINTK(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); | 1966 | P9_DPRINTK(P9_DEBUG_9P, "<<< RLOCK status %i\n", *status); |
@@ -1916,7 +1993,7 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *glock) | |||
1916 | &glock->start, &glock->length, &glock->proc_id, | 1993 | &glock->start, &glock->length, &glock->proc_id, |
1917 | &glock->client_id); | 1994 | &glock->client_id); |
1918 | if (err) { | 1995 | if (err) { |
1919 | p9pdu_dump(1, req->rc); | 1996 | P9_DUMP_PKT(1, req->rc); |
1920 | goto error; | 1997 | goto error; |
1921 | } | 1998 | } |
1922 | P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " | 1999 | P9_DPRINTK(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " |
@@ -1944,7 +2021,7 @@ int p9_client_readlink(struct p9_fid *fid, char **target) | |||
1944 | 2021 | ||
1945 | err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); | 2022 | err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); |
1946 | if (err) { | 2023 | if (err) { |
1947 | p9pdu_dump(1, req->rc); | 2024 | P9_DUMP_PKT(1, req->rc); |
1948 | goto error; | 2025 | goto error; |
1949 | } | 2026 | } |
1950 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); | 2027 | P9_DPRINTK(P9_DEBUG_9P, "<<< RREADLINK target %s\n", *target); |
diff --git a/net/9p/mod.c b/net/9p/mod.c index 72c398275051..2664d1292291 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c | |||
@@ -80,14 +80,14 @@ EXPORT_SYMBOL(v9fs_unregister_trans); | |||
80 | * @name: string identifying transport | 80 | * @name: string identifying transport |
81 | * | 81 | * |
82 | */ | 82 | */ |
83 | struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name) | 83 | struct p9_trans_module *v9fs_get_trans_by_name(char *s) |
84 | { | 84 | { |
85 | struct p9_trans_module *t, *found = NULL; | 85 | struct p9_trans_module *t, *found = NULL; |
86 | 86 | ||
87 | spin_lock(&v9fs_trans_lock); | 87 | spin_lock(&v9fs_trans_lock); |
88 | 88 | ||
89 | list_for_each_entry(t, &v9fs_trans_list, list) | 89 | list_for_each_entry(t, &v9fs_trans_list, list) |
90 | if (strncmp(t->name, name->from, name->to-name->from) == 0 && | 90 | if (strcmp(t->name, s) == 0 && |
91 | try_module_get(t->owner)) { | 91 | try_module_get(t->owner)) { |
92 | found = t; | 92 | found = t; |
93 | break; | 93 | break; |
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index a873277cb996..df58375ea6b3 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -44,30 +44,24 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); | |||
44 | void | 44 | void |
45 | p9pdu_dump(int way, struct p9_fcall *pdu) | 45 | p9pdu_dump(int way, struct p9_fcall *pdu) |
46 | { | 46 | { |
47 | int i, n; | 47 | int len = pdu->size; |
48 | u8 *data = pdu->sdata; | 48 | |
49 | int datalen = pdu->size; | 49 | if ((p9_debug_level & P9_DEBUG_VPKT) != P9_DEBUG_VPKT) { |
50 | char buf[255]; | 50 | if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) { |
51 | int buflen = 255; | 51 | if (len > 32) |
52 | 52 | len = 32; | |
53 | i = n = 0; | 53 | } else { |
54 | if (datalen > (buflen-16)) | 54 | /* shouldn't happen */ |
55 | datalen = buflen-16; | 55 | return; |
56 | while (i < datalen) { | 56 | } |
57 | n += scnprintf(buf + n, buflen - n, "%02x ", data[i]); | ||
58 | if (i%4 == 3) | ||
59 | n += scnprintf(buf + n, buflen - n, " "); | ||
60 | if (i%32 == 31) | ||
61 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
62 | |||
63 | i++; | ||
64 | } | 57 | } |
65 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
66 | 58 | ||
67 | if (way) | 59 | if (way) |
68 | P9_DPRINTK(P9_DEBUG_PKT, "[[[(%d) %s\n", datalen, buf); | 60 | print_hex_dump_bytes("[9P] ", DUMP_PREFIX_OFFSET, pdu->sdata, |
61 | len); | ||
69 | else | 62 | else |
70 | P9_DPRINTK(P9_DEBUG_PKT, "]]](%d) %s\n", datalen, buf); | 63 | print_hex_dump_bytes("]9P[ ", DUMP_PREFIX_OFFSET, pdu->sdata, |
64 | len); | ||
71 | } | 65 | } |
72 | #else | 66 | #else |
73 | void | 67 | void |
@@ -610,7 +604,7 @@ int p9stat_read(char *buf, int len, struct p9_wstat *st, int proto_version) | |||
610 | ret = p9pdu_readf(&fake_pdu, proto_version, "S", st); | 604 | ret = p9pdu_readf(&fake_pdu, proto_version, "S", st); |
611 | if (ret) { | 605 | if (ret) { |
612 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); | 606 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9stat_read failed: %d\n", ret); |
613 | p9pdu_dump(1, &fake_pdu); | 607 | P9_DUMP_PKT(0, &fake_pdu); |
614 | } | 608 | } |
615 | 609 | ||
616 | return ret; | 610 | return ret; |
@@ -632,11 +626,7 @@ int p9pdu_finalize(struct p9_fcall *pdu) | |||
632 | err = p9pdu_writef(pdu, 0, "d", size); | 626 | err = p9pdu_writef(pdu, 0, "d", size); |
633 | pdu->size = size; | 627 | pdu->size = size; |
634 | 628 | ||
635 | #ifdef CONFIG_NET_9P_DEBUG | 629 | P9_DUMP_PKT(0, pdu); |
636 | if ((p9_debug_level & P9_DEBUG_PKT) == P9_DEBUG_PKT) | ||
637 | p9pdu_dump(0, pdu); | ||
638 | #endif | ||
639 | |||
640 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, | 630 | P9_DPRINTK(P9_DEBUG_9P, ">>> size=%d type: %d tag: %d\n", pdu->size, |
641 | pdu->id, pdu->tag); | 631 | pdu->id, pdu->tag); |
642 | 632 | ||
@@ -669,7 +659,7 @@ int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | |||
669 | &dirent->d_off, &dirent->d_type, &nameptr); | 659 | &dirent->d_off, &dirent->d_type, &nameptr); |
670 | if (ret) { | 660 | if (ret) { |
671 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); | 661 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); |
672 | p9pdu_dump(1, &fake_pdu); | 662 | P9_DUMP_PKT(1, &fake_pdu); |
673 | goto out; | 663 | goto out; |
674 | } | 664 | } |
675 | 665 | ||
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 244e70742183..175b5135bdcf 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -367,7 +367,7 @@ req_retry_pinned: | |||
367 | in += inp; | 367 | in += inp; |
368 | } else { | 368 | } else { |
369 | in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, | 369 | in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, |
370 | client->msize); | 370 | req->rc->capacity); |
371 | } | 371 | } |
372 | 372 | ||
373 | err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc); | 373 | err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc); |
@@ -592,7 +592,7 @@ static struct p9_trans_module p9_virtio_trans = { | |||
592 | .close = p9_virtio_close, | 592 | .close = p9_virtio_close, |
593 | .request = p9_virtio_request, | 593 | .request = p9_virtio_request, |
594 | .cancel = p9_virtio_cancel, | 594 | .cancel = p9_virtio_cancel, |
595 | .maxsize = PAGE_SIZE*16, | 595 | .maxsize = PAGE_SIZE*VIRTQUEUE_NUM, |
596 | .pref = P9_TRANS_PREF_PAYLOAD_SEP, | 596 | .pref = P9_TRANS_PREF_PAYLOAD_SEP, |
597 | .def = 0, | 597 | .def = 0, |
598 | .owner = THIS_MODULE, | 598 | .owner = THIS_MODULE, |
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c index 7f9124914b13..f2b713847b45 100644 --- a/net/iucv/iucv.c +++ b/net/iucv/iucv.c | |||
@@ -1988,12 +1988,13 @@ static int __init iucv_init(void) | |||
1988 | rc = -EPROTONOSUPPORT; | 1988 | rc = -EPROTONOSUPPORT; |
1989 | goto out; | 1989 | goto out; |
1990 | } | 1990 | } |
1991 | ctl_set_bit(0, 1); | ||
1991 | rc = iucv_query_maxconn(); | 1992 | rc = iucv_query_maxconn(); |
1992 | if (rc) | 1993 | if (rc) |
1993 | goto out; | 1994 | goto out_ctl; |
1994 | rc = register_external_interrupt(0x4000, iucv_external_interrupt); | 1995 | rc = register_external_interrupt(0x4000, iucv_external_interrupt); |
1995 | if (rc) | 1996 | if (rc) |
1996 | goto out; | 1997 | goto out_ctl; |
1997 | iucv_root = root_device_register("iucv"); | 1998 | iucv_root = root_device_register("iucv"); |
1998 | if (IS_ERR(iucv_root)) { | 1999 | if (IS_ERR(iucv_root)) { |
1999 | rc = PTR_ERR(iucv_root); | 2000 | rc = PTR_ERR(iucv_root); |
@@ -2055,6 +2056,8 @@ out_free: | |||
2055 | root_device_unregister(iucv_root); | 2056 | root_device_unregister(iucv_root); |
2056 | out_int: | 2057 | out_int: |
2057 | unregister_external_interrupt(0x4000, iucv_external_interrupt); | 2058 | unregister_external_interrupt(0x4000, iucv_external_interrupt); |
2059 | out_ctl: | ||
2060 | ctl_clear_bit(0, 1); | ||
2058 | out: | 2061 | out: |
2059 | return rc; | 2062 | return rc; |
2060 | } | 2063 | } |
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c index de079abd5bc8..f264032b8c56 100644 --- a/net/netfilter/xt_RATEEST.c +++ b/net/netfilter/xt_RATEEST.c | |||
@@ -60,11 +60,6 @@ struct xt_rateest *xt_rateest_lookup(const char *name) | |||
60 | } | 60 | } |
61 | EXPORT_SYMBOL_GPL(xt_rateest_lookup); | 61 | EXPORT_SYMBOL_GPL(xt_rateest_lookup); |
62 | 62 | ||
63 | static void xt_rateest_free_rcu(struct rcu_head *head) | ||
64 | { | ||
65 | kfree(container_of(head, struct xt_rateest, rcu)); | ||
66 | } | ||
67 | |||
68 | void xt_rateest_put(struct xt_rateest *est) | 63 | void xt_rateest_put(struct xt_rateest *est) |
69 | { | 64 | { |
70 | mutex_lock(&xt_rateest_mutex); | 65 | mutex_lock(&xt_rateest_mutex); |
@@ -75,7 +70,7 @@ void xt_rateest_put(struct xt_rateest *est) | |||
75 | * gen_estimator est_timer() might access est->lock or bstats, | 70 | * gen_estimator est_timer() might access est->lock or bstats, |
76 | * wait a RCU grace period before freeing 'est' | 71 | * wait a RCU grace period before freeing 'est' |
77 | */ | 72 | */ |
78 | call_rcu(&est->rcu, xt_rateest_free_rcu); | 73 | kfree_rcu(est, rcu); |
79 | } | 74 | } |
80 | mutex_unlock(&xt_rateest_mutex); | 75 | mutex_unlock(&xt_rateest_mutex); |
81 | } | 76 | } |
@@ -188,7 +183,6 @@ static int __init xt_rateest_tg_init(void) | |||
188 | static void __exit xt_rateest_tg_fini(void) | 183 | static void __exit xt_rateest_tg_fini(void) |
189 | { | 184 | { |
190 | xt_unregister_target(&xt_rateest_tg_reg); | 185 | xt_unregister_target(&xt_rateest_tg_reg); |
191 | rcu_barrier(); /* Wait for completion of call_rcu()'s (xt_rateest_free_rcu) */ | ||
192 | } | 186 | } |
193 | 187 | ||
194 | 188 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 7389b7da3a8d..c50818f0473b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -97,8 +97,7 @@ static int | |||
97 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | 97 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) |
98 | { | 98 | { |
99 | static uint32_t clntid; | 99 | static uint32_t clntid; |
100 | struct nameidata nd; | 100 | struct path path, dir; |
101 | struct path path; | ||
102 | char name[15]; | 101 | char name[15]; |
103 | struct qstr q = { | 102 | struct qstr q = { |
104 | .name = name, | 103 | .name = name, |
@@ -113,7 +112,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | |||
113 | path.mnt = rpc_get_mount(); | 112 | path.mnt = rpc_get_mount(); |
114 | if (IS_ERR(path.mnt)) | 113 | if (IS_ERR(path.mnt)) |
115 | return PTR_ERR(path.mnt); | 114 | return PTR_ERR(path.mnt); |
116 | error = vfs_path_lookup(path.mnt->mnt_root, path.mnt, dir_name, 0, &nd); | 115 | error = vfs_path_lookup(path.mnt->mnt_root, path.mnt, dir_name, 0, &dir); |
117 | if (error) | 116 | if (error) |
118 | goto err; | 117 | goto err; |
119 | 118 | ||
@@ -121,7 +120,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | |||
121 | q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++); | 120 | q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++); |
122 | name[sizeof(name) - 1] = '\0'; | 121 | name[sizeof(name) - 1] = '\0'; |
123 | q.hash = full_name_hash(q.name, q.len); | 122 | q.hash = full_name_hash(q.name, q.len); |
124 | path.dentry = rpc_create_client_dir(nd.path.dentry, &q, clnt); | 123 | path.dentry = rpc_create_client_dir(dir.dentry, &q, clnt); |
125 | if (!IS_ERR(path.dentry)) | 124 | if (!IS_ERR(path.dentry)) |
126 | break; | 125 | break; |
127 | error = PTR_ERR(path.dentry); | 126 | error = PTR_ERR(path.dentry); |
@@ -132,11 +131,11 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | |||
132 | goto err_path_put; | 131 | goto err_path_put; |
133 | } | 132 | } |
134 | } | 133 | } |
135 | path_put(&nd.path); | 134 | path_put(&dir); |
136 | clnt->cl_path = path; | 135 | clnt->cl_path = path; |
137 | return 0; | 136 | return 0; |
138 | err_path_put: | 137 | err_path_put: |
139 | path_put(&nd.path); | 138 | path_put(&dir); |
140 | err: | 139 | err: |
141 | rpc_put_mount(); | 140 | rpc_put_mount(); |
142 | return error; | 141 | return error; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 0722a25a3a33..ec68e1c05b85 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -808,8 +808,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
808 | struct net *net = sock_net(sk); | 808 | struct net *net = sock_net(sk); |
809 | struct unix_sock *u = unix_sk(sk); | 809 | struct unix_sock *u = unix_sk(sk); |
810 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; | 810 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
811 | char *sun_path = sunaddr->sun_path; | ||
811 | struct dentry *dentry = NULL; | 812 | struct dentry *dentry = NULL; |
812 | struct nameidata nd; | 813 | struct path path; |
813 | int err; | 814 | int err; |
814 | unsigned hash; | 815 | unsigned hash; |
815 | struct unix_address *addr; | 816 | struct unix_address *addr; |
@@ -845,48 +846,44 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
845 | addr->hash = hash ^ sk->sk_type; | 846 | addr->hash = hash ^ sk->sk_type; |
846 | atomic_set(&addr->refcnt, 1); | 847 | atomic_set(&addr->refcnt, 1); |
847 | 848 | ||
848 | if (sunaddr->sun_path[0]) { | 849 | if (sun_path[0]) { |
849 | unsigned int mode; | 850 | unsigned int mode; |
850 | err = 0; | 851 | err = 0; |
851 | /* | 852 | /* |
852 | * Get the parent directory, calculate the hash for last | 853 | * Get the parent directory, calculate the hash for last |
853 | * component. | 854 | * component. |
854 | */ | 855 | */ |
855 | err = kern_path_parent(sunaddr->sun_path, &nd); | 856 | dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); |
856 | if (err) | ||
857 | goto out_mknod_parent; | ||
858 | |||
859 | dentry = lookup_create(&nd, 0); | ||
860 | err = PTR_ERR(dentry); | 857 | err = PTR_ERR(dentry); |
861 | if (IS_ERR(dentry)) | 858 | if (IS_ERR(dentry)) |
862 | goto out_mknod_unlock; | 859 | goto out_mknod_parent; |
863 | 860 | ||
864 | /* | 861 | /* |
865 | * All right, let's create it. | 862 | * All right, let's create it. |
866 | */ | 863 | */ |
867 | mode = S_IFSOCK | | 864 | mode = S_IFSOCK | |
868 | (SOCK_INODE(sock)->i_mode & ~current_umask()); | 865 | (SOCK_INODE(sock)->i_mode & ~current_umask()); |
869 | err = mnt_want_write(nd.path.mnt); | 866 | err = mnt_want_write(path.mnt); |
870 | if (err) | 867 | if (err) |
871 | goto out_mknod_dput; | 868 | goto out_mknod_dput; |
872 | err = security_path_mknod(&nd.path, dentry, mode, 0); | 869 | err = security_path_mknod(&path, dentry, mode, 0); |
873 | if (err) | 870 | if (err) |
874 | goto out_mknod_drop_write; | 871 | goto out_mknod_drop_write; |
875 | err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0); | 872 | err = vfs_mknod(path.dentry->d_inode, dentry, mode, 0); |
876 | out_mknod_drop_write: | 873 | out_mknod_drop_write: |
877 | mnt_drop_write(nd.path.mnt); | 874 | mnt_drop_write(path.mnt); |
878 | if (err) | 875 | if (err) |
879 | goto out_mknod_dput; | 876 | goto out_mknod_dput; |
880 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 877 | mutex_unlock(&path.dentry->d_inode->i_mutex); |
881 | dput(nd.path.dentry); | 878 | dput(path.dentry); |
882 | nd.path.dentry = dentry; | 879 | path.dentry = dentry; |
883 | 880 | ||
884 | addr->hash = UNIX_HASH_SIZE; | 881 | addr->hash = UNIX_HASH_SIZE; |
885 | } | 882 | } |
886 | 883 | ||
887 | spin_lock(&unix_table_lock); | 884 | spin_lock(&unix_table_lock); |
888 | 885 | ||
889 | if (!sunaddr->sun_path[0]) { | 886 | if (!sun_path[0]) { |
890 | err = -EADDRINUSE; | 887 | err = -EADDRINUSE; |
891 | if (__unix_find_socket_byname(net, sunaddr, addr_len, | 888 | if (__unix_find_socket_byname(net, sunaddr, addr_len, |
892 | sk->sk_type, hash)) { | 889 | sk->sk_type, hash)) { |
@@ -897,8 +894,8 @@ out_mknod_drop_write: | |||
897 | list = &unix_socket_table[addr->hash]; | 894 | list = &unix_socket_table[addr->hash]; |
898 | } else { | 895 | } else { |
899 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; | 896 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; |
900 | u->dentry = nd.path.dentry; | 897 | u->dentry = path.dentry; |
901 | u->mnt = nd.path.mnt; | 898 | u->mnt = path.mnt; |
902 | } | 899 | } |
903 | 900 | ||
904 | err = 0; | 901 | err = 0; |
@@ -915,9 +912,8 @@ out: | |||
915 | 912 | ||
916 | out_mknod_dput: | 913 | out_mknod_dput: |
917 | dput(dentry); | 914 | dput(dentry); |
918 | out_mknod_unlock: | 915 | mutex_unlock(&path.dentry->d_inode->i_mutex); |
919 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 916 | path_put(&path); |
920 | path_put(&nd.path); | ||
921 | out_mknod_parent: | 917 | out_mknod_parent: |
922 | if (err == -EEXIST) | 918 | if (err == -EEXIST) |
923 | err = -EADDRINUSE; | 919 | err = -EADDRINUSE; |