1. 25 2月, 2010 4 次提交
    • S
      firewire: core: fix an information leak · 137d9ebf
      Stefan Richter 提交于
      If a device exposes a sparsely populated configuration ROM,
      firewire-core's sysfs interface and character device file interface
      showed random data in the gaps between config ROM blocks.  Fix this by
      zero-initialization of the config ROM reader's scratch buffer.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      137d9ebf
    • S
      firewire: core: increase stack size of config ROM reader · 58aaa542
      Stefan Richter 提交于
      The stack size of 16 was artificially chosen and may be too small in
      extreme cases.  A device won't be accessible then.
      
      Since it doesn't really matter to the slab allocator whether we ask for
      1088 bytes or 2048 bytes of scratch memory, just allocate 2048 bytes for
      the sum of temporary config ROM image and stack, and we will never ever
      overflow the stack (because there simply can't be more stack items than
      ROM entries).
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      58aaa542
    • S
      firewire: core: don't fail device creation in case of too large config ROM blocks · 2799d5c5
      Stefan Richter 提交于
      It never happened yet, but better safe than sorry:  If a device's config
      ROM contains a block which overlaps the boundary at 0xfffff00007ff, just
      ignore that one block instead of refusing to add the device
      representation.  That way, upper layers (kernelspace or userspace
      drivers) might still be able to use the device to some degree.
      
      That's better than total inaccessibility of the device.  Worse, the core
      would have logged only a generic "giving up on config rom" message which
      could only be debugged by feeding a firewire-ohci debug logging session
      through a config ROM interpreter, IOW would likely remain undiagnosed.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      2799d5c5
    • S
      firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500 · d54423c6
      Stefan Richter 提交于
      The Panasonic AG-DV2500 tape deck contains an invalid entry in its
      configuration ROM root directory:  A leaf pointer with the undefined key
      ID 0 and an offset that points way out of the standard config ROM area.
      This caused firewire-core to dismiss the device with the generic log
      message "giving up on config rom for node id...", after which it was of
      course impossible to access the tape deck with dvgrab or any other
      program.  https://bugzilla.redhat.com/show_bug.cgi?id=449252#c29
      
      The fix is to simply ignore this invalid ROM entry and proceed to read
      the valid rest of the ROM.  There is a catch though:  When the kernel
      later iterates over the ROM, it would be nasty having to check again for
      such too large ROM offsets.  Therefore we manipulate the defective or
      unsupported ROM entry to become a harmless immediate entry that won't
      have any side effects later (an entry with the value 0x00000000).
      
      Reported-by: George Chriss
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      d54423c6
  2. 30 12月, 2009 3 次提交
  3. 16 9月, 2009 1 次提交
  4. 14 6月, 2009 1 次提交
  5. 07 6月, 2009 2 次提交
  6. 05 6月, 2009 5 次提交
    • S
      firewire: rename source files · e71d31da
      Stefan Richter 提交于
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • S
      firewire: reorganize header files · 77c9a5da
      Stefan Richter 提交于
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • S
      firewire: clean up includes · e8ca9702
      Stefan Richter 提交于
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702
    • S
      firewire: also use vendor ID in root directory for driver matches · e41f8d70
      Stefan Richter 提交于
      Due to AV/C protocol extensions, FireDTV devices need a vendor-specific
      driver.  But their configuration ROM features a vendor ID only in the
      root directory, not in the unit directory.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e41f8d70
    • S
      firewire: share device ID table type with ieee1394 · b3b29888
      Stefan Richter 提交于
      That way, the new firedtv driver will be able to use a single ID table
      in builds against ieee1394 core and/or against firewire core.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      b3b29888
  7. 01 6月, 2009 2 次提交
    • S
      firewire: core: add sysfs attribute for easier udev rules · 0210b66d
      Stefan Richter 提交于
      This adds the attribute /sys/bus/firewire/devices/fw[0-9]+/units.  It
      can be used in udev rules like the following ones:
      
      # IIDC devices: industrial cameras and some webcams
      SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010?*", GROUP="video"
      
      # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, ...
      SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video"
      
      Background:
      
      firewire-core manages two device types:
        - fw_device is a FireWire node.  A character device file is associated
          with it.
        - fw_unit is a unit directory on a node.  Each fw_device may have 0..n
          children of type fw_unit.  The units tell us what kinds of protocols
          a node implements.
      
      We want to set ownership or ACLs or permissions of the character device
      file of an fw_device, or/and create symlinks to it, based on available
      protocols.  Until now udev rules had to look at the fw_unit devices and
      then modify their parent's character device file accordingly.  This is
      problematic for two reasons:  1) It happens sometime after the creation
      of the fw_device, 2) an access policy may require that information from
      all children is evaluated before a decision about the parent is made.
      
      Problem 1) can ultimately not be avoided since this is the nature of
      FireWire nodes:  They may add or remove unit directories at any point in
      time.
      
      However, we can still help userland a lot by providing the protocol type
      information of all units in a summary sysfs attribute directly at the
      fw_device.  This way,
         - the information is immediately available at the affected device
           when userspace goes about to handle an ADD or CHANGE event of the
           fw_device,
         - with most policies, it won't be necessary anymore to dig through
           child attributes.
      
      The new attribute is called "units".  It contains space-separated tuples
      of specifier_id and version of each present unit.  The delimiter within
      tuples is a colon.  Specifier_id and version are printed as 0x%06x.
      
      Here is an example of a node which implements an IPv4 unit and an IPv6
      unit:  $ cat /sys/bus/firewire/devices/fw2/units
      0x00005e:0x000001 0x00005e:0x000002
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0210b66d
    • S
      firewire: core: check for missing struct update at build time, not run time · e5333db9
      Stefan Richter 提交于
      struct fw_attribute_group.attrs.[] must have enough room for all
      attributes.  This can and should be checked at build time.
      
      Our previous check at run time was a little late and not reliable since
      most of the time less than the available attributes are populated.
      
      Furthermore, omit an increment of an index at its last usage.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e5333db9
  8. 17 5月, 2009 1 次提交
    • S
      firewire: core: improve check for local node · 92368890
      Stefan Richter 提交于
      My recently added test for a device being local in fw-cdev.c got it
      slightly wrong:  Comparisons of node IDs are only valid if the
      generation is current, which I forgot to check.  Normally, serialization
      by card->lock takes care of this, but a device in FW_DEVICE_GONE state
      will necessarily have a wrong generation and invalid node_id.
      
      The "is it local?" check is made 100% correct and simpler now by means
      of a struct fw_device flag which is set at fw_device creation.
      
      Besides the fw-cdev site which was to be fixed, there is another site
      which can make use of the new flag, and an RFC-2734 driver will benefit
      from it too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      92368890
  9. 25 3月, 2009 9 次提交
  10. 25 1月, 2009 1 次提交
    • S
      firewire: core: optimize card shutdown · e747a5c0
      Stefan Richter 提交于
      This fixes a regression by "firewire: keep highlevel drivers attached
      during brief connection loss":  There were 2 seconds unnecessary waiting
      added to the shutdown procedure of each controller.
      
      We use card->link as status flag to signal the device handler that there
      is no use to wait for a come-back.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      e747a5c0
  11. 21 1月, 2009 1 次提交
    • S
      firewire: keep highlevel drivers attached during brief connection loss · 3d36a0df
      Stefan Richter 提交于
      There are situations when nodes vanish from the bus and come back
      quickly thereafter:
        - When certain bus-powered hubs are plugged in,
        - when certain devices are plugged into 6-port hubs,
        - when certain disk enclosures are switched from self-power to bus
          power or vice versa and break the daisy chain during the transition,
        - when the user plugs a cable out and quickly plugs it back in, e.g.
          to reorder a daisy chain (works on Mac OS X if done quickly enough),
        - when certain hubs temporarily malfunction during high bus traffic.
      
      Until now, firewire-core reported affected nodes as lost to the
      highlevel drivers (firewire-sbp2 and userspace drivers).  We now delay
      the destruction of device representations until after at least two
      seconds after the last bus reset.  If a "new" device is detected in this
      period whose bus information block and root directory header match that
      of a device which is pending for deletion, we resurrect that device and
      send update calls to highlevel drivers.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      3d36a0df
  12. 10 1月, 2009 1 次提交
  13. 05 1月, 2009 2 次提交
  14. 31 10月, 2008 1 次提交
  15. 16 10月, 2008 1 次提交
  16. 14 7月, 2008 1 次提交
    • S
      firewire: clean up fw_card reference counting · 459f7923
      Stefan Richter 提交于
      This is a functionally equivalent replacement of the current reference
      counting of struct fw_card instances.  It only converts it to common
      idioms as suggested by Kristian Høgsberg:
        - struct kref replaces atomic_t as the counter.
        - wait_for_completion is used to wait for all card users to complete.
      
      BTW, it may make sense to count card->flush_timer and card->work as
      card users too.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      459f7923
  17. 19 4月, 2008 1 次提交
  18. 18 4月, 2008 3 次提交