Skip to contentSkip to conversation

virtio-9p: Check the return value of llistxattr.

PATCH In review Kusanagi Kouichi 2 participants 2 messages Oct 30, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-9p: Check the return value of llistxattr.

If llistxattr returned 0, qemu aborts.

---
 hw/virtio-9p-xattr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/virtio-9p-xattr.c +3 -0
index 175f372..1aab081 100644
@@ -73,6 +73,9 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
 
     /* Get the actual len */
     xattr_len = llistxattr(rpath(ctx, path), value, 0);
+    if (xattr_len <= 0) {
+        return xattr_len;
+    }
 
     /* Now fetch the xattr and find the actual size */
     orig_value = qemu_malloc(xattr_len);
Signature · 1 line
1.7.2.3
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Kusanagi Kouichi

If llistxattr returned 0, qemu aborts.

Quoted 18 lines
---
 hw/virtio-9p-xattr.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/virtio-9p-xattr.c +3 -0
index 175f372..1aab081 100644
@@ -73,6 +73,9 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
 
     /* Get the actual len */
     xattr_len = llistxattr(rpath(ctx, path), value, 0);
+    if (xattr_len <= 0) {
+        return xattr_len;
+    }
 
     /* Now fetch the xattr and find the actual size */
     orig_value = qemu_malloc(xattr_len);