diff --git a/net/core/page_pool.c b/net/core/page_pool.c index f55ab055d543..b366f59885c1 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -48,6 +49,9 @@ static int page_pool_init(struct page_pool *pool, atomic_set(&pool->pages_state_release_cnt, 0); + if (pool->p.flags & PP_FLAG_DMA_MAP) + get_device(pool->p.dev); + return 0; } @@ -360,6 +364,10 @@ void __page_pool_free(struct page_pool *pool) __warn_in_flight(pool); ptr_ring_cleanup(&pool->ring, NULL); + + if (pool->p.flags & PP_FLAG_DMA_MAP) + put_device(pool->p.dev); + kfree(pool); } EXPORT_SYMBOL(__page_pool_free);