From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbcJDA0J (ORCPT ); Mon, 3 Oct 2016 20:26:09 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:36302 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636AbcJDA0H (ORCPT ); Mon, 3 Oct 2016 20:26:07 -0400 MIME-Version: 1.0 In-Reply-To: <1475539654-31945-2-git-send-email-mina86@mina86.com> References: <205cfce1-d54c-262d-f939-ad9f37b0c52c@huawei.com> <1475539654-31945-1-git-send-email-mina86@mina86.com> <1475539654-31945-2-git-send-email-mina86@mina86.com> From: John Stultz Date: Mon, 3 Oct 2016 17:26:06 -0700 Message-ID: Subject: Re: [PATCH 2/2] usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable To: Michal Nazarewicz Cc: Chen Yu , Felipe Balbi , Greg KH , Biggo Wang , Amit Pundir , Guodong Xu , lkml , linux-usb@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u940QICr004673 On Mon, Oct 3, 2016 at 5:07 PM, Michal Nazarewicz wrote: > ffs_func_eps_disable is called from atomic context so it cannot sleep > thus cannot grab a mutex. Change the handling of epfile->read_buffer > to use non-sleeping synchronisation method. > > Reported-by: Chen Yu > Signed-off-by: Michał Nazarewicz > Fixes: 9353afbbfa7b ("buffer data from ‘oversized’ OUT requests") > Tested-by: Chen Yu > --- > drivers/usb/gadget/function/f_fs.c | 109 +++++++++++++++++++++++++++++++------ > 1 file changed, 93 insertions(+), 16 deletions(-) > > Compared to the previous version: > • this one has a bit more comments (I feel like it’s a bad sign that > this needs so much documentation); > • ffs_epfile_realese sets read_buffer to READ_BUFFER_DROP (which > doesn’t matter since on entry __ffs_epfile_read_buffered behaves > the same way when read_buffer is NULL or READ_BUFFER_DROP); and > • __ffs_epfile_read_data will drop the temporary data if read_buffer > is READ_BUFFER_DROP (which may happen if ep is disabled between ep > request finishes and data is copied to user space). > > Chen, John, if you could test this version as well, that would be > swell. for both patches: Tested-by: John Stultz Thanks so much for these! -john