1. 15 Oct, 2013 2 commits
    • Lars-Peter Clausen's avatar
      iio:kfifo: Protect against concurrent access from userspace · 0894d80d
      Lars-Peter Clausen authored
      It is possible for userspace to concurrently access the buffer from multiple
      threads or processes. To avoid corruption of the internal state of the buffer we
      need to add proper locking. It is possible for multiple processes to try to read
      from the buffer concurrently and it is also possible that one process causes a
      buffer re-allocation while a different process still access the buffer. Both can
      be fixed by protecting the calls to kfifo_to_user() and kfifo_alloc() by the
      same mutex. In iio_read_first_n_kfifo() we also use kfifo_recsize() instead of
      the buffers bytes_per_datum to avoid a race that can happen if bytes_per_datum
      has been changed, but the buffer has not been reallocated yet.
      
      Note that all access to the buffer from within the kernel is already properly
      synchronized, so there is no need for extra locking in iio_store_to_kfifo().
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      0894d80d
    • Lars-Peter Clausen's avatar
      iio:kfifo: Fix memory leak · f6c23f48
      Lars-Peter Clausen authored
      We need to free the kfifo when we release the buffer, otherwise the fifos memory
      will be leaked.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      f6c23f48
  2. 14 Oct, 2013 3 commits
  3. 12 Oct, 2013 27 commits
  4. 09 Oct, 2013 2 commits
  5. 07 Oct, 2013 6 commits