Andrey Zhadchenko
a87406f4ad
openvswitch: fix memory leak at failed datapath creation
...
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>
2022-08-26 19:26:30 -07:00
..
2022-06-09 21:53:28 +02:00
2022-08-08 20:04:35 -07:00
2022-07-14 15:27:35 -07:00
2022-04-06 13:45:26 +01:00
2022-04-28 13:08:15 -07:00
2022-08-05 19:00:02 -07:00
2022-07-30 13:52:47 -04:00
2022-08-25 16:26:19 -07:00
2022-08-09 18:46:11 -07:00
2022-02-25 09:36:06 +01:00
2022-08-23 18:23:15 +02:00
2022-07-22 12:51:45 +01:00
2022-08-09 09:05:06 +02:00
2022-08-03 14:05:39 +02:00
2022-08-26 12:19:09 +01:00
2022-03-03 08:01:55 -08:00
2022-08-01 12:11:56 -07:00
2022-07-29 20:12:49 -07:00
2022-08-23 07:54:16 -07:00
2022-04-07 21:04:03 -07:00
2022-07-25 19:38:31 -07:00
2022-06-10 14:51:35 +02:00
2022-04-28 13:08:15 -07:00
2022-08-26 12:19:09 +01:00
2022-08-24 19:18:10 -07:00
2022-06-10 16:21:27 -07:00
2021-12-29 08:48:14 -08:00
2022-08-24 12:51:50 +01:00
2022-07-08 12:14:36 +01:00
2022-04-15 14:27:24 -07:00
2022-06-09 21:52:55 -07:00
2022-08-25 10:05:25 +02:00
2022-04-30 20:29:47 +02:00
2022-05-25 12:22:58 -07:00
2022-04-07 21:06:41 -07:00
2022-08-24 13:46:58 +01:00
2022-06-23 20:51:06 -07:00
2022-08-24 19:18:10 -07:00
2022-08-10 09:24:41 +01:00
2022-08-18 10:20:48 -07:00
2022-04-06 13:45:26 +01:00
2022-05-28 15:28:47 +01:00
2022-08-26 19:26:30 -07:00
2022-07-29 12:09:27 +01:00
2022-04-12 15:00:25 +02:00
2022-08-15 11:21:42 +01:00
2022-08-12 10:46:01 +01:00
2022-03-18 13:09:17 +02:00
2022-08-22 14:24:54 +01:00
2022-08-25 12:39:40 -07:00
2022-08-24 13:46:57 +01:00
2022-07-28 18:21:16 -07:00
2022-07-27 13:24:42 +01:00
2022-07-08 18:38:44 -07:00
2022-08-22 11:40:01 -07:00
2022-06-09 21:52:55 -07:00
2022-07-28 18:21:16 -07:00
2022-08-17 10:24:00 +01:00
2022-07-09 12:24:16 -07:00
2022-08-10 09:50:18 +01:00
2022-08-25 10:04:46 +02:00
2022-08-08 20:48:51 -07:00
2022-08-15 17:26:07 +02:00
2022-08-24 13:46:57 +01:00
2022-07-24 18:41:03 -06:00
2022-03-03 09:55:28 +00:00
2022-06-02 10:15:05 -07:00
2022-08-24 13:46:58 +01:00