forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Eric Van Hensbergen
committed
May 15, 2008
1 parent
332c421
commit 887b3ec
Showing
8 changed files
with
47 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>"); | ||
MODULE_AUTHOR("Eric Van Hensbergen <[email protected]>"); | ||
MODULE_LICENSE("GPL"); | ||
EXPORT_SYMBOL(p9_trans_fd_init); |