Skip to content

Commit f1956f4

Browse files
jgross1ericvh
authored andcommitted
9p/xen: fix version parsing
When connecting the Xen 9pfs frontend to the backend, the "versions" Xenstore entry written by the backend is parsed in a wrong way. The "versions" entry is defined to contain the versions supported by the backend separated by commas (e.g. "1,2"). Today only version "1" is defined. Unfortunately the frontend doesn't look for "1" being listed in the entry, but it is expecting the entry to have the value "1". This will result in failure as soon as the backend will support e.g. versions "1" and "2". Fix that by scanning the entry correctly. Link: https://lkml.kernel.org/r/[email protected] Fixes: 71ebd71 ("xen/9pfs: connect to the backend") Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Dominique Martinet <[email protected]> Signed-off-by: Eric Van Hensbergen <[email protected]>
1 parent 344504e commit f1956f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

net/9p/trans_xen.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,19 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
379379
int ret, i;
380380
struct xenbus_transaction xbt;
381381
struct xen_9pfs_front_priv *priv = NULL;
382-
char *versions;
382+
char *versions, *v;
383383
unsigned int max_rings, max_ring_order, len = 0;
384384

385385
versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len);
386386
if (IS_ERR(versions))
387387
return PTR_ERR(versions);
388-
if (strcmp(versions, "1")) {
388+
for (v = versions; *v; v++) {
389+
if (simple_strtoul(v, &v, 10) == 1) {
390+
v = NULL;
391+
break;
392+
}
393+
}
394+
if (v) {
389395
kfree(versions);
390396
return -EINVAL;
391397
}

0 commit comments

Comments
 (0)