1. 12 10月, 2013 2 次提交
    • L
      iio: Return -ENODEV for file operations if the device has been unregistered · f18e7a06
      Lars-Peter Clausen 提交于
      If the IIO device has been unregistered return -ENODEV for any further file
      operations like read() and ioctl(). This avoids userspace being able to grab new
      references to the device.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      f18e7a06
    • L
      iio: Add reference counting for buffers · 9e69c935
      Lars-Peter Clausen 提交于
      Since the buffer is accessed by userspace we can not just free the buffers
      memory once we are done with it in kernel space. There might still be open file
      descriptors and userspace still might be accessing the buffer. This patch adds
      support for reference counting to the IIO buffers. When a buffer is created and
      initialized its initial reference count is set to 1. Instead of freeing the
      memory of the buffer the buffer's _free() function will drop that reference
      again. But only after the last reference to the buffer has been dropped the
      buffer the buffer's memory will be freed. The IIO device will take a reference
      to its primary buffer. The patch adds a small helper function for this called
      iio_device_attach_buffer() which will get a reference to the buffer and assign
      the buffer to the IIO device. This function must be used instead of assigning
      the buffer to the device by hand. The reference is only dropped once the IIO
      device is freed and we can be sure that there are no more open file handles. A
      reference to a buffer will also be taken whenever the buffer is active to avoid
      the buffer being freed while data is still being send to it.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      9e69c935
  2. 10 10月, 2013 2 次提交
  3. 07 10月, 2013 32 次提交
  4. 06 10月, 2013 4 次提交