diff options
author | Sven Eckelmann <sven.eckelmann@gmx.de> | 2010-09-27 15:54:44 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-27 15:54:44 -0700 |
commit | 0b20406cda621c2495d10baab1e87127ceb43337 (patch) | |
tree | 10befc92130dbe19406b781b16bf312c77c03f89 /net/9p | |
parent | 387a85628782690b56492dae4bbf544639f5d4a9 (diff) |
net/9p: Mount only matching virtio channels
p9_virtio_create will only compare the the channel's tag characters
against the device name till the end of the channel's tag but not till
the end of the device name. This means that if a user defines channels
with the tags foo and foobar then he would mount foo when he requested
foonot and may mount foo when he requested foobar.
Thus it is necessary to check both string lengths against each other in
case of a successful partial string match.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/trans_virtio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index dcfbe99ff81..b88515936e4 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -329,7 +329,8 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) mutex_lock(&virtio_9p_lock); list_for_each_entry(chan, &virtio_chan_list, chan_list) { - if (!strncmp(devname, chan->tag, chan->tag_len)) { + if (!strncmp(devname, chan->tag, chan->tag_len) && + strlen(devname) == chan->tag_len) { if (!chan->inuse) { chan->inuse = true; found = 1; |