rocker: fix memory leak in rocker_world_port_post_fini()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e420114eef4a3a5025a243b89b0dc343101e3d3c · < dce375f4afc348c310d171abcde7ec1499a4c26a| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
rocker: fix memory leak in rocker_world_port_post_fini()
In rocker_world_port_pre_init(), rocker_port->wpriv is allocated with kzalloc(wops->port_priv_size, GFP_KERNEL). However, in rocker_world_port_post_fini(), the memory is only freed when wops->port_post_fini callback is set:
if (!wops->port_post_fini) return; wops->port_post_fini(rocker_port); kfree(rocker_port->wpriv);
Since rocker_ofdpa_ops does not implement port_post_fini callback (it is NULL), the wpriv memory allocated for each port is never freed when ports are removed. This leads to a memory leak of sizeof(struct ofdpa_port) bytes per port on every device removal.
Fix this by always calling kfree(rocker_port->wpriv) regardless of whether the port_post_fini callback exists.
From the CVE record · Linux
The Linux kernel's rocker driver fails to free per-port memory when a device is removed if the port_post_fini callback is absent. Repeated device removals leak memory; the input does not specify how an attacker could trigger removals or whether authentication or user interaction is required.
Operators running Linux kernels with the rocker driver should check their kernel version; affected versions are not specified.