summaryrefslogtreecommitdiff
path: root/net/9p
diff options
context:
space:
mode:
authorDominique Martinet <dominique.martinet@cea.fr>2018-08-14 05:43:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-03 14:15:58 +0300
commit26b3b1dbb3954edd26665890ee4ca785fb5f6ffa (patch)
treeaa4b5abd8017bed03c29aeaf2f45ee4dd582250b /net/9p
parentff325dc466cc4bf77f03abf0763e395b45102c61 (diff)
downloadlinux-26b3b1dbb3954edd26665890ee4ca785fb5f6ffa.tar.xz
9p/xen: fix check for xenbus_read error in front_probe
[ Upstream commit 2f9ad0ac947ccbe3ffe7c6229c9330f2a7755f64 ] If the xen bus exists but does not expose the proper interface, it is possible to get a non-zero length but still some error, leading to strcmp failing trying to load invalid memory addresses e.g. fffffffffffffffe. There is then no need to check length when there is no error, as the xenbus driver guarantees that the string is nul-terminated. Link: http://lkml.kernel.org/r/1534236007-10170-1-git-send-email-asmadeus@codewreck.org Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Cc: Eric Van Hensbergen <ericvh@gmail.com> Cc: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/trans_xen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index c10bdf63eae7..389eb635ec2c 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -392,8 +392,8 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
unsigned int max_rings, max_ring_order, len = 0;
versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len);
- if (!len)
- return -EINVAL;
+ if (IS_ERR(versions))
+ return PTR_ERR(versions);
if (strcmp(versions, "1")) {
kfree(versions);
return -EINVAL;