{"id":"CVE-2025-40350","aliases":["CVE-2025-40350"],"related":[],"kind":"vulnerability","state":"published","title":"net/mlx5e: RX, Fix generating skb from non-linear xdp_buff for striding RQ","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/mlx5e: RX, Fix generating skb from non-linear xdp_buff for striding RQ\n\nXDP programs can change the layout of an xdp_buff through\nbpf_xdp_adjust_tail() and bpf_xdp_adjust_head(). Therefore, the driver\ncannot assume the size of the linear data area nor fragments. Fix the\nbug in mlx5 by generating skb according to xdp_buff after XDP programs\nrun.\n\nCurrently, when handling multi-buf XDP, the mlx5 driver assumes the\nlayout of an xdp_buff to be unchanged. That is, the linear data area\ncontinues to be empty and fragments remain the same. This may cause\nthe driver to generate erroneous skb or triggering a kernel\nwarning. When an XDP program added linear data through\nbpf_xdp_adjust_head(), the linear data will be ignored as\nmlx5e_build_linear_skb() builds an skb without linear data and then\npull data from fragments to fill the linear data area. When an XDP\nprogram has shrunk the non-linear data through bpf_xdp_adjust_tail(),\nthe delta passed to __pskb_pull_tail() may exceed the actual nonlinear\ndata size and trigger the BUG_ON in it.\n\nTo fix the issue, first record the original number of fragments. If the\nnumber of fragments changes after the XDP program runs, rewind the end\nfragment pointer by the difference and recalculate the truesize. Then,\nbuild the skb with the linear data area matching the xdp_buff. Finally,\nonly pull data in if there is non-linear data and fill the linear part\nup to 256 bytes.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/mlx5e: RX, Fix generating skb from non-linear xdp_buff for striding RQ\n\nXDP programs can change the layout of an xdp_buff through\nbpf_xdp_adjust_tail() and bpf_xdp_adjust_head(). Therefore, the driver\ncannot assume the size of the linear data area nor fragments. Fix the\nbug in mlx5 by generating skb according to xdp_buff after XDP programs\nrun.\n\nCurrently, when handling multi-buf XDP, the mlx5 driver assumes the\nlayout of an xdp_buff to be unchanged. That is, the linear data area\ncontinues to be empty and fragments remain the same. This may cause\nthe driver to generate erroneous skb or triggering a kernel\nwarning. When an XDP program added linear data through\nbpf_xdp_adjust_head(), the linear data will be ignored as\nmlx5e_build_linear_skb() builds an skb without linear data and then\npull data from fragments to fill the linear data area. When an XDP\nprogram has shrunk the non-linear data through bpf_xdp_adjust_tail(),\nthe delta passed to __pskb_pull_tail() may exceed the actual nonlinear\ndata size and trigger the BUG_ON in it.\n\nTo fix the issue, first record the original number of fragments. If the\nnumber of fragments changes after the XDP program runs, rewind the end\nfragment pointer by the difference and recalculate the truesize. Then,\nbuild the skb with the linear data area matching the xdp_buff. Finally,\nonly pull data in if there is non-linear data and fill the linear part\nup to 256 bytes.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nnet/mlx5e: RX, Corrección al generar skb a partir de xdp_buff no lineal para RQ con salto\n\nLos programas XDP pueden cambiar la disposición de un xdp_buff mediante bpf_xdp_adjust_tail() y bpf_xdp_adjust_head(). Por lo tanto, el controlador no puede asumir el tamaño del área de datos lineal ni de los fragmentos. Se corrige el error en mlx5 generando skb de acuerdo con el xdp_buff después de que se ejecuten los programas XDP.\n\nActualmente, al manejar XDP multi-buffer, el controlador mlx5 asume que la disposición de un xdp_buff no ha cambiado. Es decir, el área de datos lineal sigue estando vacía y los fragmentos permanecen igual. Esto puede hacer que el controlador genere skb erróneos o que se active una advertencia del kernel. Cuando un programa XDP añadió datos lineales mediante bpf_xdp_adjust_head(), los datos lineales serán ignorados ya que mlx5e_build_linear_skb() construye un skb sin datos lineales y luego extrae datos de los fragmentos para llenar el área de datos lineal. Cuando un programa XDP ha reducido los datos no lineales mediante bpf_xdp_adjust_tail(), el delta pasado a __pskb_pull_tail() puede exceder el tamaño real de los datos no lineales y activar el BUG_ON en él.\n\nPara solucionar el problema, primero se registra el número original de fragmentos. Si el número de fragmentos cambia después de que se ejecute el programa XDP, se retrocede el puntero del fragmento final por la diferencia y se recalcula el truesize. Luego, se construye el skb con el área de datos lineal que coincida con el xdp_buff. Finalmente, solo se extraen datos si hay datos no lineales y se rellena la parte lineal hasta 256 bytes.","source":"nvd"}],"published":"2025-12-16T13:30:23.896Z","modified":"2026-10-14T13:10:00.187Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"f52ac7028bec22e925c8fece4f21641eb13b4d6f","fixed":"8b051d7f530e8a5237da242fbeafef02fec6b813","status":"affected"},{"type":"git","introduced":"f52ac7028bec22e925c8fece4f21641eb13b4d6f","fixed":"cb9edd583e23979ee546981be963ad5f217e8b18","status":"affected"},{"type":"git","introduced":"f52ac7028bec22e925c8fece4f21641eb13b4d6f","fixed":"f2557d7fa38e9475b38588f5c124476091480f53","status":"affected"},{"type":"git","introduced":"f52ac7028bec22e925c8fece4f21641eb13b4d6f","fixed":"87bcef158ac1faca1bd7e0104588e8e2956d10be","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.4","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.4","status":"unaffected"},{"type":"semver","introduced":"6.6.115","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.56","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.6","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/8b051d7f530e8a5237da242fbeafef02fec6b813","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/cb9edd583e23979ee546981be963ad5f217e8b18","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f2557d7fa38e9475b38588f5c124476091480f53","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/87bcef158ac1faca1bd7e0104588e8e2956d10be","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40350","url":"https://www.cve.org/CVERecord?id=CVE-2025-40350","licence":"CVE Terms of Use","modified":"2026-08-05T12:09:50.275Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40350","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40350","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"}],"updatedAt":"2026-11-25T22:59:09.469Z","epss":{"score":0.00587,"percentile":0.49432,"date":"2026-12-01T12:00:22.000Z"}}