[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1wrqbcbiq.fsf@fess.ebiederm.org>
Date: Fri, 24 Sep 2010 10:11:09 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: "Hans J. Koch" <hjk@...utronix.de>
Cc: Greg Kroah-Hartman <gregkh@...e.de>, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 5/5] uio: Implement hotunplug support, using libunload
"Hans J. Koch" <hjk@...utronix.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists