summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2023-01-30 12:30:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 16:31:58 +0100
commitba4183a6e8662117081ac84d4b4663eeb256f1e0 (patch)
treec0057b74c19ec85e9ad2fa8518a6aa9ba835285b
parentc6fa3f01152f1499f1efb88d63d8d737eb857722 (diff)
downloadlinux-stable-ba4183a6e8662117081ac84d4b4663eeb256f1e0.tar.gz
linux-stable-ba4183a6e8662117081ac84d4b4663eeb256f1e0.tar.bz2
linux-stable-ba4183a6e8662117081ac84d4b4663eeb256f1e0.zip
9p/xen: fix version parsing
[ Upstream commit f1956f4ec15195ec60976d9b5625326285ab102e ] 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/20230130113036.7087-2-jgross@suse.com Fixes: 71ebd71921e4 ("xen/9pfs: connect to the backend") Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/9p/trans_xen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 6459c2356ff9..c4aea1e3134c 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -395,13 +395,19 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
int ret, i;
struct xenbus_transaction xbt;
struct xen_9pfs_front_priv *priv = NULL;
- char *versions;
+ char *versions, *v;
unsigned int max_rings, max_ring_order, len = 0;
versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len);
if (IS_ERR(versions))
return PTR_ERR(versions);
- if (strcmp(versions, "1")) {
+ for (v = versions; *v; v++) {
+ if (simple_strtoul(v, &v, 10) == 1) {
+ v = NULL;
+ break;
+ }
+ }
+ if (v) {
kfree(versions);
return -EINVAL;
}