Skip to contentSkip to conversation

Trivial patches for 27 October to 1 November 2011

GIT PULL New Stefan Hajnoczi 2 participants 6 messages Nov 1, 2011 Networking

lore
Share & tools
lore
#0 lore raw

The following changes since commit ff74c5a9a91c6dbf1017195462aa4176f7381240:

Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging (2011-10-31 15:05:40 -0500)

are available in the git repository at:

ssh://repo.or.cz/srv/git/qemu/stefanha.git trivial-patches

Luiz Capitulino (1):
net: tap-linux: Fix unhelpful error message

Markus Armbruster (2):
sysbus: Supply missing va_end()
acl: Fix use after free in qemu_acl_reset()

Stefan Hajnoczi (1):
qapi: fix typos in documentation JSON examples

 acl.c                  |    4 ++--
 docs/qapi-code-gen.txt |    4 ++--
 hw/sysbus.c            |    2 ++
 net/tap-linux.c        |    6 +++++-
 4 files changed, 11 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.7
#1 lore raw

PATCH 1/4 net: tap-linux: Fix unhelpful error message

From: Luiz Capitulino <[email protected]>

I'm getting:

could not configure /dev/net/tun (tap%d): Operation not permitted

When the ioctl() fails, ifr.ifr_name will most likely not be overwritten. So we better only use it when ifname contains a string.

---
 net/tap-linux.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
net/tap-linux.c +5 -1
index ff8cad0..41d581b 100644
@@ -73,7 +73,11 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required
         pstrcpy(ifr.ifr_name, IFNAMSIZ, "tap%d");
     ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
     if (ret != 0) {
-        error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name);
+        if (ifname[0] != '\0') {
+            error_report("could not configure %s (%s): %m", PATH_NET_TUN, ifr.ifr_name);
+        } else {
+            error_report("could not configure %s: %m", PATH_NET_TUN);
+        }
         close(fd);
         return -1;
     }
Signature · 1 line
1.7.7
#2 lore raw

PATCH 2/4 sysbus: Supply missing va_end()

In reply to Stefan Hajnoczi

From: Markus Armbruster <[email protected]>

C99 7.15.1: Each invocation of the va_start and va_copy macros shall be matched by a corresponding invocation of the va_end macro in the same function.

Spotted by Coverity. Harmless on the (common) systems where va_end() does nothing.

---
 hw/sysbus.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
hw/sysbus.c +2 -0
index 4fab5a4..fd2fc6a 100644
@@ -198,6 +198,7 @@ DeviceState *sysbus_create_varargs(const char *name,
         sysbus_connect_irq(s, n, irq);
         n++;
     }
+    va_end(va);
     return dev;
 }
 
@@ -229,6 +230,7 @@ DeviceState *sysbus_try_create_varargs(const char *name,
         sysbus_connect_irq(s, n, irq);
         n++;
     }
+    va_end(va);
     return dev;
 }
 
Signature · 1 line
1.7.7
#3 lore raw

PATCH 3/4 qapi: fix typos in documentation JSON examples

In reply to Stefan Hajnoczi
---
 docs/qapi-code-gen.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
docs/qapi-code-gen.txt +2 -2
index f345866..c0a9325 100644
@@ -41,7 +41,7 @@ dictionary.  This corresponds to a struct in C or an Object in JSON.  An
 example of a complex type is:
 
  { 'type': 'MyType',
-   'data' { 'member1': 'str', 'member2': 'int', '*member3': 'str } }
+   'data': { 'member1': 'str', 'member2': 'int', '*member3': 'str' } }
 
 The use of '*' as a prefix to the name means the member is optional.  Optional
 members should always be added to the end of the dictionary to preserve
@@ -63,7 +63,7 @@ An example command is:
 
  { 'command': 'my-command',
    'data': { 'arg1': 'str', '*arg2': 'str' },
-   'returns': 'str' ]
+   'returns': 'str' }
 
 Command names should be all lower case with words separated by a hyphen.
 
Signature · 1 line
1.7.7
#4 lore raw

PATCH 4/4 acl: Fix use after free in qemu_acl_reset()

In reply to Stefan Hajnoczi

From: Markus Armbruster <[email protected]>

Reproducer:

    $ MALLOC_PERTURB_=234 qemu-system-x86_64 -vnc :0,acl,sasl [...]
    QEMU 0.15.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username fred allow
    acl: added rule at position 1
    (qemu) acl_reset vnc.username
    Segmentation fault (core dumped)

Spotted by Coverity.

---
 acl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
acl.c +2 -2
index 0654f38..e840b9b 100644
@@ -95,13 +95,13 @@ int qemu_acl_party_is_allowed(qemu_acl *acl,
 
 void qemu_acl_reset(qemu_acl *acl)
 {
-    qemu_acl_entry *entry;
+    qemu_acl_entry *entry, *next_entry;
 
     /* Put back to deny by default, so there is no window
      * of "open access" while the user re-initializes the
      * access control list */
     acl->defaultDeny = 1;
-    QTAILQ_FOREACH(entry, &acl->entries, next) {
+    QTAILQ_FOREACH_SAFE(entry, &acl->entries, next, next_entry) {
         QTAILQ_REMOVE(&acl->entries, entry, next);
         free(entry->match);
         free(entry);
Signature · 1 line
1.7.7
#5 lore raw
In reply to Stefan Hajnoczi
Quoted 7 lines · Stefan Hajnoczi

The following changes since commit ff74c5a9a91c6dbf1017195462aa4176f7381240:

   Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging (2011-10-31 15:05:40 -0500)

are available in the git repository at:

ssh://repo.or.cz/srv/git/qemu/stefanha.git trivial-patches

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 18 lines

Luiz Capitulino (1):
net: tap-linux: Fix unhelpful error message

Markus Armbruster (2):
sysbus: Supply missing va_end()
acl: Fix use after free in qemu_acl_reset()

Stefan Hajnoczi (1):
qapi: fix typos in documentation JSON examples

  acl.c                  |    4 ++--
  docs/qapi-code-gen.txt |    4 ++--
  hw/sysbus.c            |    2 ++
  net/tap-linux.c        |    6 +++++-
  4 files changed, 11 insertions(+), 5 deletions(-)