lkml.org 
[lkml]   [2010]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 5/5] uio: Implement hotunplug support, using libunload
"Hans J. Koch" <hjk@linutronix.de> writes:

> On Mon, Sep 20, 2010 at 12:24:19AM -0700, Eric W. Biederman wrote:
>>
>> }
>>
>> static ssize_t uio_read(struct file *filep, char __user *buf,
>> size_t count, loff_t *ppos)
>> {
>> struct uio_listener *listener = filep->private_data;
>> - struct uio_device *idev = listener->dev;
>> + struct uio_device *idev = listener_idev(listener);
>> DECLARE_WAITQUEUE(wait, current);
>> ssize_t retval;
>> s32 event_count;
>>
>> - if (!idev->info->irq)
>> + if (!unload_trylock(&idev->unload))
>> return -EIO;
>>
>> + retval = -EIO;
>> + if (!idev->info->irq)
>> + goto out;
>> +
>> + retval = -EIO;
>> if (count != sizeof(s32))
>> - return -EINVAL;
>> + goto out;
>
> No. uio_read() should return -EINVAL if count != sizeof(s32). This is
> simply wrong userspace code that passes in an illegal value, so it's
> not an IO error but an invalid parameter.
> BTW, you use -EINVAL in the same situation in uio_write()...

Apologies. That was a typo. It was my intention to preserve the
existing return codes.

Eric


\
 
 \ /
  Last update: 2010-09-27 20:09    [W:0.186 / U:0.048 seconds]
©2003-2014 Jasper Spaans. Advertise on this site