Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1381407 > unrolled thread

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

Started byAndrzej Pietrasiewicz <andrzej.p@samsung.com>
First post2016-04-18 11:30 +0200
Last post2016-04-19 16:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] usb: f_mass_storage: test whether thread is running before  starting another Andrzej Pietrasiewicz <andrzej.p@samsung.com> - 2016-04-18 11:30 +0200
    Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another Michal Nazarewicz <mina86@mina86.com> - 2016-04-19 16:40 +0200

#1381407 — Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

FromAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Date2016-04-18 11:30 +0200
SubjectRe: [PATCH] usb: f_mass_storage: test whether thread is running before starting another
Message-ID<rpdFh-32l-9@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1382568 — Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

FromMichal Nazarewicz <mina86@mina86.com>
Date2016-04-19 16:40 +0200
SubjectRe: [PATCH] usb: f_mass_storage: test whether thread is running before starting another
Message-ID<rpEYN-8k2-7@gated-at.bofh.it>
In reply to#1381407
On Mon, Apr 18 2016, Andrzej Pietrasiewicz wrote:
> 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:
>
> 	 * 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;
> 		}
> 	}

Thanks for checking.  This is exactly the kind of check I expected so
checking for thread not being run multiple times is enough when
configfs is in use.

Legacy gadgets may still construct crazy configurations but I’d call
that a bug in such legacy gadget.

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web