Package: libraw1394-11
Version: 2.0.5-2
Severity: important
Tags: patch

When using the old firewire stack ('ieee1394'),
raw1394_destroy_handle() calls ieee1394_destroy_handle() which calls
ieee1394_iso_shutdown().

When using the new firewire stack ('firewire'/'Juju'),
raw1394_destroy_handle() calls fw_destroy_handle() which does *not*
call fw_iso_shutdown().  Further, fw_iso_shutdown() is not safe to
call twice because it calls munmap() unconditionally.  This makes it
significantly harder to write correct cleanup code in applications.

The patch below fixes both these issues.

Ben.

--- libraw1394-2.0.5.orig/src/fw-iso.c
+++ libraw1394-2.0.5/src/fw-iso.c
@@ -480,6 +480,7 @@
        if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD,
                      handle->iso.fd, &ep) < 0) {
                close(handle->iso.fd);
+               handle->iso.fd = -1;
                free(handle->iso.packets);
                handle->iso.packets = NULL;
                return -1;
@@ -495,6 +496,7 @@
                       FW_CDEV_IOC_CREATE_ISO_CONTEXT, &create);
        if (retval < 0) {
                close(handle->iso.fd);
+               handle->iso.fd = -1;
                free(handle->iso.packets);
                handle->iso.packets = NULL;
                return retval;
@@ -506,6 +508,7 @@
 
        if (handle->iso.buffer == MAP_FAILED) {
                close(handle->iso.fd);
+               handle->iso.fd = -1;
                free(handle->iso.packets);
                handle->iso.packets = NULL;
                return -1;
@@ -599,6 +602,8 @@
 
 void fw_iso_shutdown(fw_handle_t handle)
 {
+       if (handle->iso.fd < 0)
+               return;
        munmap(handle->iso.buffer,
               handle->iso.buf_packets * handle->iso.max_packet_size);
        if (handle->iso.state != ISO_STOPPED)
--- libraw1394-2.0.5.orig/src/fw.c
+++ libraw1394-2.0.5/src/fw.c
@@ -488,6 +488,8 @@
 {
        int i;
 
+       fw_iso_shutdown(handle);
+
        close(handle->inotify_fd);
        close(handle->pipe_fds[0]);
        close(handle->pipe_fds[1]);
--- END ---

-- System Information:
Debian Release: squeeze/sid
  APT prefers proposed-updates
  APT policy: (500, 'proposed-updates'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libraw1394-11 depends on:
ii  libc6                         2.11.2-7   Embedded GNU C Library: Shared lib

libraw1394-11 recommends no packages.

Versions of packages libraw1394-11 suggests:
ii  libraw1394-doc                2.0.5-2    Reference manual and documentation

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to