Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: warn during dump if NAPI list is not sorted

Dump continuation depends on the NAPI list being sorted.
Broken netlink dump continuation may be rare and hard to debug
so add a warning if we notice the potential problem while walking
the list.

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Link: https://patch.msgid.link/20250110004505.3210140-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+7
+7
net/core/netdev-genl.c
··· 263 263 struct netdev_nl_dump_ctx *ctx) 264 264 { 265 265 struct napi_struct *napi; 266 + unsigned int prev_id; 266 267 int err = 0; 267 268 268 269 if (!(netdev->flags & IFF_UP)) 269 270 return err; 270 271 272 + prev_id = UINT_MAX; 271 273 list_for_each_entry(napi, &netdev->napi_list, dev_list) { 272 274 if (napi->napi_id < MIN_NAPI_ID) 273 275 continue; 276 + 277 + /* Dump continuation below depends on the list being sorted */ 278 + WARN_ON_ONCE(napi->napi_id >= prev_id); 279 + prev_id = napi->napi_id; 280 + 274 281 if (ctx->napi_id && napi->napi_id >= ctx->napi_id) 275 282 continue; 276 283