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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 15 Aug 2011 12:05:03 +0200
From:	Manohar Vanga <manohar.vanga@...n.ch>
To:	"Emilio G. Cota" <cota@...ap.org>
CC:	<martyn.welch@...com>, <gregkh@...e.de>,
	<devel@...verdev.osuosl.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/5] staging: vme: add functions for bridge module
 refcounting

> If the driver doesn't provide a .probe, we would still increment
> the refcount of the bridge module. Is that reasonable? I dunno.
> 
> If there's no .probe then the device is doing something
> weird, and probably either it doesn't have much to do with a
> particular bridge (i.e. it manages no "real" devices) or
> it'd need to manage its own resources (in which case we could
> easily export vme_bridge_get/put.)
> 
> Perhaps then the following would be more appropriate,
> what do you think?
> 
> +	if (driver->probe) {
> +		if (vme_bridge_get(bridge->num))
> +			return -ENXIO; /* although this could change, see above comment */
> +
>  		retval = driver->probe(dev, bridge->num, vme_calc_slot(dev));
> +		if (retval)
> +			vme_bridge_put(bridge);
> +	}
> +
>  	return retval;
> 
> .. and then remember to do
> + 	if (probe)
> + 		vme_bridge_put(bridge)
> in vme_bus_remove(), which in your patch is unconditional (correctly
> matching the unconditional get() in vme_bus_probe)

I picked this default behaviour from the PCI driver code (drivers/pci/pci-driver.c):

	static int pci_device_probe(struct device * dev)
	{
		...
		pci_dev_get(pci_dev);
		error = __pci_device_probe(drv, pci_dev);
		if (error)
			pci_dev_put(pci_dev);
	
		return error;
	}

The __pci_device_probe() function checks if probe is present or not.

> I'm certainly no checkpatch taliban, but guess you probably
> didn't want to send this line change.

Gak! Will cleanup and resend.

--
/manohar
--
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