smb: client: Fix use-after-free of network namespace.
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
smb: client: Fix use-after-free of network namespace.
Recently, we got a customer report that CIFS triggers oops while reconnecting to a server. [0]
The workload runs on Kubernetes, and some pods mount CIFS servers in non-root network namespaces. The problem rarely happened, but it was always while the pod was dying.
The root cause is wrong reference counting for network namespace.
CIFS uses kernel sockets, which do not hold refcnt of the netns that the socket belongs to. That means CIFS must ensure the socket is always freed before its netns; otherwise, use-after-free happens.
The repro steps are roughly:
1. mount CIFS in a non-root netns 2. drop packets from the netns 3. destroy the netns 4. unmount CIFS
From the CVE record · Linux
The Linux kernel SMB client has a network-namespace use-after-free caused by incorrect reference counting. A kernel oops can occur when a CIFS mount in a non-root network namespace reconnects while that namespace is being destroyed. The reported case involved Kubernetes pods during shutdown; the input does not establish an authentication requirement or user-interaction requirement.
Engineers running Linux kernels with CIFS mounts in non-root network namespaces should check whether their kernel includes the fix; affected versions are not specified.