Re: [PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-14 Thread Felipe Balbi
Hi, On Wed, Nov 14, 2012 at 12:50:53AM -0500, Xi Wang wrote: > * drivers/usb/gadget/amd5536udc.c (2) > > Use dev->gadget.dev or dev->pdev->dev for dma_pool_create()? Also move > the init_dma_pools() call after the assignments in udc_pci_probe(). Makes sense to me. Do you want to provide a patch

Re: [PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-13 Thread Xi Wang
On 11/13/12 7:58 PM, Andrew Morton wrote: > I'm not sure that I really suggested doing this :( You suggested WARN_ON_ONCE(!dev); I changed it to WARN_ON(!dev) and kept the NULL check.. > We know there are a few scruffy drivers which are passing in dev==0. > > Those drivers don't oops because no

Re: [PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-13 Thread Andrew Morton
On Tue, 13 Nov 2012 16:39:37 -0500 Xi Wang wrote: > A few drivers invoke dma_pool_create() with a null dev. Note that dev > is dereferenced in dev_to_node(dev), causing a null pointer dereference. > > A long term solution is to disallow null dev. Once the drivers are > fixed, we can simplify t

Re: [PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-13 Thread Andrew Morton
On Tue, 13 Nov 2012 15:01:34 -0800 (PST) David Rientjes wrote: > On Tue, 13 Nov 2012, Xi Wang wrote: > > > diff --git a/mm/dmapool.c b/mm/dmapool.c > > index c5ab33b..bf7f8f0 100644 > > --- a/mm/dmapool.c > > +++ b/mm/dmapool.c > > @@ -135,6 +135,7 @@ struct dma_pool *dma_pool_create(const char

Re: [PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-13 Thread David Rientjes
On Tue, 13 Nov 2012, Xi Wang wrote: > diff --git a/mm/dmapool.c b/mm/dmapool.c > index c5ab33b..bf7f8f0 100644 > --- a/mm/dmapool.c > +++ b/mm/dmapool.c > @@ -135,6 +135,7 @@ struct dma_pool *dma_pool_create(const char *name, struct > device *dev, > { > struct dma_pool *retval; > siz

[PATCH v2] mm: fix null dev in dma_pool_create()

2012-11-13 Thread Xi Wang
A few drivers invoke dma_pool_create() with a null dev. Note that dev is dereferenced in dev_to_node(dev), causing a null pointer dereference. A long term solution is to disallow null dev. Once the drivers are fixed, we can simplify the core code here. For now we add WARN_ON(!dev) to notify the