Jianglei Nie
5831ccf37a
net: macsec: fix potential resource leak in macsec_add_rxsa() and macsec_add_txsa()
...
[ Upstream commit c7b205fbbf ]
init_rx_sa() allocates relevant resource for rx_sa->stats and rx_sa->
key.tfm with alloc_percpu() and macsec_alloc_tfm(). When some error
occurs after init_rx_sa() is called in macsec_add_rxsa(), the function
released rx_sa with kfree() without releasing rx_sa->stats and rx_sa->
key.tfm, which will lead to a resource leak.
We should call macsec_rxsa_put() instead of kfree() to decrease the ref
count of rx_sa and release the relevant resource if the refcount is 0.
The same bug exists in macsec_add_txsa() for tx_sa as well. This patch
fixes the above two bugs.
Fixes: 3cf3227a21 ("net: macsec: hardware offloading infrastructure")
Signed-off-by: Jianglei Nie <niejianglei2021@163.com >
Signed-off-by: David S. Miller <davem@davemloft.net >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2022-08-03 12:03:50 +02:00
..
2022-07-29 17:25:32 +02:00
2022-07-21 21:24:32 +02:00
2022-01-27 11:04:09 +01:00
2022-06-22 14:21:56 +02:00
2022-03-23 09:16:41 +01:00
2022-03-08 19:12:47 +01:00
2022-07-23 12:54:02 +02:00
2022-07-12 16:35:11 +02:00
2022-07-12 16:35:08 +02:00
2022-07-29 17:25:06 +02:00
2022-06-29 09:03:31 +02:00
2022-07-12 16:34:58 +02:00
2022-07-07 17:53:32 +02:00
2022-06-22 14:22:03 +02:00
2022-07-21 21:24:34 +02:00
2022-06-09 10:22:33 +02:00
2022-07-29 17:25:28 +02:00
2022-07-12 16:34:58 +02:00
2022-04-08 14:23:31 +02:00
2022-07-07 17:53:27 +02:00
2022-07-12 16:35:19 +02:00
2022-07-12 16:34:51 +02:00
2022-06-09 10:22:47 +02:00
2022-06-14 18:36:22 +02:00
2022-05-12 12:30:05 +02:00
2022-07-21 21:24:35 +02:00
2022-07-07 17:53:32 +02:00
2022-07-29 17:25:23 +02:00
2022-08-03 12:03:43 +02:00
2022-04-08 14:22:50 +02:00
2022-06-09 10:22:56 +02:00
2022-01-27 11:04:31 +01:00
2022-06-22 14:22:00 +02:00
2022-07-07 17:53:35 +02:00
2022-06-14 18:36:06 +02:00
2022-07-29 17:25:17 +02:00
2022-03-08 19:12:37 +01:00
2022-07-23 12:54:04 +02:00
2022-07-12 16:35:01 +02:00
2022-07-29 17:25:10 +02:00
2022-07-12 16:34:51 +02:00
2022-06-09 10:23:31 +02:00
2022-07-12 16:35:09 +02:00
2022-07-21 21:24:40 +02:00
2022-03-16 14:23:36 +01:00
2022-01-27 11:04:21 +01:00
2022-06-09 10:23:12 +02:00
2022-06-09 10:23:12 +02:00
2022-07-07 17:53:24 +02:00
2022-07-12 16:34:57 +02:00
2022-07-12 16:34:52 +02:00
2021-11-18 19:16:32 +01:00
2022-06-09 10:23:12 +02:00
2022-07-12 16:35:17 +02:00
2022-06-29 09:03:19 +02:00
2021-11-18 19:16:08 +01:00
2022-07-29 17:25:15 +02:00
2022-08-03 12:03:50 +02:00
2022-07-21 21:24:35 +02:00
2022-03-08 19:12:44 +01:00
2022-07-07 17:53:24 +02:00
2022-07-29 17:25:12 +02:00
2022-03-02 11:48:06 +01:00
2022-06-09 10:22:50 +02:00
2022-06-09 10:23:13 +02:00
2022-04-13 20:59:14 +02:00
2022-07-29 17:25:07 +02:00
2022-06-14 18:36:02 +02:00
2022-04-27 14:39:00 +02:00
2022-06-14 18:36:06 +02:00
2022-07-29 17:25:20 +02:00
2022-07-21 21:24:34 +02:00
2022-07-29 17:25:10 +02:00
2022-04-08 14:23:44 +02:00
2022-04-13 20:59:01 +02:00
2022-06-14 18:36:04 +02:00
2022-06-09 10:23:00 +02:00
2022-06-14 18:36:03 +02:00
2022-04-27 14:38:55 +02:00
2022-06-14 18:36:05 +02:00
2022-06-14 18:36:07 +02:00
2022-07-29 17:25:32 +02:00
2022-08-03 12:03:47 +02:00
2021-11-25 09:48:31 +01:00
2022-05-18 10:26:55 +02:00
2022-07-21 21:24:40 +02:00
2022-06-14 18:36:21 +02:00
2022-07-29 17:25:24 +02:00
2022-06-22 14:21:59 +02:00
2022-06-09 10:22:47 +02:00
2022-03-02 11:47:51 +01:00
2022-06-09 10:23:26 +02:00
2022-06-14 18:36:20 +02:00
2022-07-29 17:25:32 +02:00
2022-07-29 17:25:27 +02:00
2022-07-21 21:24:33 +02:00
2022-04-20 09:34:13 +02:00
2022-06-14 18:36:24 +02:00
2022-07-21 21:24:35 +02:00
2022-04-08 14:23:50 +02:00
2022-07-21 21:24:33 +02:00
2022-04-13 20:59:11 +02:00
2022-06-14 18:36:22 +02:00
2022-07-21 21:24:23 +02:00
2021-12-22 09:32:39 +01:00