Date: Sun, 18 Jun 2017 17:20:23 +0800 From: Jia-Ju Bai <baijiaju1990@163.com> To: erj@freebsd.org, sbruno@FreeBSD.org Cc: freebsd-drivers@freebsd.org, freebsd-net@freebsd.org, Jia-Ju Bai <baijiaju1990@163.com> Subject: [BUG 220033][PATCH] if_ixgb: Fix a possible sleep-under-mutex bug in ixge_get_buf Message-ID: <20170618092023.40369-1-baijiaju1990@163.com>
next in thread | raw e-mail | index | archive | help
The ixgb driver may sleep under a mutex, and the function call path is: ixgb_init [acquire the mutex] ixgb_init_locked ixgb_setup_receive_structures ixgb_allocate_receive_structures ixgb_get_buf bus_dmamap_load(BUS_DMA_WAITOK) --> may sleep The possible fix of these bugs is to set the last parameter in bus_dmamap_load to "BUS_DMA_NOWAIT". This bug is found by a static analysis tool written by myself, and it is checked by my review of the FreeBSD code. Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com> --- sys/dev/ixgb/if_ixgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index 430c13c72d1..e6d02dd172e 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -1811,7 +1811,7 @@ ixgb_get_buf(int i, struct adapter * adapter, */ error = bus_dmamap_load(adapter->rxtag, rx_buffer->map, mtod(mp, void *), mp->m_len, - ixgb_dmamap_cb, &paddr, 0); + ixgb_dmamap_cb, &paddr, BUS_DMA_NOWAIT); if (error) { m_free(mp); return (error); -- 2.13.0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170618092023.40369-1-baijiaju1990>