Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752101AbcDRJ04 (ORCPT ); Mon, 18 Apr 2016 05:26:56 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:14232 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbcDRJ0y (ORCPT ); Mon, 18 Apr 2016 05:26:54 -0400 MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed X-AuditID: cbfec7f5-f792a6d000001302-bd-5714a85bd816 Content-transfer-encoding: 8BIT Subject: Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another To: Michal Nazarewicz , Alan Stern References: Cc: Ivaylo Dimitrov , Tony Lindgren , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Felipe Balbi , Bin Liu , pali.rohar@gmail.com From: Andrzej Pietrasiewicz Message-id: <5714A852.2040705@samsung.com> Date: Mon, 18 Apr 2016 11:26:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-reply-to: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRmVeSWpSXmKPExsVy+t/xK7rRK0TCDWZP5rH4f2cRq8X8m0kW S64cYre4vGsOm8WiZa3MFguOt7BaTDz9m8liwu8LbBb7r3g5cHp8+zqJxWPnrLvsHvNOBnqs +/OKyWP23R+MHsdvbGfy+LxJLoA9issmJTUnsyy1SN8ugStj1c+5rAV7uSrurb7I1sA4laOL kZNDQsBE4u7b2WwQtpjEhXvrgWwuDiGBpYwS23/tZgZJ8AoISvyYfI+li5GDg1lAXuLIpWyQ MLOAmcSXl4dZIepfMEps/T+TCaRGWCBJYuXGCJAaEYFgicf9k9lBbCGBHIl5306B1TMLvGWU WPl7KyNIgk3AWGLvwQ5GiF1aEi8vTmYBsVkEVCXm9s9lArFFBSIknsw9CVbDCVQzc+Z3lgmM ArOQnDcL4bxZSM5bwMi8ilE0tTS5oDgpPddIrzgxt7g0L10vOT93EyMkCr7uYFx6zOoQowAH oxIPbwSDSLgQa2JZcWXuIUYJDmYlEd5pi4FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeWfueh8i JJCeWJKanZpakFoEk2Xi4JRqYFxxMKpqVX879/xTC2UXbZkjeozD6NvnJfsTGVzkWp/41vvv bly/Ii2saNukkzdyX/jdimkRuyC0ov7IF971NyweL1aYKbTv1Kor/9MPh85ctqas8+Nhlxu/ 2JYH/Lrq/Kkvjkfkz3GjxO0b3SYtyUpakXB5gUTNNN/dVSIm6zMu/ev9LXnma3W8EktxRqKh FnNRcSIA4suQuX4CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1297 Lines: 44 Hi Michał, W dniu 07.04.2016 o 18:40, Michal Nazarewicz pisze: >> On Thu, 7 Apr 2016, Michal Nazarewicz wrote: >>> This makes me suspect it’s not possible to link a function instance to >>> the same configuration twice, but now that I think about it, I’m not >>> quite sure what would happen if one did: >>> >>> ln -s functions/mass_storage.0 configs/c.1/foo >>> ln -s functions/mass_storage.0 configs/c.1/bar > > On Thu, Apr 07 2016, Alan Stern wrote: >> Do you think it would be worthwhile to check for this possibility in >> the driver and report an error? > > I think this should be (if it isn’t already) blocked on configfs side. > I cannot see a legitimate use of such configuration and I wouldn’t be > surprised if other function drivers broke as well. > Sorry about late response. The function responsible for verifying if a symlink can be made is in drivers/usb/gadget/configfs.c: config_usb_cfg_link() There is a comment from the author: /* * Make sure this function is from within our _this_ gadget and not * from another gadget or a random directory. * Also a function instance can only be linked once. */ This is the code fragment of interest: list_for_each_entry(f, &cfg->func_list, list) { if (f->fi == fi) { ret = -EEXIST; goto out; } } AP