[SRU][Q/P/N/J][PATCH 1/1] UBUNTU: SAUCE: fan: vxlan: check memory allocation for map
Kleber Sacilotto de Souza
kleber.souza at canonical.com
Thu Sep 18 12:37:54 UTC 2025
BugLink: https://bugs.launchpad.net/bugs/2125053
When a new fan vxlan map is requested, the return of kmalloc() is not
checked, so it can cause a NULL pointer dereference if memory allocation
fails.
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
drivers/net/vxlan/vxlan_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 74353e249d90..035bb030e5fa 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -152,6 +152,9 @@ static int vxlan_fan_add_map(struct vxlan_dev *vxlan, struct ifla_fan_map *map)
return -EEXIST;
fan_map = kmalloc(sizeof(*fan_map), GFP_KERNEL);
+ if (!fan_map)
+ return -ENOMEM;
+
fan_map->underlay = map->underlay;
fan_map->overlay = map->overlay;
fan_map->underlay_prefix = map->underlay_prefix;
--
2.43.0
More information about the kernel-team
mailing list