- Mar 24, 2009
-
-
Stefan Richter authored
The lifetime of struct client instances must be longer than the lifetime of any client resource. This fixes a possible race between fw_device_op_release and transaction completions. It also prepares for new ioctls for isochronous resource management which will involve delayed processing of client resources. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Reviewed-by:
David Moore <dcm@acm.org>
-
Stefan Richter authored
Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
type function_name(parameters); is nice to look at but was not used consistently. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
"ret" is the new "retval". Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
Like before my commit 1415d918, fw_core_add_address_handler() does not align the address region now. Instead the caller is required to pass valid parameters. Since one of the callers of fw_core_add_address_handler() is the cdev userspace interface, we now check for valid input. If the client is buggy, we give it a hint with -EINVAL. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Jay Fenlason authored
The current code uses a linked list and a counter for storing resources and the corresponding handle numbers. By changing to an idr we can be safe from counter wrap-around giving two resources the same handle. Furthermore, the deallocation ioctls now check whether the resource to be freed is of the intended type. Signed-off-by:
Jay Fenlason <fenlason@redhat.com> Some rework by Stefan R: - The idr API documentation says we get an ID within 0...0x7fffffff. Hence we can rest assured that idr handles fit into cdev handles. - Fix some races. Add a client->in_shutdown flag for this purpose. - Add allocation retry to add_client_resource(). - It is possible to use idr_for_each() in fw_device_op_release(). - Fix ioctl_send_response() regression. - Small style changes. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
Unlink the client from the fw_device earlier in order to prevent bus reset events being added to client->event_list during shutdown. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
The behaviour of fw-transaction.c::fw_send_request is ill-defined for any other tcodes than read/ write/ lock request tcodes. Therefore prevent requests with wrong tcodes from entering the transaction layer. Maybe fw_send_request should check them itself, but I am not inclined to change it and fw_fill_request from void-valued functions to ones which return error codes and pass those up. Besides, maybe fw_send_request is going to support one more tcode than ioctl_send_request in the future (TCODE_STREAM_DATA). Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
So far it is only taken in non-atomic contexts. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Jay Fenlason authored
This adds a client_list_lock, which only protects the device's client_list, so that future versions of the driver can call code that takes the card->lock while holding the client_list_lock. Adding this lock is much simpler than adding __ versions of all the functions that the future version may need. The one ordering issue is to make sure code never takes the client_list_lock with card->lock held. Since client_list_lock is only used in three places, that isn't hard. Signed-off-by:
Jay Fenlason <fenlason@redhat.com> Update fill_bus_reset_event() accordingly. Include linux/spinlock.h. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Oct 15, 2008
-
-
Stefan Richter authored
Reported by Jay Fenlason: ioctl() did not return as intended - the size of data read into ioctl_send_request, - the number of datagrams enqueued by ioctl_queue_iso. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
Reported by Jay Fenlason: The iso packet control accessors in fw-cdev.c had bogus masks. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Aug 02, 2008
-
-
David Moore authored
Recently, a bug having to do with the alignment of transaction response data was fixed. However, some apps such as libdc1394 relied on the presence of that bug in order to function correctly. In order to stay compatible with old versions of those apps, this patch preserves the bug in cases where it is harmless to normal operation (such as the single quadlet read) due to a simple duplication of data. This guarantees maximum compatability for those users who are using the old app with the fixed kernel. Signed-off-by:
David Moore <dcm@acm.org> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Jul 20, 2008
-
-
JiSheng Zhang authored
There will be 4 padding bytes in struct fw_cdev_event_response on some platforms The member:__u32 data will point to these padding bytes. While queue the response and data in complete_transaction in fw-cdev.c, it will queue like this: |response(excluding padding bytes)|4 padding bytes|4 padding bytes|data. It queue 4 extra bytes. That is to say it use "&response + sizeof(response)" while other place of kernel and userspace library use "&response + offsetof (typeof(response), data)". So it will lost the last 4 bytes of data. This patch can fix it while not changing the struct definition. Signed-off-by:
JiSheng Zhang <jszhang3@mail.ustc.edu.cn> This fixes responses to outbound block read requests on 64bit architectures. Tested on i686, x86-64, and x86-64 with i686 userland, using firecontrol and gscanbus. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Jun 18, 2008
-
-
Stefan Richter authored
Callers of fill_bus_reset_event() have to take card->lock. Otherwise access to node data may oops if node removal is in progress. A lockless alternative would be - event->local_node_id = card->local_node->node_id; + tmp = fw_node_get(card->local_node); + event->local_node_id = tmp->node_id; + fw_node_put(tmp); and ditto with the other node pointers which fill_bus_reset_event() accesses. But I went the locked route because one of the two callers already holds the lock. As a bonus, we don't need the memory barrier anymore because device->generation and device->node_id are written in a card->lock protected section. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by:
Kristian Høgsberg <krh@redhat.com>
-
- May 20, 2008
-
-
Jay Fenlason authored
If userspace ignores the POLLERR bit from poll(), and only attempts to read() the device when POLLIN is set, it can still make ioctl() calls on a device that has been removed from the system. The node_id and generation returned by GET_INFO will be outdated, but INITIATE_BUS_RESET would still cause a bus reset, and GET_CYCLE_TIMER will return data. And if you guess the correct generation to use, you can send requests to a different device on the bus, and get responses back. This patch prevents open, ioctl, compat_ioctl, and mmap against shutdown devices. Signed-off-by:
Jay Fenlason <fenlason@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Apr 18, 2008
-
-
Stefan Richter authored
When a device changes its configuration ROM, it announces this with a bus reset. firewire-core has to check which node initiated a bus reset and whether any unit directories went away or were added on this node. Tested with an IOI FWB-IDE01AB which has its link-on bit set if bus power is available but does not respond to ROM read requests if self power is off. This implements - recognition of the units if self power is switched on after fw-core gave up the initial attempt to read the config ROM, - shutdown of the units when self power is switched off. Also tested with a second PC running Linux/ieee1394. When the eth1394 driver is inserted and removed on that node, fw-core now notices the addition and removal of the IPv4 unit on the ieee1394 node. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Feb 21, 2008
-
-
Stefan Richter authored
By supplying ioctl()s in the wrong order, a userspace client was able to trigger NULL pointer dereferences. Furthermore, by calling ioctl_create_iso_context more than once, new contexts could be created without ever freeing the previously created contexts. Thanks to Anders Blomdell for the report. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Feb 16, 2008
-
-
Stefan Richter authored
There is a race between shutdown and creation of devices: fw-core may attempt to add a device with the same name of an already existing device. http://bugzilla.kernel.org/show_bug.cgi?id=9828 Impact of the bug: Happens rarely (when shutdown of a device coincides with creation of another), forces the user to unplug and replug the new device to get it working. The fix is obvious: Free the minor number *after* instead of *before* device_unregister(). This requires to take an additional reference of the fw_device as long as the IDR tree points to it. And while we are at it, we fix an additional race condition: fw_device_op_open() took its reference of the fw_device a little bit too late, hence was in danger to access an already invalid fw_device. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Jan 30, 2008
-
-
Stefan Richter authored
fw_device.node_id and fw_device.generation are accessed without mutexes. We have to ensure that all readers will get to see node_id updates before generation updates. Fixes an inability to recognize devices after "giving up on config rom", https://bugzilla.redhat.com/show_bug.cgi?id=429950 Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Reviewed by Nick Piggin <nickpiggin@yahoo.com.au>. Verified to fix 'giving up on config rom' issues on multiple system and drive combinations that were previously affected. Signed-off-by:
Jarod Wilson <jwilson@redhat.com> Signed-off-by:
Kristian Høgsberg <krh@redhat.com>
-
Stefan Richter authored
We have to use the fw_device.generation here, not the fw_card.generation, because the generation must never be newer than the node ID when we emit a transaction. This cannot be guaranteed with fw_card.generation. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Verified in concert with subsequent memory barriers patch to fix 'giving up on config rom' issues on multiple system and drive combinations that were previously affected. Signed-off-by:
Jarod Wilson <jwilson@redhat.com>
-
- Oct 16, 2007
-
-
Jay Fenlason authored
Signed-off-by:
Jay Fenlason <fenlason@redhat.com> Prompted by https://bugzilla.redhat.com/show_bug.cgi?id=323411 Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Stefan Richter authored
This duplicates the read cycle timer feature of raw1394 (added in Linux 2.6.21) in firewire-core's userspace ABI. The argument to the ioctl is reordered though to ensure 32/64 bit compatibility. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by:
Kristian Høgsberg <krh@redhat.com>
-
Stefan Richter authored
Sparse warned about it although it was apparently harmless: drivers/firewire/fw-cdev.c:624:23: warning: symbol 'interrupt' shadows an earlier one include/asm/hw_irq.h:29:13: originally declared here Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Oct 14, 2007
-
-
Al Viro authored
Signed-off-by:
Al Viro <viro@zeniv.linux.org.uk> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- Jul 09, 2007
-
-
Stefan Richter authored
Use a speed probe to determine the speed over 1394b buses and of nodes which report a link speed less than their PHY speed. Log the effective maximum speed of newly created nodes in dmesg. Also, read the config ROM (except bus info block) at the maximum speed rather than S100. This isn't a real optimization though because we still only use quadlet read requests for the entire ROM. The patch also adds support for S1600 and S3200, although such hardware does not exist yet. Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by:
Kristian Høgsberg <krh@redhat.com>
-
- Jun 20, 2007
-
-
Kristian Høgsberg authored
This patch fixes an OOPS on cdev release for an fd where iso context creation failed. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- May 31, 2007
-
-
Kristian Høgsberg authored
The struct is part of the userspace interface and can not use bitfields. This patch replaces the bitfields with a __u32 'control' word and provides access macros to set the bits. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- May 27, 2007
-
-
Jeff Garzik authored
Fix this warning on x86-64 drivers/firewire/fw-cdev.c:798: warning: initialization from incompatible pointer type by making the return code of ioctl_send_request() the same as all the other ioctl_xxx() return codes. Signed-off-by:
Jeff Garzik <jeff@garzik.org> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- May 10, 2007
-
-
Kristian Høgsberg authored
Signed-off-by:
Kristian Hoegsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Kristian Høgsberg authored
Drop filenames from file preamble, drop editor annotations and use standard indent style for block comments. Signed-off-by:
Kristian Hoegsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed typo)
-
- Apr 30, 2007
-
-
Kristian Høgsberg authored
Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Kristian Høgsberg authored
Currently create context always returns 0 and the other iso ioctls will expect user space to pass that in for subsequent ioctls. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Kristian Høgsberg authored
Also, with this change, refactor ioctl dispatch code to do the copying from and to user space as indicated by the IOC annotations. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Mar 28, 2007
-
-
Kristian Høgsberg authored
Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (renamed a variable)
-
Kristian Høgsberg authored
Generalize the way we keep track of the various resources and assign a unique handle to each resource. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
Kristian Høgsberg authored
Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed whitespace)
-
Kristian Høgsberg authored
Make event struct layout common part include the closure and add a union for all event types; provide a mechanism for setting the bus reset event closure. Shuffle struct fw_cdev_queue_iso fields around to be 64-bit safe. Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-
- Mar 20, 2007
-
-
Stefan Richter authored
Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by:
Kristian Høgsberg <krh@redhat.com>
-
- Mar 15, 2007
-
-
Kristian Høgsberg authored
Signed-off-by:
Kristian Høgsberg <krh@redhat.com> Signed-off-by:
Stefan Richter <stefanr@s5r6.in-berlin.de>
-