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]
Message-ID: <CAOh2x=niXPCeg1dWtmjDjms_8ndYD7pzGY37k36e8=D8Km7gqQ@mail.gmail.com>
Date:	Wed, 14 Nov 2012 08:17:53 +0530
From:	viresh kumar <viresh.kumar@...aro.org>
To:	Jon Mason <jon.mason@...el.com>
Cc:	linux-kernel@...r.kernel.org, Dave Jiang <dave.jiang@...el.com>,
	Vinod Koul <vinod.koul@...el.com>, Dan Williams <djbw@...com>
Subject: Re: [PATCH v2] dmatest: Fix NULL pointer dereference on ioat

On Mon, Nov 12, 2012 at 4:33 AM, Jon Mason <jon.mason@...el.com> wrote:
> device_control is an optional and not implemented in all DMA drivers.
> Any calls to these will result in a NULL pointer dereference.  dmatest
> makes two of these calls when completing the kernel thread and removing
> the module.  These are corrected by calling the dmaengine_device_control
> wrapper and checking for a non-existant device_control function pointer
> there.
>
> Signed-off-by: Jon Mason <jon.mason@...el.com>
> CC: Vinod Koul <vinod.koul@...el.com>
> CC: Dan Williams <djbw@...com>
> ---
>  drivers/dma/dmatest.c     |    4 ++--
>  include/linux/dmaengine.h |    5 ++++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index 24225f0..6ef9465 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -499,7 +499,7 @@ err_srcs:
>                         thread_name, total_tests, failed_tests, ret);
>
>         /* terminate all transfers on specified channels */
> -       chan->device->device_control(chan, DMA_TERMINATE_ALL, 0);
> +       dmaengine_terminate_all(chan);
>         if (iterations > 0)
>                 while (!kthread_should_stop()) {
>                         DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait_dmatest_exit);
> @@ -524,7 +524,7 @@ static void dmatest_cleanup_channel(struct dmatest_chan *dtc)
>         }
>
>         /* terminate all transfers on specified channels */
> -       dtc->chan->device->device_control(dtc->chan, DMA_TERMINATE_ALL, 0);
> +       dmaengine_terminate_all(dtc->chan);
>
>         kfree(dtc);
>  }
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index d3201e4..cf94e5f 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -608,7 +608,10 @@ static inline int dmaengine_device_control(struct dma_chan *chan,
>                                            enum dma_ctrl_cmd cmd,
>                                            unsigned long arg)
>  {
> -       return chan->device->device_control(chan, cmd, arg);
> +       if (chan->device->device_control)
> +               return chan->device->device_control(chan, cmd, arg);
> +       else
> +               return -ENOSYS;
>  }

Reviewed-by: Viresh Kumar <viresh.kumar@...aro.org>
--
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