- Update to pre-2.0.0 git tree, which features merged "juju" firewire stack
support, enabled simultaneously with classic ieee1394 support
This commit is contained in:
parent
37839e2a17
commit
8d810a51d3
@ -2,3 +2,4 @@ libraw1394-1.2.0.tar.gz
|
||||
libraw1394-1.2.1.tar.gz
|
||||
fw-device-cdev.h
|
||||
libraw1394-1.3.0.tar.gz
|
||||
libraw1394-2.0.0-20080430_git.tar.bz2
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
diff -Naurp libraw1394-1.3.0/juju/juju.h libraw1394-1.3.0.bitfield/juju/juju.h
|
||||
--- libraw1394-1.3.0/juju/juju.h 2007-10-24 16:47:26.000000000 -0400
|
||||
+++ libraw1394-1.3.0.bitfield/juju/juju.h 2007-10-24 16:50:47.000000000 -0400
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "../src/csr.h"
|
||||
#include "config.h"
|
||||
|
||||
-#define ACK_COMPLETE 1
|
||||
-
|
||||
#define ptr_to_u64(p) ((__u64)(unsigned long)(p))
|
||||
#define u64_to_ptr(p) ((void *)(unsigned long)(p))
|
||||
|
||||
diff -Naurp libraw1394-1.3.0/juju/raw1394-iso.c libraw1394-1.3.0.bitfield/juju/raw1394-iso.c
|
||||
--- libraw1394-1.3.0/juju/raw1394-iso.c 2007-10-24 16:47:26.000000000 -0400
|
||||
+++ libraw1394-1.3.0.bitfield/juju/raw1394-iso.c 2007-10-24 16:53:06.000000000 -0400
|
||||
@@ -40,13 +40,14 @@ queue_packet(raw1394handle_t handle,
|
||||
int err;
|
||||
|
||||
p = &handle->iso.packets[handle->iso.packet_index];
|
||||
- p->payload_length = length;
|
||||
- p->interrupt =
|
||||
- handle->iso.packet_phase == handle->iso.irq_interval - 1;
|
||||
- p->skip = 0;
|
||||
- p->tag = tag;
|
||||
- p->sy = sy;
|
||||
- p->header_length = header_length;
|
||||
+ p->control =
|
||||
+ FW_CDEV_ISO_PAYLOAD_LENGTH(length) |
|
||||
+ FW_CDEV_ISO_TAG(tag) |
|
||||
+ FW_CDEV_ISO_SY(sy) |
|
||||
+ FW_CDEV_ISO_HEADER_LENGTH(header_length);
|
||||
+
|
||||
+ if (handle->iso.packet_phase == handle->iso.irq_interval - 1)
|
||||
+ p->control |= FW_CDEV_ISO_INTERRUPT;
|
||||
|
||||
handle->iso.head += length;
|
||||
handle->iso.packet_count++;
|
||||
@@ -291,12 +292,7 @@ int raw1394_iso_xmit_sync(raw1394handle_
|
||||
struct fw_cdev_queue_iso queue_iso;
|
||||
int len;
|
||||
|
||||
- skip.payload_length = 0;
|
||||
- skip.interrupt = 1;
|
||||
- skip.skip = 1;
|
||||
- skip.tag = 0;
|
||||
- skip.sy = 0;
|
||||
- skip.header_length = 0;
|
||||
+ skip.control = FW_CDEV_ISO_INTERRUPT | FW_CDEV_ISO_SKIP;
|
||||
|
||||
queue_iso.packets = ptr_to_u64(&skip);
|
||||
queue_iso.size = sizeof skip;
|
||||
@ -1,21 +0,0 @@
|
||||
diff -Naurp libraw1394-1.3.0/juju/raw1394-iso.c libraw1394-1.3.0.fix/juju/raw1394-iso.c
|
||||
--- libraw1394-1.3.0/juju/raw1394-iso.c 2008-04-28 13:57:30.000000000 -0400
|
||||
+++ libraw1394-1.3.0.fix/juju/raw1394-iso.c 2008-04-28 14:06:21.000000000 -0400
|
||||
@@ -421,7 +421,7 @@ iso_init(raw1394handle_t handle, int typ
|
||||
}
|
||||
|
||||
handle->iso.buffer =
|
||||
- mmap(NULL, buf_packets * max_packet_size,
|
||||
+ mmap(NULL, buf_packets * handle->iso.max_packet_size,
|
||||
prot, MAP_SHARED, handle->iso.fd, 0);
|
||||
|
||||
if (handle->iso.buffer == MAP_FAILED) {
|
||||
@@ -432,7 +432,7 @@ iso_init(raw1394handle_t handle, int typ
|
||||
}
|
||||
|
||||
handle->iso.buffer_end = handle->iso.buffer +
|
||||
- buf_packets * max_packet_size;
|
||||
+ buf_packets * handle->iso.max_packet_size;
|
||||
handle->iso.head = handle->iso.buffer;
|
||||
handle->iso.tail = handle->iso.buffer;
|
||||
handle->iso.first_payload = handle->iso.buffer;
|
||||
@ -1,51 +0,0 @@
|
||||
diff -Naurp libraw1394-1.3.0/juju/raw1394-iso.c libraw1394-1.3.0.fix/juju/raw1394-iso.c
|
||||
--- libraw1394-1.3.0/juju/raw1394-iso.c 2007-10-22 13:55:58.000000000 -0400
|
||||
+++ libraw1394-1.3.0.fix/juju/raw1394-iso.c 2007-10-22 15:27:54.000000000 -0400
|
||||
@@ -394,6 +394,7 @@ iso_init(raw1394handle_t handle, int typ
|
||||
handle->iso.fd = open(handle->local_filename, O_RDWR);
|
||||
if (handle->iso.fd < 0) {
|
||||
free(handle->iso.packets);
|
||||
+ handle->iso.packets = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -404,6 +405,7 @@ iso_init(raw1394handle_t handle, int typ
|
||||
handle->iso.fd, &ep) < 0) {
|
||||
close(handle->iso.fd);
|
||||
free(handle->iso.packets);
|
||||
+ handle->iso.packets = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -417,6 +419,8 @@ iso_init(raw1394handle_t handle, int typ
|
||||
if (retval < 0) {
|
||||
close(handle->iso.fd);
|
||||
free(handle->iso.packets);
|
||||
+ handle->iso.packets = NULL;
|
||||
+ printf("ioctl call failed, retval = %d\n", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -427,6 +431,7 @@ iso_init(raw1394handle_t handle, int typ
|
||||
if (handle->iso.buffer == MAP_FAILED) {
|
||||
close(handle->iso.fd);
|
||||
free(handle->iso.packets);
|
||||
+ handle->iso.packets = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -515,8 +520,12 @@ void raw1394_iso_stop(raw1394handle_t ha
|
||||
|
||||
void raw1394_iso_shutdown(raw1394handle_t handle)
|
||||
{
|
||||
- munmap(handle->iso.buffer,
|
||||
- handle->iso.buf_packets * handle->iso.max_packet_size);
|
||||
+ if (handle->iso.buffer) {
|
||||
+ munmap(handle->iso.buffer,
|
||||
+ handle->iso.buf_packets * handle->iso.max_packet_size);
|
||||
+ handle->iso.buffer = NULL;
|
||||
+ }
|
||||
close(handle->iso.fd);
|
||||
free(handle->iso.packets);
|
||||
+ handle->iso.packets = NULL;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
140
libraw1394-memset-and-patch-up-leaks-git.patch
Normal file
140
libraw1394-memset-and-patch-up-leaks-git.patch
Normal file
@ -0,0 +1,140 @@
|
||||
Originally submitted via Red Hat bugzilla by Philippe Troin:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=451727
|
||||
|
||||
Description:
|
||||
|
||||
While trying to track down some crashes in kino, I found the following problems
|
||||
with libraw1394:
|
||||
|
||||
* There is a DIR* leak in raw1394_set_port().
|
||||
* Lots of data structures are not fully initialized when calling IEEE1394
|
||||
ioctl()s. These cause valgrind errors (benign, as valgrind does not know
|
||||
how to interpret all ioctls. However these also cause kino to crash in
|
||||
libraw1394. I've added a bunch of memset()s to prevent this problem from
|
||||
happening.
|
||||
|
||||
Author: Philippe Troin <phil@fifi.org>
|
||||
|
||||
Forward-ported to libraw1394 git tree by Jarod Wilson.
|
||||
|
||||
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
|
||||
|
||||
--
|
||||
|
||||
src/fw-iso.c | 2 ++
|
||||
src/fw.c | 15 ++++++++++++++-
|
||||
tools/testlibraw.c | 1 +
|
||||
3 files changed, 17 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/src/fw-iso.c b/src/fw-iso.c
|
||||
index 471d981..a1794c3 100644
|
||||
--- a/src/fw-iso.c
|
||||
+++ b/src/fw-iso.c
|
||||
@@ -401,6 +401,7 @@ iso_init(fw_handle_t handle, int type,
|
||||
}
|
||||
|
||||
handle->iso.closure.func = handle_iso_event;
|
||||
+ memset(&ep, 0, sizeof(ep));
|
||||
ep.events = EPOLLIN;
|
||||
ep.data.ptr = &handle->iso.closure;
|
||||
if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD,
|
||||
@@ -411,6 +412,7 @@ iso_init(fw_handle_t handle, int type,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ memset(&create, 0, sizeof(create));
|
||||
create.type = type;
|
||||
create.channel = channel;
|
||||
create.speed = speed;
|
||||
diff --git a/src/fw.c b/src/fw.c
|
||||
index 1322fe2..3c61385 100644
|
||||
--- a/src/fw.c
|
||||
+++ b/src/fw.c
|
||||
@@ -149,6 +149,8 @@ scan_devices(fw_handle_t handle)
|
||||
fd = open(filename, O_RDWR);
|
||||
if (fd < 0)
|
||||
continue;
|
||||
+ memset(&get_info, 0, sizeof(get_info));
|
||||
+ memset(&reset, 0, sizeof(reset));
|
||||
get_info.version = FW_CDEV_VERSION;
|
||||
get_info.rom = 0;
|
||||
get_info.rom_length = 0;
|
||||
@@ -404,7 +406,10 @@ fw_handle_t fw_new_handle(void)
|
||||
struct epoll_event ep;
|
||||
int i;
|
||||
|
||||
+ memset(&ep, 0, sizeof(ep));
|
||||
+
|
||||
handle = malloc(sizeof *handle);
|
||||
+ memset(handle, 0, sizeof(*handle));
|
||||
|
||||
handle->tag_handler = default_tag_handler;
|
||||
handle->arm_tag_handler = default_arm_tag_handler;
|
||||
@@ -580,6 +585,8 @@ int fw_set_port(fw_handle_t handle, int port)
|
||||
if (fd < 0)
|
||||
continue;
|
||||
|
||||
+ memset(&get_info, 0, sizeof(get_info));
|
||||
+ memset(&reset, 0, sizeof(reset));
|
||||
get_info.version = FW_CDEV_VERSION;
|
||||
get_info.rom = 0;
|
||||
get_info.rom_length = 0;
|
||||
@@ -603,10 +610,12 @@ int fw_set_port(fw_handle_t handle, int port)
|
||||
sizeof handle->devices[i].filename);
|
||||
|
||||
handle->devices[i].closure.func = handle_device_event;
|
||||
+ memset(&ep, 0, sizeof(ep));
|
||||
ep.events = EPOLLIN;
|
||||
ep.data.ptr = &handle->devices[i].closure;
|
||||
if (epoll_ctl(handle->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
|
||||
close(fd);
|
||||
+ closedir(dir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -621,6 +630,8 @@ int fw_set_port(fw_handle_t handle, int port)
|
||||
i++;
|
||||
}
|
||||
|
||||
+ closedir(dir);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1220,6 +1231,7 @@ fw_start_fcp_listen(fw_handle_t handle)
|
||||
|
||||
closure->callback = handle_fcp_request;
|
||||
|
||||
+ memset(&request, 0, sizeof(request));
|
||||
request.offset = CSR_REGISTER_BASE + CSR_FCP_COMMAND;
|
||||
request.length = CSR_FCP_END - CSR_FCP_COMMAND;
|
||||
request.closure = ptr_to_u64(closure);
|
||||
@@ -1256,6 +1268,7 @@ fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
|
||||
struct fw_cdev_get_info get_info;
|
||||
int err;
|
||||
|
||||
+ memset(&get_info, 0, sizeof(get_info));
|
||||
get_info.version = FW_CDEV_VERSION;
|
||||
get_info.rom = ptr_to_u64(buffer);
|
||||
get_info.rom_length = buffersize;
|
||||
@@ -1284,7 +1297,7 @@ fw_bandwidth_modify (raw1394handle_t handle,
|
||||
|
||||
if (bandwidth == 0)
|
||||
return 0;
|
||||
-
|
||||
+
|
||||
addr = CSR_REGISTER_BASE + CSR_BANDWIDTH_AVAILABLE;
|
||||
/* Read current bandwidth usage from IRM. */
|
||||
result = raw1394_read (handle, raw1394_get_irm_id (handle), addr,
|
||||
diff --git a/tools/testlibraw.c b/tools/testlibraw.c
|
||||
index 2f02a6d..efd87ad 100644
|
||||
--- a/tools/testlibraw.c
|
||||
+++ b/tools/testlibraw.c
|
||||
@@ -202,6 +202,7 @@ int main(int argc, char **argv)
|
||||
read_topology_map(handle);
|
||||
|
||||
printf("testing config rom stuff\n");
|
||||
+ memset(rom, 0, sizeof(rom));
|
||||
retval=raw1394_get_config_rom(handle, rom, 0x100, &rom_size, &rom_version);
|
||||
printf("get_config_rom returned %d, romsize %d, rom_version %d\n",retval,rom_size,rom_version);
|
||||
printf("here are the first 10 quadlets:\n");
|
||||
@ -1,23 +1,27 @@
|
||||
%define gitrev 20080430_git
|
||||
|
||||
Summary: Library providing low-level IEEE-1394 access
|
||||
Name: libraw1394
|
||||
Version: 1.3.0
|
||||
Release: 6%{?dist}
|
||||
Version: 2.0.0
|
||||
Release: 0.1.%{gitrev}%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
Source: http://www.linux1394.org/dl/libraw1394-%{version}.tar.gz
|
||||
#Source: http://www.linux1394.org/dl/libraw1394-%{version}.tar.gz
|
||||
# Pre-2.0.0 snapshot generated from git://dennedy.org/libraw1394.git
|
||||
Source: %{name}-%{version}-%{gitrev}.tar.bz2
|
||||
URL: http://www.linux1394.org/
|
||||
ExcludeArch: s390 s390x
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: autoconf automake libtool kernel-headers
|
||||
|
||||
Patch0: libraw1394-juju.patch
|
||||
Patch1: libraw1394-juju-no-double-free-on-shutdown.patch
|
||||
Patch2: libraw1394-juju-bitfield-update.patch
|
||||
Patch3: libraw1394-juju-munmap-correct-max_packet_size.patch
|
||||
Patch0: libraw1394-memset-and-patch-up-leaks-git.patch
|
||||
|
||||
%description
|
||||
The libraw1394 library provides direct access to the IEEE-1394 bus through
|
||||
the Linux 1394 subsystem's raw1394 user space interface.
|
||||
the Linux 1394 subsystem's raw1394 user space interface. Support for both
|
||||
the classic ieee1394 and new firewire linux driver stacks is included, with
|
||||
run-time detection of the active stack. Fedora comes with the firewire stack
|
||||
by default.
|
||||
|
||||
%package devel
|
||||
Summary: Development libs for libraw1394
|
||||
@ -31,16 +35,10 @@ Development libraries needed to build applications against libraw1394.
|
||||
%setup -q
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1 -b .free
|
||||
%patch2 -p1 -b .bitf
|
||||
%patch3 -p1 -b .munmap
|
||||
|
||||
%build
|
||||
aclocal
|
||||
autoheader
|
||||
autoconf
|
||||
automake
|
||||
%configure --disable-static --with-juju-dir=$PWD/..
|
||||
./autogen.sh
|
||||
%configure --disable-static
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
@ -76,6 +74,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Jun 17 2008 Jarod Wilson <jwilson@redhat.com> - 2.0.0-0.1.20080430_git
|
||||
- Update to pre-2.0.0 git tree, which features merged "juju" firewire
|
||||
stack support, enabled simultaneously with classic ieee1394 support
|
||||
|
||||
* Tue Jun 17 2008 Jarod Wilson <jwilson@redhat.com> - 1.3.0-7
|
||||
- Fully initialize data structures and plug dir leak. Resolves
|
||||
crashes when used with kino (Philippe Troin, #451727)
|
||||
|
||||
* Mon Apr 28 2008 Jarod Wilson <jwilson@redhat.com> - 1.3.0-6
|
||||
- Unmap the correct memory range on iso receive teardown, fixes
|
||||
segfault on exit from dvgrab (Mladen Kuntner, #444354)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user