From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932691AbcEQCxx (ORCPT ); Mon, 16 May 2016 22:53:53 -0400 Received: from mga14.intel.com ([192.55.52.115]:54715 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbcEQCxw (ORCPT ); Mon, 16 May 2016 22:53:52 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,323,1459839600"; d="scan'208";a="982507976" From: "Du, Changbin" To: Michal Nazarewicz , Felipe Balbi , Alan Stern CC: Al Viro , "gregkh@linuxfoundation.org" , "rui.silva@linaro.org" , "k.opasiak@samsung.com" , "lars@metafoo.de" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] usb: gadget: f_fs: report error if excess data received Thread-Topic: [PATCH] usb: gadget: f_fs: report error if excess data received Thread-Index: AQHRq3BkOTyP65TD/EyOGR5aoZlhp5+zC1+AgAGg+eD//6xsgIAAiP0A//+GGYCAAIkPQP//j6UAABFEzND//4Z3AP//dChAgACe5AD//nhXAIACyeWAgACETwCABJ1TAIAAAugAgAACeYCAAGJkAP/++X8w Date: Tue, 17 May 2016 02:53:48 +0000 Message-ID: <0C18FE92A7765D4EB9EE5D38D86A563A05D30546@SHSMSX103.ccr.corp.intel.com> References: <87eg92p3cn.fsf@linux.intel.com> <87bn46p2gk.fsf@linux.intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjcxMDI1OTgtNmYzMy00MTNlLWIyNWUtYzk2NTUxODFjOTEyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlRKbTJEcDJWZkZQaENHdDAzelNOUlE5RGtnT1hpNXVwMENlSm9udW9VNGc9In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 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 base64 to 8bit by mail.home.local id u4H2rxvA019995 > There appears to be no kfifo support for iov_iter though, so I just went > with a simple buffer. > > I haven’t looked at the patch too carefully so this is an RFC rather > than an actual patch at this point. It does compile at least. > > Regardless, the more I thin about it, the more I’m under the impression > that the whole rounding up in f_fs was a mistake. And the more I’m > leaning towards ignoring the excess data set by the host. > > ---------- >8 ---------------------------------------------------------- > Subject: usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests > > f_fs rounds up read(2) requests to a multiple of a max packet size > which means that host may provide more data than user has space for. > So far, the excess data has been silently ignored. > > This introduces a buffer for a tail of such requests so that they are > returned on next read instead of being ignored. > Congratulations finally reach an agreement, thanks Alan Stern and Michal. Here just have a comment - the buffered data need be dropped when the epfile is closed, because it means the session is terminated.