Skip to content

Commit 0b20406

Browse files
Sven Eckelmanndavem330
authored andcommitted
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>
1 parent 387a856 commit 0b20406

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/9p/trans_virtio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
329329

330330
mutex_lock(&virtio_9p_lock);
331331
list_for_each_entry(chan, &virtio_chan_list, chan_list) {
332-
if (!strncmp(devname, chan->tag, chan->tag_len)) {
332+
if (!strncmp(devname, chan->tag, chan->tag_len) &&
333+
strlen(devname) == chan->tag_len) {
333334
if (!chan->inuse) {
334335
chan->inuse = true;
335336
found = 1;

0 commit comments

Comments
 (0)