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] [day] [month] [year] [list]
Date:	Mon, 11 Oct 2010 10:41:25 +0530
From:	"Koul, Vinod" <vinod.koul@...el.com>
To:	"Williams, Dan J" <dan.j.williams@...el.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"alan@...ux.intel.com" <alan@...ux.intel.com>,
	"K V, Ramesh B" <ramesh.b.k.v@...el.com>,
	"yong.y.wang@...ux.intel.com" <yong.y.wang@...ux.intel.com>
Subject: RE: [PATCH 6/6] intel_mid_dma: change the slave interface


On Fri, Oct 8, 2010 at 10:58 PM, dan.j.williams@...il.com wrote:
> On Mon, Oct 4, 2010 at 3:38 AM, Vinod Koul <vinod.koul@...el.com> wrote:
> > In 2.6.36 kernel, dma slave control command was introduced,
> > this patch changes the intel-mid-dma driver to this
> > new kernel slave interface
> >
> > Signed-off-by: Vinod Koul <vinod.koul@...el.com>
> > ---
> [..]
> > +static int dma_slave_control(struct dma_chan *chan, unsigned long arg)
> > +{
> > +       struct intel_mid_dma_chan       *midc = to_intel_mid_dma_chan(chan);
> > +       struct dma_slave_config  *slave = (struct dma_slave_config *)arg;
> > +       struct intel_mid_dma_slave *mid_slave;
> > +
> > +       BUG_ON(!midc);
> > +       BUG_ON(!slave);
> > +       pr_debug("MDMA: slave control called\n");
> > +
> > +       mid_slave = to_intel_mid_dma_slave(slave);
> 
> I know this was the initial recommendation to support custom
> extensions to dma_slave_config, but this isn't safe.  How does this
> routine know that that 'slave' is embedded in an intel_mid_dma_slave
> structure.  I applied it as is, but I think we need a better approach.
> 
> Maybe a per device alloc_dma_slave_config() such that ->dma_control()
> can assume the driver allocated the dma_slave_config.  As it stands
> nothing in the calling convention guarantees type safety.


Dan,
Thanks for applying the patches.

I had thought thru this earlier, yes I agree that it is not fully safe to 
*assume* that intel_mid_dma_slave embeds the dma_slave_config structure.

But we can also argue that since this is DMA_SLAVE device and device needs to 
always pass controller specific arguments and hence knows about this controller,
so will have such a thing in place.
Yes but this can be easily abused.

Another alternative is to maintain the channel->private pointer for these sort 
of details as we were doing previously...

Thoughts...?

~Vinod



--
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