Re: [PATCH] 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]

 



On 10/07/10 11:41, michael.hennerich@xxxxxxxxxx wrote:
> From: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
> 
> 
Diagnosis of the problem looks right.  Sorry about this one,
all my test cases only read from the buffer when they get an
event so I've never triggered this one. Guess I need another
test case!

I think freeing twice is going to cause trouble on any machine,
I've just never triggered the case.  I'll probably start
putting together a more comprehensive test program based
around the new generic_buffer program to hammer these
corner cases.

Thanks for your hard work.  You are nailing a
lot of bugs that have been there for quite a while.  

There is another issue somewhere in that code to do with
very small reads.  I triggered it due to a userspace bug
a while ago, but haven't had a chance to chase down the 
cause as yet.  Actually it seems fairly plausible that it
is another way of triggering the issue you have fixed here.

Great to get some eyes on that ring buffer code, it is a
fairly hideous mess!

> Signed-off-by: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
Acked-by: Jonathan Cameron <jic23@xxxxxxxxx>
> ---
>  drivers/staging/iio/industrialio-ring.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/iio/industrialio-ring.c b/drivers/staging/iio/industrialio-ring.c
> index edcf6be..d393ace 100644
> --- a/drivers/staging/iio/industrialio-ring.c
> +++ b/drivers/staging/iio/industrialio-ring.c
> @@ -105,7 +105,7 @@ static ssize_t iio_ring_rip_outer(struct file *filp, char __user *buf,
>  		return -EINVAL;
>  	copied = rb->access.rip_lots(rb, count, &data, &dead_offset);
>  
> -	if (copied < 0) {
> +	if (copied <= 0) {
>  		ret = copied;
>  		goto error_ret;
>  	}
--
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