Re: [PATCH 2/4] staging: vme: make match() driver specific to improve non-VME64x support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 26, 2011 at 11:27:16 +0200, Manohar Vanga wrote:
(snip)
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index 76e08f3..9cb6938 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1317,6 +1317,7 @@ static int vme_add_bus(struct vme_bridge *bridge)
>  		if ((vme_bus_numbers & (1 << i)) == 0) {
>  			vme_bus_numbers |= (1 << i);
>  			bridge->num = i;
> +			INIT_LIST_HEAD(&bridge->devices);
>  			list_add_tail(&bridge->bus_list, &vme_bus_list);

Just realised that vme_buses_lock also protects vme_bus_list; appending
to this list here should be protected by the mutex, otherwise
vme_add_bus (ie this function) could race with __vme_register_driver,
which might access a corrupt copy of the list.

Note that vme_remove_bus does the right thing though; it acquires
the lock before unpinning the bridge from vme_bus_list.

		Emilio

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux