Re: [PATCH][v5] HP iLO driver

From: Andrew Morton
Date: Wed Jul 09 2008 - 21:25:19 EST


On Wed, 2 Jul 2008 09:38:53 -0600 David Altobelli <david.altobelli@xxxxxx> wrote:

> A driver for the HP iLO/iLO2 management processor, which allows userspace
> programs to query the management processor. Programs can open a channel
> to the device (/dev/hpilo/dXccbN), and use this to send/receive queries.
> The O_EXCL open flag is used to indicate that a particular channel cannot
> be shared between processes. This driver will replace various packages
> HP has shipped, including hprsm and hp-ilo.
>
> v4 -> v5
> Converted more macros to inline functions
> Reorganized to remove kzalloc under spinlock
>
> v3 -> v4
> Removed an upper case variable and some extra parens
> Converted some macros to inline functions
>
> v2 -> v3
> Moved code from drivers/char to drivers/misc
>
> v1 -> v2
> Changed device path to /dev/hpilo/dXccbN.
> Removed a volatile from fifobar variable.
> Changed ILO_NAME to remove spaces.
>
>
> ...
>
> +static ssize_t ilo_write(struct file *fp, const char __user *buf,
> + size_t len, loff_t *off)
> +{
> + int err, pkt_id, pkt_len;
> + struct ccb_data *data;
> + struct ccb *driver_ccb;
> + struct ilo_hwinfo *hw;
> + void *pkt;
> +
> + data = fp->private_data;
> + driver_ccb = &data->driver_ccb;
> + hw = data->ilo_hw;
> +
> + if (is_device_reset(hw) || is_channel_reset(driver_ccb)) {
> + /*
> + * If the device has been reset, applications
> + * need to close and reopen all ccbs.
> + */
> + ilo_reset(hw);
> + return -ENODEV;
> + }

Can multiple processes open and write to this "device"? If so, the above
looks awfully racy. Perhaps vfs-level i_mutex coverage will save us on the
write-versus-write side, but not on write-versus-read.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/