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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 09 Aug 2011 15:26:09 +0100
From:	Martyn Welch <martyn.welch@...com>
To:	"Emilio G. Cota" <cota@...ap.org>, gregkh@...e.de,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/8] staging: vme: add functions for bridge module refcounting

On 09/08/11 14:24, Manohar Vanga wrote:
> Hey Martyn,
> 
>> I think that by refcounting the resources being used we will know whether a
>> bridge module is being used or not, thus whether it can be unloaded or not. By
>> reference counting the use of resources we minimise the chance of poorly
>> written drivers using resources, but not registering the fact that they are in
>> fact using a VME bridge.
> 
> In the end, this discussion is about what we want the bride module reference count
> to represent. I see your point here that it would be really useful to know what
> resources have been allocated. I am just wondering whether the module refcount is
> a good place to give information on allocated resources (rather than the bridge
> module refcount).
> 
> I am not really an expert in these matters but would something like a sysfs file
> be a cleaner approach to providing information on allocated resources within the
> driver?
> 

That would probably be a better idea.

> With this approach, I am also thinking about cases where resources are not allocated
> within the probe call. This can cause issues if the bridge module is removed after
> a successful probe but before the resources are allocated. This would be a direct
> bug :-/
> 
> If we really don't want explicit module refcounting by drivers, can we perhaps use
> the return value of the probe to automatically do this? eg. in vme_bus_probe() like
> below:
> 
>     int ret = 0;
>     ...
>     vme_bridge_get(bridge);
>     if (driver->probe)
>             ret = driver->probe(vdev);
>     if (ret)
>         vme_bridge_put(bridge);
>     return ret;
> 
> Just a thought. Feel free to shoot it down if you think it's the incorrect
> approach :P
> 

After looking at the PCI and RapidIO subsystems, I think this is probably the
correct approach. I guess the only quiestion then is at which point is
vme_bridge_put() called assuming the probe is successful. I guess at module
unload time, though I haven't checked in the PCI and RapidIO code.

(Thank you for your patience)

Martyn

> Thanks!
> 
> --
> /manohar


-- 
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms                   | Wales (3828642) at 100
T +44(0)127322748                          | Barbirolli Square, Manchester,
E martyn.welch@...com                      | M2 3AB  VAT:GB 927559189
--
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/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ