public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dpll: Fix potential msg  memleak in dpll_nl_pin_id_get_doit
@ 2023-11-20  9:07 Hao Ge
  2023-11-20 16:43 ` Vadim Fedorenko
  0 siblings, 1 reply; 5+ messages in thread
From: Hao Ge @ 2023-11-20  9:07 UTC (permalink / raw)
  To: vadim.fedorenko, arkadiusz.kubalewski
  Cc: michal.michalik, davem, linux-kernel, gehao618, Hao Ge

We should clean the skb resource if genlmsg_put_reply failed.

Fixes: 9d71b54b65b1 ("dpll: netlink: Add DPLL framework base functions")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
---
 drivers/dpll/dpll_netlink.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c
index a6dc3997bf5c..54051cd34d43 100644
--- a/drivers/dpll/dpll_netlink.c
+++ b/drivers/dpll/dpll_netlink.c
@@ -1093,9 +1093,10 @@ int dpll_nl_pin_id_get_doit(struct sk_buff *skb, struct genl_info *info)
 		return -ENOMEM;
 	hdr = genlmsg_put_reply(msg, info, &dpll_nl_family, 0,
 				DPLL_CMD_PIN_ID_GET);
-	if (!hdr)
+	if (!hdr) {
+		nlmsg_free(msg);
 		return -EMSGSIZE;
-
+	}
 	pin = dpll_pin_find_from_nlattr(info);
 	if (!IS_ERR(pin)) {
 		ret = dpll_msg_add_pin_handle(msg, pin);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-22  1:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20  9:07 [PATCH] dpll: Fix potential msg memleak in dpll_nl_pin_id_get_doit Hao Ge
2023-11-20 16:43 ` Vadim Fedorenko
2023-11-21  1:37   ` [PATCH v2] dpll: Fix potential msg memleak when genlmsg_put_reply failed Hao Ge
2023-11-21 11:20     ` Vadim Fedorenko
2023-11-22  1:50     ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox