Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629261

Re: [PATCH 2/2] net: team: fix memory leak in team_nl_send_options_get

Path csiph.com!goblin1!goblin.stu.neva.ru!news.panservice.it!bofh.it!news.nic.it!robomod
From Jiri Pirko <jiri@resnulli.us>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] net: team: fix memory leak in team_nl_send_options_get
Date Mon, 24 Apr 2017 09:20:02 +0200
Message-ID <tzGrU-3YY-13@gated-at.bofh.it> (permalink)
References <tzGid-3VL-1@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vpaDlrMO2J/NiMzl8KcNzJCJ13FtiJmIQUh7GalrLbs=; b=LifoXT0AcQAur4grN6bKkS3/enJT/cTopZujVsOf5Ahhcl6UIFyxTujNSHxIWidvV3 c3sgDhM2zxryfLQeH6cK0fp/6suLm12uKclUF6cif8yEdF1UPe/X90rLCSysCMcGrvmw SAkibuweYmkSgK60siplcZc4AK5+Z+/4Y/QLb7EEfDeYqTasJfcrDGiTKb96Vl6eOETf ZK3gTD7rY0rk9hSxLUQbR8twXkUsEgWqHZYJkdEd9B6rKFKLwsq/lnnPjHo+zygFPx9Q jr3w6zlSSNu+zFsXeRNm/o/Yl/KHOr0em8Q02gQI0LcZsykQF/WtkDQy0xd4uoQ0UU6I psMA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vpaDlrMO2J/NiMzl8KcNzJCJ13FtiJmIQUh7GalrLbs=; b=heKA1WjdqOLk3wkI0r/yK5ffo945iFW+YxAM2JEES7KUgGujQHjfoCbHS3yDRmkCFZ pi3eNmbEF3Cy7h99Mrit7uYhcIe9mG6WcwkOR9GafymQ0rGpx8b6kayLkR5OTbqLLJBo 2lOkpoiI0AYh+gBWRCHYn9mD9s0q+XRX/5YHPIg1Qyt8xW3XDSoxNhxPG2+9oE9weZX8 5RBg/WAZ981o373uTwhTe5LNvB637fZn4/bQePPznpC4o0CGYwfzkwvPPdF7boS/gg0p IeM4OrleJ58pe3fOv10AyLBQesJoLA0/qHjgglZ75Lh0hNOw374VOpFoho9AwNsQCagp K86g==
X-Gm-Message-State AN3rC/49SZjZvmjOPWmHadudABNJOpsxiYIi+JTnrOci26oe6Ilx+s+I /LXlZPgmZktzZw==
X-Received by 10.28.168.130 with SMTP id r124mr8696114wme.134.1493017896348; Mon, 24 Apr 2017 00:11:36 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.7.1 (2016-10-04)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 50
Organization linux.* mail to news gateway
X-Original-Cc netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Mon, 24 Apr 2017 09:11:29 +0200
X-Original-Message-ID <20170424071129.GE1886@nanopsycho.orion>
X-Original-References <1493017495-3578-1-git-send-email-bianpan2016@163.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1629261

Show key headers only | View raw


Mon, Apr 24, 2017 at 09:04:55AM CEST, bianpan2016@163.com wrote:
>In function team_nl_send_options_get(), pointer skb keeps the return
>value of function nlmsg_new(). When the call to genlmsg_put() fails, the
>control flow directly returns and does not free skb. This will result in
>a memory leak bug. This patch fixes it.
>
>Fixes: 8ea7fd0d8792 ("team: fix memory leak")

test1:~/net-next$ git log 8ea7fd0d8792
fatal: ambiguous argument '8ea7fd0d8792': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'


Please look up the commit that introduces the issue. Also no newline
in between "fixes" and "signed off".

Also. The subject should be:
[PATCH net 2/2] team: fix memory leak in team_nl_send_options_get

You can see this right away if you look in the mailing list archive...



>
>Signed-off-by: Pan Bian <bianpan2016@163.com>
>---
> drivers/net/team/team.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index dd3a2e9..85c0124 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -2361,8 +2361,10 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
> 
> 	hdr = genlmsg_put(skb, portid, seq, &team_nl_family, flags | NLM_F_MULTI,
> 			  TEAM_CMD_OPTIONS_GET);
>-	if (!hdr)
>+	if (!hdr) {
>+		nlmsg_free(skb);
> 		return -EMSGSIZE;
>+	}
> 
> 	if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
> 		goto nla_put_failure;
>-- 
>1.9.1
>
>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] net: team: fix memory leak in team_nl_send_options_get Pan Bian <bianpan2016@163.com> - 2017-04-24 09:10 +0200
  Re: [PATCH 2/2] net: team: fix memory leak in  team_nl_send_options_get Jiri Pirko <jiri@resnulli.us> - 2017-04-24 09:20 +0200

csiph-web