Skip to content

Commit b6c3662

Browse files
author
CKI KWF Bot
committed
Merge: core: stable backport from upstream form 9.8 phase 2
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7455 JIRA: https://issues.redhat.com/browse/RHEL-115645 A critical fix for core networking. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: Hangbin Liu <haliu@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 9f64643 + aea8157 commit b6c3662

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

net/core/page_pool.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats)
145145
EXPORT_SYMBOL(page_pool_ethtool_stats_get);
146146

147147
#else
148-
#define alloc_stat_inc(pool, __stat)
149-
#define recycle_stat_inc(pool, __stat)
150-
#define recycle_stat_add(pool, __stat, val)
148+
#define alloc_stat_inc(...) do { } while (0)
149+
#define recycle_stat_inc(...) do { } while (0)
150+
#define recycle_stat_add(...) do { } while (0)
151151
#endif
152152

153153
static bool page_pool_producer_lock(struct page_pool *pool)
@@ -679,19 +679,16 @@ void page_pool_return_page(struct page_pool *pool, struct page *page)
679679

680680
static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
681681
{
682-
int ret;
683-
/* BH protection not needed if current is softirq */
684-
if (in_softirq())
685-
ret = ptr_ring_produce(&pool->ring, page);
686-
else
687-
ret = ptr_ring_produce_bh(&pool->ring, page);
682+
bool in_softirq, ret;
688683

689-
if (!ret) {
684+
/* BH protection not needed if current is softirq */
685+
in_softirq = page_pool_producer_lock(pool);
686+
ret = !__ptr_ring_produce(&pool->ring, page);
687+
if (ret)
690688
recycle_stat_inc(pool, ring);
691-
return true;
692-
}
689+
page_pool_producer_unlock(pool, in_softirq);
693690

694-
return false;
691+
return ret;
695692
}
696693

697694
/* Only allow direct recycling in special circumstances, into the
@@ -1023,10 +1020,14 @@ static void page_pool_scrub(struct page_pool *pool)
10231020

10241021
static int page_pool_release(struct page_pool *pool)
10251022
{
1023+
bool in_softirq;
10261024
int inflight;
10271025

10281026
page_pool_scrub(pool);
10291027
inflight = page_pool_inflight(pool, true);
1028+
/* Acquire producer lock to make sure producers have exited. */
1029+
in_softirq = page_pool_producer_lock(pool);
1030+
page_pool_producer_unlock(pool, in_softirq);
10301031
if (!inflight)
10311032
__page_pool_destroy(pool);
10321033

0 commit comments

Comments
 (0)