From: Ying Xue <ying.xue@windriver.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Kangjie Lu <kjlu@umn.edu>, Jon Maloy <jon.maloy@ericsson.com>,
"David S. Miller" <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <tipc-discussion@lists.sourceforge.net>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tipc: fix memory leak in tipc_nl_compat_publ_dump
Date: Sun, 6 Jan 2019 13:41:22 +0800 [thread overview]
Message-ID: <6fb4bb46-5f2e-ae8d-df16-500d7a39c118@windriver.com> (raw)
In-Reply-To: <20190105165223.GA3296@embeddedor>
On 1/6/19 12:52 AM, Gustavo A. R. Silva wrote:
> There is a memory leak in case genlmsg_put fails.
>
> Fix this by freeing *args* before return.
>
> Addresses-Coverity-ID: 1476406 ("Resource leak")
> Fixes: 46273cf7e009 ("tipc: fix a missing check of genlmsg_put")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/netlink_compat.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
> index 40f5cae623a7..77e4b2418f30 100644
> --- a/net/tipc/netlink_compat.c
> +++ b/net/tipc/netlink_compat.c
> @@ -904,8 +904,10 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock)
>
> hdr = genlmsg_put(args, 0, 0, &tipc_genl_family, NLM_F_MULTI,
> TIPC_NL_PUBL_GET);
> - if (!hdr)
> + if (!hdr) {
> + kfree_skb(args);
> return -EMSGSIZE;
> + }
>
> nest = nla_nest_start(args, TIPC_NLA_SOCK);
> if (!nest) {
>
WARNING: multiple messages have this Message-ID (diff)
From: Ying Xue <ying.xue@windriver.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Kangjie Lu <kjlu@umn.edu>, Jon Maloy <jon.maloy@ericsson.com>,
"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tipc: fix memory leak in tipc_nl_compat_publ_dump
Date: Sun, 6 Jan 2019 13:41:22 +0800 [thread overview]
Message-ID: <6fb4bb46-5f2e-ae8d-df16-500d7a39c118@windriver.com> (raw)
In-Reply-To: <20190105165223.GA3296@embeddedor>
On 1/6/19 12:52 AM, Gustavo A. R. Silva wrote:
> There is a memory leak in case genlmsg_put fails.
>
> Fix this by freeing *args* before return.
>
> Addresses-Coverity-ID: 1476406 ("Resource leak")
> Fixes: 46273cf7e009 ("tipc: fix a missing check of genlmsg_put")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/netlink_compat.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
> index 40f5cae623a7..77e4b2418f30 100644
> --- a/net/tipc/netlink_compat.c
> +++ b/net/tipc/netlink_compat.c
> @@ -904,8 +904,10 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock)
>
> hdr = genlmsg_put(args, 0, 0, &tipc_genl_family, NLM_F_MULTI,
> TIPC_NL_PUBL_GET);
> - if (!hdr)
> + if (!hdr) {
> + kfree_skb(args);
> return -EMSGSIZE;
> + }
>
> nest = nla_nest_start(args, TIPC_NLA_SOCK);
> if (!nest) {
>
next prev parent reply other threads:[~2019-01-06 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-05 16:52 [PATCH] tipc: fix memory leak in tipc_nl_compat_publ_dump Gustavo A. R. Silva
2019-01-06 5:41 ` Ying Xue [this message]
2019-01-06 5:41 ` Ying Xue
2019-01-07 16:45 ` David Miller
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=6fb4bb46-5f2e-ae8d-df16-500d7a39c118@windriver.com \
--to=ying.xue@windriver.com \
--cc=davem@davemloft.net \
--cc=gustavo@embeddedor.com \
--cc=jon.maloy@ericsson.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.