Skip to content

Commit

Permalink
net/9p: Mount only matching virtio channels
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Sven Eckelmann authored and davem330 committed Sep 27, 2010
1 parent 387a856 commit 0b20406
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/9p/trans_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0b20406

Please sign in to comment.