Bug 219792
Summary: | cifs: Net_ns leakage occurs after the mounting fails | ||
---|---|---|---|
Product: | File System | Reporter: | wangzhaolong1 |
Component: | CIFS | Assignee: | fs_cifs (fs_cifs) |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | Subsystem: | ||
Regression: | No | Bisected commit-id: |
Description
wangzhaolong1
2025-02-17 12:25:52 UTC
The problem process is as follows: ``` mount.cifs cifsd cifs_do_mount cifs_mount cifs_mount_get_session cifs_get_tcp_session get_net() /* First get net */ ip_connect /* Try port 445 */ generic_ip_connect get_net() ->connect() /* failed */ put_net() /* This call is balanced */ /* Try port 139 */ generic_ip_connect get_net() /* Missing matching put_net() for this get_net() */ cifs_get_smb_ses cifs_negotiate_protocol smb2_negotiate SMB2_negotiate cifs_send_recv wait_for_response cifs_demultiplex_thread cifs_read_from_socket cifs_readv_from_socket cifs_reconnect cifs_abort_connection sock_release(); server->ssocket = NULL; /* Missing put_net() here. */ generic_ip_connect get_net() ->connect() /* Failed */ put_net() sock_release(); server->ssocket = NULL; free_rsp_buf ... clean_demultiplex_info /* It's only called once here. */ put_net() ``` For my test case, the following kernel config is necessary: CONFIG_CIFS CONFIG_VETH CONFIG_NFT_COUNTER CONFIG_NF_REJECT_IPV4 CONFIG_NFT_COMPAT CONFIG_NF_TABLES CONFIG_NETFILTER_NETLINK |