summaryrefslogtreecommitdiff
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-11-12 12:26:14 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-11-12 12:26:14 -0800
commit7e1392a42ea288d70a266f6553fe06f57f8647ea (patch)
treebda5c41fdd8dc609746acaf847693a1f525a5b0d /net/core/net_namespace.c
parentd3e7c23ec3d004de154dc85d3ddeae0feff4159d (diff)
parentdee3429e94d8089713645706df678ec54a049e13 (diff)
downloadlinux-next-stable.tar.gz
linux-next-stable.zip
Merge tag 'net-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netstable
Pull networking fixes from Jakub Kicinski: "Including fixes from netfilter, wireless and bluetooth. Previous releases - regressions: - tcp: rate limit receive queue collapsing - raw: fix ICMP unreachable sent when receive queue is full - eth: bnxt_en: take RTNL before netif_close() when aborting FW reset Previous releases - always broken: - tcp: - bound snd_cwnd_clamp to TCP_MAX_SND_CWND - number of fixes for TCP Fast Open - gro: - invalidate frag0 after a pull - avoid parsing headers from shared fragments - cipso: stop modifying live ip_options_rcu - udp: do not use a cross-family sk_rx_dst in early demux - fou: gue: check IP version of held packets for direct IP encapsulation - skbuff: preserve fclone lifetime when freeing stolen heads - eth: - mlx5e: - fix crashes on queue stats access to queues without stats - SHAMPO, disable end padding when relaxed ordering is - ena: keep the RX buffer mapped if skb allocation fails" * tag 'net-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (227 commits) selftests: net: add a test for NSH GSO nsh: limit recursion in nsh_gso_segment() selftests: tls: Cover the cap on consecutive empty records selftests: tls: Extend coverage for zero-length records selftests: tls: Skip the zero_len tests when TLS is unavailable tls: Consume empty data records in tls_sw_splice_read() tls: Break the connection after a burst of empty data records net: phy: c45: select BASE-T1 type for the forced speed net/mlx5e: Fix false WARN_ON_ONCE in flow steering cleanup on RX init failure net/mlx5e: IPsec, don't match upper proto selectors in crypto offload TX tcp: fix request_sock use-after-free during Fast Open accept() net: usb: cdc_ncm: don't underflow the NDP room check net: netns: fix INT_MAX nsid cleanup amt: use ipv6_hdr() in amt_mldv1_leave_handler() af_unix: Inherit SO_INQ in unix_stream_connect() tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req(). mailmap: add entries for Hangbin Liu net: virtio: validate outer protocol of UDP tunnel GSO packets tun: clear stale skb->protocol of NAPI frags skbs net: virtio: fix UDP tunnel GSO header of VLAN tagged packets ...
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 300322bcf8d7..217021eeab13 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -270,14 +270,19 @@ static void ops_undo_single(struct pernet_operations *ops,
/* should be called with nsid_lock held */
static int alloc_netid(struct net *net, struct net *peer, int reqid)
{
- int min = 0, max = 0;
+ int ret;
+ u32 id;
if (reqid >= 0) {
- min = reqid;
- max = reqid + 1;
+ id = reqid;
+ ret = idr_alloc_u32(&net->netns_ids, peer, &id, id,
+ GFP_ATOMIC);
+ if (ret)
+ return ret;
+ return id;
}
- return idr_alloc(&net->netns_ids, peer, min, max, GFP_ATOMIC);
+ return idr_alloc(&net->netns_ids, peer, 0, 0, GFP_ATOMIC);
}
/* This function is used by idr_for_each(). If net is equal to peer, the
@@ -639,10 +644,10 @@ static void unhash_nsid(struct net *last)
* use for_each_net_rcu() or net_rwsem.
*/
for_each_net(tmp) {
- int id = 0;
+ unsigned long id = 0;
spin_lock(&tmp->nsid_lock);
- while ((peer = idr_get_next(&tmp->netns_ids, &id))) {
+ while ((peer = idr_get_next_ul(&tmp->netns_ids, &id))) {
int curr_id = id;
id++;