Message ID | alpine.DEB.2.20.1712170739410.2501@hadrien (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Dec 17, 2017 at 7:43 AM, Julia Lawall <julia.lawall@lip6.fr> wrote: > From: Fengguang Wu <fengguang.wu@intel.com> > > Allocation with GFP_KERNEL in code called from the function > geth_resize_freeq with locks held. > > Generated by: scripts/coccinelle/locks/call_kern.cocci > > Fixes: 502a2864e5e4 ("net: ethernet: Add a driver for Gemini gigabit ethernet") > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> > --- > > The proposed change of converting the GFP_KERNEL is not necessarily the > correct one. It may be desired to unlock the lock, or to not call the > function under the lock in the first place. It's better to drop the lock around the offending call. the lock was just there to protect the interrupt registers anyway. But thanks for finding it! I have updated the driver patch. Yours, Linus Walleij
--- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -818,7 +818,7 @@ static int geth_setup_freeq(struct gemin geth->freeq_ring = dma_alloc_coherent(geth->dev, sizeof(*geth->freeq_ring) << geth->freeq_order, - &geth->freeq_dma_base, GFP_KERNEL); + &geth->freeq_dma_base, GFP_ATOMIC); if (!geth->freeq_ring) return -ENOMEM; if (geth->freeq_dma_base & ~DMA_Q_BASE_MASK) { @@ -827,7 +827,7 @@ static int geth_setup_freeq(struct gemin } geth->freeq_page_tab = kzalloc(pages * sizeof(*geth->freeq_page_tab), - GFP_KERNEL); + GFP_ATOMIC); if (!geth->freeq_page_tab) goto err_freeq;