[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 06/56] acl: acl_add can't insert before last list e
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 06/56] acl: acl_add can't insert before last list element, fix |
Date: |
Tue, 13 Aug 2013 10:10:30 -0500 |
From: Markus Armbruster <address@hidden>
Watch this:
$ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio
QEMU 1.5.50 monitor - type 'help' for more information
(qemu) acl_add vnc.username drei allow
acl: added rule at position 1
(qemu) acl_show vnc.username
policy: deny
1: allow drei
(qemu) acl_add vnc.username zwei allow 1
acl: added rule at position 2
(qemu) acl_show vnc.username
policy: deny
1: allow drei
2: allow zwei
(qemu) acl_add vnc.username eins allow 1
acl: added rule at position 1
(qemu) acl_show vnc.username
policy: deny
1: allow eins
2: allow drei
3: allow zwei
The second acl_add inserts at position 2 instead of 1.
Root cause is an off-by-one in qemu_acl_insert(): when index ==
acl->nentries, it appends instead of inserting before the last list
element.
Cc: address@hidden
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
(cherry picked from commit 4999f3a8a6009de05ba82e58e723277917f16254)
Signed-off-by: Michael Roth <address@hidden>
---
util/acl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/acl.c b/util/acl.c
index a7f33ff..938b7ae 100644
--- a/util/acl.c
+++ b/util/acl.c
@@ -138,9 +138,9 @@ int qemu_acl_insert(qemu_acl *acl,
if (index <= 0)
return -1;
- if (index >= acl->nentries)
+ if (index > acl->nentries) {
return qemu_acl_append(acl, deny, match);
-
+ }
entry = g_malloc(sizeof(*entry));
entry->match = g_strdup(match);
--
1.7.9.5
- [Qemu-stable] Patch Round-up for stable 1.5.3, freeze on 2013-08-16, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 02/56] arm/boot: Free dtb blob memory after use, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 03/56] ppc: do not register IABR SPR twice for 603e, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 04/56] qxl: Fix QXLRam initialisation., Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 05/56] virtio-scsi: forward scsibus for virtio-scsi-pci., Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 01/56] s390/virtio-ccw: Fix virtio reset, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 06/56] acl: acl_add can't insert before last list element, fix,
Michael Roth <=
- [Qemu-stable] [PATCH 07/56] usb-host-libusb: set USB_DEV_FLAG_IS_HOST, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 08/56] s390/ipl: Fix boot order, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 09/56] Fix iSCSI crash on SG_IO with an iovector, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 10/56] block/ssh: Set bdrv_has_zero_init according to the file type., Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 11/56] gluster: Return bdrv_has_zero_init = 0, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 13/56] Revert "migration: do not sent zero pages in bulk stage", Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 12/56] vmdk: remove wrong calculation of relative path, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 14/56] migration: do not overwrite zero pages, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 15/56] raw-posix: Fix /dev/cdrom magic on OS X, Michael Roth, 2013/08/13
- [Qemu-stable] [PATCH 16/56] kvmclock: clock should count only if vm is running, Michael Roth, 2013/08/13