[PATCH 3/4] context: Stop and return if srbchannel memblock looks fishy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

handle_srbchannel_memblock() should return when memblock sanity checks fail

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
Cc: David Henningsson <david.henningsson at canonical.com>
---
 src/pulse/context.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/pulse/context.c b/src/pulse/context.c
index db89b58..b8ebced 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -350,12 +350,11 @@ static void handle_srbchannel_memblock(pa_context *c, pa_memblock *memblock) {
     pa_assert(c);
 
     /* Memblock sanity check */
-    if (!memblock)
-        pa_context_fail(c, PA_ERR_PROTOCOL);
-    else if (pa_memblock_is_read_only(memblock))
-        pa_context_fail(c, PA_ERR_PROTOCOL);
-    else if (pa_memblock_is_ours(memblock))
+    if (!memblock || pa_memblock_is_read_only(memblock) ||
+        pa_memblock_is_ours(memblock)) {
         pa_context_fail(c, PA_ERR_PROTOCOL);
+        return;
+    }
 
     /* Create the srbchannel */
     c->srb_template.memblock = memblock;
-- 
1.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux