staging: iio: iio_ring_rip_outer return immediately if rip_lots returns <= 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The last two days I was casing a bug related sw ringbuffer usage.
Reading from an empty buffer caused my system to crash anytime later in
all kinds of fashions. The crash happened at a time where no iio related
function calls where going on.

It appears that on my nommu development system freeing memory twice can
lead to such bugs. And the fact that it does error right away made debugging
this issue a pain.

iio_ring_rip_outer() calls rb->access.rip_lots() which defaults in the
sw ring buffer case to iio_rip_sw_rb().

iio_rip_sw_rb() returns 0 and frees the local buffer:

	if (initial_write_p == initial_read_p) /* No new data available.*/
or
	if (unlikely(initial_read_p == NULL)) /* No data here as yet */

However iio_ring_rip_outer() only checks for  copied/retured  < 0.
It then carries on copies 0 bytes to user and frees the buffer again.

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux