public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Hao Ge <gehao@kylinos.cn>
Cc: michal.michalik@intel.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org, gehao618@163.com,
	arkadiusz.kubalewski@intel.com
Subject: Re: [PATCH] dpll: Fix potential msg memleak in dpll_nl_pin_id_get_doit
Date: Mon, 20 Nov 2023 16:43:50 +0000	[thread overview]
Message-ID: <0c6e0cd5-d975-41cc-824e-10b5e28251a2@linux.dev> (raw)
In-Reply-To: <20231120090758.31378-1-gehao@kylinos.cn>

On 20/11/2023 04:07, Hao Ge wrote:
> 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);

The change seems reasonable, but we have 4 spots of the same problem
in the file, could you please fix all of them in one patch?

pw-bot: cr

  reply	other threads:[~2023-11-20 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c6e0cd5-d975-41cc-824e-10b5e28251a2@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=gehao618@163.com \
    --cc=gehao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.michalik@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox