Re: [PATCH] MPSC serial driver tx locking

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

 



On Tue, May 09, 2006 at 05:35:52PM -0700, Dave Jiang wrote:
> @@ -1997,7 +2018,7 @@ mpsc_drv_probe(struct platform_device *d
>  			if (!(rc = mpsc_make_ready(pi)))
>  				if (!(rc = uart_add_one_port(&mpsc_reg,
>  					&pi->port)))
> -					rc = 0;
> +					spin_lock_init(&pi->tx_lock);

You publish the port to the uart layer and then do initialisation.
What if someone nips in and starts using the port between registering
it and initialising the spinlock?  (that's a general principle - for
any device driver, never publish the device interfaces until you've
completed all initialisation.)

Why not do the spinlock initialisation first?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux