mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
nvme-tcp: look up host_iface in the current netns
nvme_tcp_alloc_ctrl() looks opts->host_iface up in &init_net, the boot-time netns. When called from any other netns - e.g. the selftest's ns2, where ns2eth1 actually lives - the lookup misses and the controller setup fails with "invalid interface passed": nvmet: adding nsid 1 to subsystem nqn.2014-08.org.nvmexpress.mptcpdev nvmet_tcp: enabling port 24660 (0.0.0.0:24099) # nvme discover -a 10.1.1.1 --tos=0x10 --host-iface=ns2eth1 nvme_tcp: invalid interface passed: ns2eth1 # failed to add controller, error invalid interface Look the device up in current->nsproxy->net_ns instead so the check sees the calling task's netns. Reviewed-by: Hannes Reinecke <hare@kernel.org> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
bc7f75eba5
commit
58202950e3
|
|
@ -2965,7 +2965,8 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
|
|||
}
|
||||
|
||||
if (opts->mask & NVMF_OPT_HOST_IFACE) {
|
||||
if (!__dev_get_by_name(&init_net, opts->host_iface)) {
|
||||
if (!__dev_get_by_name(current->nsproxy->net_ns,
|
||||
opts->host_iface)) {
|
||||
pr_err("invalid interface passed: %s\n",
|
||||
opts->host_iface);
|
||||
ret = -ENODEV;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user