* [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix
@ 2013-06-18 8:05 Markus Armbruster
2013-06-18 18:15 ` [Qemu-devel] [Qemu-stable] " mdroth
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Markus Armbruster @ 2013-06-18 8:05 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, qemu-stable
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: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
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.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH] acl: acl_add can't insert before last list element, fix
2013-06-18 8:05 [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix Markus Armbruster
@ 2013-06-18 18:15 ` mdroth
2013-06-19 7:44 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-07-31 14:44 ` [Qemu-devel] " Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: mdroth @ 2013-06-18 18:15 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel, qemu-stable
On Tue, Jun 18, 2013 at 10:05:23AM +0200, Markus Armbruster wrote:
> 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: qemu-stable@nongnu.org
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
> 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.11.7
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] acl: acl_add can't insert before last list element, fix
2013-06-18 8:05 [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix Markus Armbruster
2013-06-18 18:15 ` [Qemu-devel] [Qemu-stable] " mdroth
@ 2013-06-19 7:44 ` Michael Tokarev
2013-07-31 14:44 ` [Qemu-devel] " Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2013-06-19 7:44 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-trivial, qemu-devel, qemu-stable
18.06.2013 12:05, Markus Armbruster wrote:
[]
> 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.
Thanks, applied to the trivial patches queue.
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix
2013-06-18 8:05 [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix Markus Armbruster
2013-06-18 18:15 ` [Qemu-devel] [Qemu-stable] " mdroth
2013-06-19 7:44 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
@ 2013-07-31 14:44 ` Markus Armbruster
2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2013-07-31 14:44 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, qemu-stable
Ping re 1.5.3
Markus Armbruster <armbru@redhat.com> writes:
> 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: qemu-stable@nongnu.org
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-31 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18 8:05 [Qemu-devel] [PATCH] acl: acl_add can't insert before last list element, fix Markus Armbruster
2013-06-18 18:15 ` [Qemu-devel] [Qemu-stable] " mdroth
2013-06-19 7:44 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-07-31 14:44 ` [Qemu-devel] " Markus Armbruster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.