Re: gadgetfs broken since 7f7f25e8

From: Al Viro
Date: Tue Mar 03 2015 - 16:43:01 EST


On Tue, Mar 03, 2015 at 10:47:14AM -0500, Alan Stern wrote:
> On Tue, 3 Mar 2015, Al Viro wrote:
>
> > Looking at that thing again... why do they need to be dummy? After all,
> > those methods start with get_ready_ep(), which will fail unless we have
> > ->state == STATE_EP_ENABLED. So they'd be failing just fine until that
> > first write() anyway. Let's do the following:
>
> In addition to the changes you made, it looks like you will need the
> following or something similar (also untested). I'm not sure if this
> is race-free, but it's better than before.

Right, ep0 has the same kind of problem...


> @@ -1240,6 +1241,10 @@ static int
> ep0_fasync (int f, struct file *fd, int on)
> {
> struct dev_data *dev = fd->private_data;
> +
> + if (dev->state <= STATE_DEV_OPENED)
> + return -ENODEV;
> +

Er... What is protecting dev->state here? Matter of fact, what's the
point of that check at all? Right now you have .fasync = ep0_fasync
both in ep0_io_operations and in dev_init_operations, so your delta
changes the existing semantics...
--
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/