Re: [PATCH 5/5] uio: Implement hotunplug support, using libunload
From: Eric W. Biederman
Date: Fri Sep 24 2010 - 13:11:20 EST
"Hans J. Koch" <hjk@xxxxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/