Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm From https:/...



details:   https://anonhg.NetBSD.org/src/rev/95c93f4291bf
branches:  trunk
changeset: 797412:95c93f4291bf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jul 16 23:59:58 2014 +0000

description:
>From https://github.com/raspberrypi/linux/commit/517d5c1c9ceb7bf94c4e56e4fb97758e13f24b3b

> Fix for ALSA driver crash
> Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written

diffstat:

 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c |   7 +++--
 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c     |  12 ++++++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r 83a84d74b3a8 -r 95c93f4291bf sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c  Wed Jul 16 23:54:32 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_kern_lib.c  Wed Jul 16 23:59:58 2014 +0000
@@ -288,12 +288,13 @@
                NULL);
 
        if (service) {
+               *phandle = service->handle;
                status = vchiq_open_service_internal(service,
                    (uintptr_t)current);
-               if (status == VCHIQ_SUCCESS)
-                       *phandle = service->handle;
-               else
+               if (status != VCHIQ_SUCCESS) {
                        vchiq_remove_service(service->handle);
+                       *phandle = VCHIQ_SERVICE_HANDLE_INVALID;
+               }
        }
 
 failed:
diff -r 83a84d74b3a8 -r 95c93f4291bf sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c      Wed Jul 16 23:54:32 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_shim.c      Wed Jul 16 23:59:58 2014 +0000
@@ -632,6 +632,9 @@
 {
        VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
        SHIM_SERVICE_T *service = service_alloc(instance, setup);
+
+       *handle = (VCHI_SERVICE_HANDLE_T)service;
+
        if (service) {
                VCHIQ_SERVICE_PARAMS_T params;
                VCHIQ_STATUS_T status;
@@ -648,11 +651,10 @@
                if (status != VCHIQ_SUCCESS) {
                        service_free(service);
                        service = NULL;
+                       *handle = NULL;
                }
        }
 
-       *handle = (VCHI_SERVICE_HANDLE_T)service;
-
        return (service != NULL) ? 0 : -1;
 }
 EXPORT_SYMBOL(vchi_service_open);
@@ -663,6 +665,9 @@
 {
        VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
        SHIM_SERVICE_T *service = service_alloc(instance, setup);
+
+       *handle = (VCHI_SERVICE_HANDLE_T)service;
+
        if (service) {
                VCHIQ_SERVICE_PARAMS_T params;
                VCHIQ_STATUS_T status;
@@ -678,11 +683,10 @@
                if (status != VCHIQ_SUCCESS) {
                        service_free(service);
                        service = NULL;
+                       *handle = NULL;
                }
        }
 
-       *handle = (VCHI_SERVICE_HANDLE_T)service;
-
        return (service != NULL) ? 0 : -1;
 }
 EXPORT_SYMBOL(vchi_service_create);



Home | Main Index | Thread Index | Old Index