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.

io_uring/zcrx: resolve netdev before area creation

Some area types will require a valid struct device to be created, so
resolve netdev and struct device before creating an area.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/ac8c1482be22acfe9ca788d2c3ce31b7451ce488.1746097431.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
6c9589aa d760d3f5

+15 -14
+15 -14
io_uring/zcrx.c
··· 395 395 ifq = io_zcrx_ifq_alloc(ctx); 396 396 if (!ifq) 397 397 return -ENOMEM; 398 + ifq->rq_entries = reg.rq_entries; 398 399 399 400 scoped_guard(mutex, &ctx->mmap_lock) { 400 401 /* preallocate id */ ··· 408 407 if (ret) 409 408 goto err; 410 409 410 + ifq->netdev = netdev_get_by_index(current->nsproxy->net_ns, reg.if_idx, 411 + &ifq->netdev_tracker, GFP_KERNEL); 412 + if (!ifq->netdev) { 413 + ret = -ENODEV; 414 + goto err; 415 + } 416 + 417 + ifq->dev = ifq->netdev->dev.parent; 418 + if (!ifq->dev) { 419 + ret = -EOPNOTSUPP; 420 + goto err; 421 + } 422 + get_device(ifq->dev); 423 + 411 424 ret = io_zcrx_create_area(ifq, &ifq->area, &area); 412 425 if (ret) 413 426 goto err; 414 - 415 - ifq->rq_entries = reg.rq_entries; 416 - 417 - ret = -ENODEV; 418 - ifq->netdev = netdev_get_by_index(current->nsproxy->net_ns, reg.if_idx, 419 - &ifq->netdev_tracker, GFP_KERNEL); 420 - if (!ifq->netdev) 421 - goto err; 422 - 423 - ifq->dev = ifq->netdev->dev.parent; 424 - ret = -EOPNOTSUPP; 425 - if (!ifq->dev) 426 - goto err; 427 - get_device(ifq->dev); 428 427 429 428 mp_param.mp_ops = &io_uring_pp_zc_ops; 430 429 mp_param.mp_priv = ifq;