summaryrefslogtreecommitdiff
path: root/net/9p
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@opteron.9grid.us>2008-05-08 20:26:37 -0500
committerEric Van Hensbergen <ericvh@opteron.9grid.us>2008-05-14 19:23:27 -0500
commit887b3ece65be7b643dfdae0d433c91a26a3f437d (patch)
tree471889dcdd3f7eb6762d863fef236014c63a0301 /net/9p
parent332c421e67045343de74e644cdf389f559f0d83f (diff)
downloadlinux-3.10-887b3ece65be7b643dfdae0d433c91a26a3f437d.tar.gz
linux-3.10-887b3ece65be7b643dfdae0d433c91a26a3f437d.tar.bz2
linux-3.10-887b3ece65be7b643dfdae0d433c91a26a3f437d.zip
9p: fix error path during early mount
There was some cleanup issues during early mount which would trigger a kernel bug for certain types of failure. This patch reorganizes the cleanup to get rid of the bad behavior. This also merges the 9pnet and 9pnet_fd modules for the purpose of configuration and initialization. Keeping the fd transport separate from the core 9pnet code seemed like a good idea at the time, but in practice has caused more harm and confusion than good. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/Kconfig10
-rw-r--r--net/9p/Makefile3
-rw-r--r--net/9p/mod.c1
-rw-r--r--net/9p/trans_fd.c29
4 files changed, 23 insertions, 20 deletions
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index bafc50c9e6f..ff34c5acc13 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -13,16 +13,6 @@ menuconfig NET_9P
If unsure, say N.
-config NET_9P_FD
- depends on NET_9P
- default y if NET_9P
- tristate "9P File Descriptor Transports (Experimental)"
- help
- This builds support for file descriptor transports for 9p
- which includes support for TCP/IP, named pipes, or passed
- file descriptors. TCP/IP is the default transport for 9p,
- so if you are going to use 9p, you'll likely want this.
-
config NET_9P_VIRTIO
depends on NET_9P && EXPERIMENTAL && VIRTIO
tristate "9P Virtio Transport (Experimental)"
diff --git a/net/9p/Makefile b/net/9p/Makefile
index 8a105110189..519219480db 100644
--- a/net/9p/Makefile
+++ b/net/9p/Makefile
@@ -1,5 +1,4 @@
obj-$(CONFIG_NET_9P) := 9pnet.o
-obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
9pnet-objs := \
@@ -9,8 +8,6 @@ obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
error.o \
fcprint.o \
util.o \
-
-9pnet_fd-objs := \
trans_fd.o \
9pnet_virtio-objs := \
diff --git a/net/9p/mod.c b/net/9p/mod.c
index c6d9695949e..bdee1fb7cc6 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -107,6 +107,7 @@ static int __init init_p9(void)
p9_error_init();
printk(KERN_INFO "Installing 9P2000 support\n");
+ p9_trans_fd_init();
return ret;
}
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 97b103b7049..4507f744f44 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -1433,6 +1433,23 @@ static void p9_fd_close(struct p9_trans *trans)
kfree(ts);
}
+/*
+ * stolen from NFS - maybe should be made a generic function?
+ */
+static inline int valid_ipaddr4(const char *buf)
+{
+ int rc, count, in[4];
+
+ rc = sscanf(buf, "%d.%d.%d.%d", &in[0], &in[1], &in[2], &in[3]);
+ if (rc != 4)
+ return -EINVAL;
+ for (count = 0; count < 4; count++) {
+ if (in[count] > 255)
+ return -EINVAL;
+ }
+ return 0;
+}
+
static struct p9_trans *
p9_trans_create_tcp(const char *addr, char *args, int msize, unsigned char dotu)
{
@@ -1447,6 +1464,9 @@ p9_trans_create_tcp(const char *addr, char *args, int msize, unsigned char dotu)
if (err < 0)
return ERR_PTR(err);
+ if (valid_ipaddr4(addr) < 0)
+ return ERR_PTR(-EINVAL);
+
csocket = NULL;
trans = kmalloc(sizeof(struct p9_trans), GFP_KERNEL);
if (!trans)
@@ -1625,7 +1645,7 @@ static struct p9_trans_module p9_fd_trans = {
.create = p9_trans_create_fd,
};
-static int __init p9_trans_fd_init(void)
+int p9_trans_fd_init(void)
{
int ret = p9_mux_global_init();
if (ret) {
@@ -1639,9 +1659,4 @@ static int __init p9_trans_fd_init(void)
return 0;
}
-
-module_init(p9_trans_fd_init);
-
-MODULE_AUTHOR("Latchesar Ionkov <lucho@ionkov.net>");
-MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
-MODULE_LICENSE("GPL");
+EXPORT_SYMBOL(p9_trans_fd_init);