On 3.2.2016 01:58, Raghava Aditya Renukunta wrote:
> aac_mutex was used to create protect the ioctl path for only the
> compat path, it would be make more sense to place mutex in
> aac_do_ioctl, which is the main ioctl function call that handles
> all ioctl commands.
>
> Created new mutex ioctl_mutex in struct aac_dev to protect switch
> case in aac_do_ioctl and removed aac_mutex from aac_cfg_ioctl and
> aac_compat_do_ioctl
>
> Signed-off-by: Raghava Aditya Renukunta <[email protected]>
> ---
>  drivers/scsi/aacraid/aacraid.h  |  1 +
>  drivers/scsi/aacraid/commctrl.c |  4 ++++
>  drivers/scsi/aacraid/linit.c    | 12 ++----------
>  3 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index 2916288..75bc65e 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -1124,6 +1124,7 @@ struct aac_dev
>       struct fib              *free_fib;
>       spinlock_t              fib_lock;
>  
> +     struct mutex            ioctl_mutex;
>       struct aac_queue_block *queues;
>       /*
>        *      The user API will use an IOCTL to register itself to receive
> diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
> index 54195a1..4d5f4e7 100644
> --- a/drivers/scsi/aacraid/commctrl.c
> +++ b/drivers/scsi/aacraid/commctrl.c
> @@ -855,6 +855,8 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void 
> __user *arg)
>  {
>       int status;
>  
> +     mutex_lock(&dev->ioctl_mutex);
> +

       status = aac_dev_ioctl(dev, cmd, arg);
        if (status != -ENOTTY)
                return status;

That return^ needs a mutex unlock .
--tms

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to