lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150621052430.GA27824@ZenIV.linux.org.uk>
Date:	Sun, 21 Jun 2015 06:24:30 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	John Stultz <john.stultz@...aro.org>
Cc:	Felipe Balbi <balbi@...com>,
	Andrzej Pietrasiewicz <andrzej.p@...sung.com>,
	Krzysztof Opasiak <k.opasiak@...sung.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Michal Nazarewicz <mina86@...a86.com>,
	Robert Baldyga <r.baldyga@...sung.com>,
	lkml <linux-kernel@...r.kernel.org>, linux-usb@...r.kernel.org
Subject: Re: Locking issues w/ functionfs gadget and aio?

On Fri, Jun 12, 2015 at 05:51:12PM -0700, John Stultz wrote:

> I'm not super sure what the right fix is, but if do something like the
> following (sorry, whitespace corrupted via copy/paste), I don't seem
> to run into the problem.

Looks sane.  Which tree would you prefer it to go through, vfs or usb?
BTW, in either case you'd need Signed-off-by: on that patch...

> diff --git a/drivers/usb/gadget/function/f_fs.c
> b/drivers/usb/gadget/function/f_fs.c
> index 3507f88..e322818 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb
> *kiocb, struct iov_iter *from)
> 
>         kiocb->private = p;
> 
> -       kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> +       if (p->aio)
> +               kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> 
>         res = ffs_epfile_io(kiocb->ki_filp, p);
>         if (res == -EIOCBQUEUED)
> @@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb
> *kiocb, struct iov_iter *to)
> 
>         kiocb->private = p;
> 
> -       kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> +       if(p->aio)
> +               kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> 
>         res = ffs_epfile_io(kiocb->ki_filp, p);
>         if (res == -EIOCBQUEUED)
> 
> 
> Is there a better solution here? I'm not sure I see if the
> is_sync_kiocb(kiocb) check would ever be false from here, so I'm not
> sure if all the p->aio checking is really needed or not.
> 
> This issue seems to have been introduced with 70e60d917e91fff
> (gadget/function/f_fs.c: switch to ->{read,write}_iter())
> 
> thanks
> -john
> --
> 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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ