Andrey Zhadchenko
ca54b2bfaa
openvswitch: fix memory leak at failed datapath creation
...
[ Upstream commit a87406f4adee9c53b311d8a1ba2849c69e29a6d0 ]
ovs_dp_cmd_new()->ovs_dp_change()->ovs_dp_set_upcall_portids()
allocates array via kmalloc.
If for some reason new_vport() fails during ovs_dp_cmd_new()
dp->upcall_portids must be freed.
Add missing kfree.
Kmemleak example:
unreferenced object 0xffff88800c382500 (size 64):
comm "dump_state", pid 323, jiffies 4294955418 (age 104.347s)
hex dump (first 32 bytes):
5e c2 79 e4 1f 7a 38 c7 09 21 38 0c 80 88 ff ff ^.y..z8..!8.....
03 00 00 00 0a 00 00 00 14 00 00 00 28 00 00 00 ............(...
backtrace:
[<0000000071bebc9f>] ovs_dp_set_upcall_portids+0x38/0xa0
[<000000000187d8bd>] ovs_dp_change+0x63/0xe0
[<000000002397e446>] ovs_dp_cmd_new+0x1f0/0x380
[<00000000aa06f36e>] genl_family_rcv_msg_doit+0xea/0x150
[<000000008f583bc4>] genl_rcv_msg+0xdc/0x1e0
[<00000000fa10e377>] netlink_rcv_skb+0x50/0x100
[<000000004959cece>] genl_rcv+0x24/0x40
[<000000004699ac7f>] netlink_unicast+0x23e/0x360
[<00000000c153573e>] netlink_sendmsg+0x24e/0x4b0
[<000000006f4aa380>] sock_sendmsg+0x62/0x70
[<00000000d0068654>] ____sys_sendmsg+0x230/0x270
[<0000000012dacf7d>] ___sys_sendmsg+0x88/0xd0
[<0000000011776020>] __sys_sendmsg+0x59/0xa0
[<000000002e8f2dc1>] do_syscall_64+0x3b/0x90
[<000000003243e7cb>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes: b83d23a2a38b ("openvswitch: Introduce per-cpu upcall dispatch")
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
Link: https://lore.kernel.org/r/20220825020326.664073-1-andrey.zhadchenko@virtuozzo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-09-08 12:28:02 +02:00
..
2021-07-22 16:19:03 +02:00
2022-08-17 14:24:23 +02:00
2021-08-13 16:30:35 -07:00
2022-08-31 17:16:37 +02:00
2021-07-23 14:20:25 +01:00
2022-06-22 14:22:01 +02:00
2022-07-29 17:25:07 +02:00
2022-09-05 10:30:06 +02:00
2022-09-05 10:30:07 +02:00
2021-06-25 13:13:50 +02:00
2022-08-31 17:16:40 +02:00
2021-09-14 12:51:15 +01:00
2022-08-25 11:40:46 +02:00
2022-05-25 09:57:28 +02:00
2022-09-08 12:28:01 +02:00
2022-03-08 19:12:52 +01:00
2022-08-17 14:23:37 +02:00
2022-08-03 12:03:51 +02:00
2022-08-31 17:16:37 +02:00
2021-08-03 13:05:26 +01:00
2022-06-29 09:03:23 +02:00
2022-08-31 17:16:37 +02:00
2022-02-08 18:34:09 +01:00
2022-08-31 17:16:44 +02:00
2022-08-31 17:16:44 +02:00
2021-08-09 10:13:32 +01:00
2021-06-29 11:28:21 -07:00
2022-08-31 17:16:36 +02:00
2022-06-22 14:21:58 +02:00
2022-04-27 14:38:53 +02:00
2022-03-28 09:58:46 +02:00
2022-08-17 14:24:29 +02:00
2021-09-07 14:06:08 +01:00
2022-04-13 20:59:16 +02:00
2021-12-08 09:04:47 +01:00
2022-08-31 17:16:50 +02:00
2022-01-05 12:42:37 +01:00
2022-09-05 10:30:11 +02:00
2022-04-13 20:59:10 +02:00
2022-08-25 11:40:25 +02:00
2022-01-27 11:04:00 +01:00
2022-06-09 10:22:46 +02:00
2022-09-08 12:28:02 +02:00
2022-09-05 10:30:12 +02:00
2022-01-11 15:35:16 +01:00
2022-08-25 11:40:29 +02:00
2022-08-25 11:39:54 +02:00
2022-04-08 14:23:00 +02:00
2022-08-31 17:16:38 +02:00
2022-08-31 17:16:45 +02:00
2022-08-31 17:16:42 +02:00
2022-08-03 12:03:54 +02:00
2022-07-29 17:25:17 +02:00
2021-11-18 19:17:11 +01:00
2022-08-31 17:16:37 +02:00
2021-08-04 12:35:07 +01:00
2022-08-03 12:03:51 +02:00
2022-08-03 12:03:47 +02:00
2022-06-14 18:36:17 +02:00
2022-08-25 11:40:11 +02:00
2022-09-08 12:28:02 +02:00
2022-04-08 14:23:53 +02:00
2022-07-12 16:35:15 +02:00
2022-08-31 17:16:42 +02:00
2021-07-29 15:06:49 +01:00
2021-07-29 15:06:49 +01:00
2022-08-31 17:16:45 +02:00