netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Kangjie Lu <kjlu@umn.edu>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net
Subject: [PATCH AUTOSEL 4.4 50/68] tipc: fix a missing check of genlmsg_put
Date: Fri, 22 Nov 2019 01:12:43 -0500	[thread overview]
Message-ID: <20191122061301.4947-49-sashal@kernel.org> (raw)
In-Reply-To: <20191122061301.4947-1-sashal@kernel.org>

From: Kangjie Lu <kjlu@umn.edu>

[ Upstream commit 46273cf7e009231d2b6bc10a926e82b8928a9fb2 ]

genlmsg_put could fail. The fix inserts a check of its return value, and
if it fails, returns -EMSGSIZE.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/tipc/netlink_compat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index d2bf92e711505..4f6fbd2f29add 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -926,6 +926,8 @@ 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)
+		return -EMSGSIZE;
 
 	nest = nla_nest_start(args, TIPC_NLA_SOCK);
 	if (!nest) {
-- 
2.20.1


  parent reply	other threads:[~2019-11-22  6:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191122061301.4947-1-sashal@kernel.org>
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 11/68] mwifiex: fix potential NULL dereference and use after free Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 12/68] mwifiex: debugfs: correct histogram spacing, formatting Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 13/68] rtl818x: fix potential use after free Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 20/68] VSOCK: bind to random port for VMADDR_PORT_ANY Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 38/68] ath6kl: Only use match sets when firmware supports it Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 39/68] ath6kl: Fix off by one error in scan completion Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 46/68] net/net_namespace: Check the return value of register_pernet_subsys() Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 48/68] net: stmicro: fix a missing check of clk_prepare Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 49/68] atl1e: checking the status of atl1e_write_phy_reg Sasha Levin
2019-11-22  6:12 ` Sasha Levin [this message]
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 55/68] tipc: fix memory leak in tipc_nl_compat_publ_dump Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 56/68] net/core/neighbour: tell kmemleak about hash tables Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 57/68] net/core/neighbour: fix kmemleak minimal reference count for " Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 58/68] sfc: suppress duplicate nvmem partition types in efx_ef10_mtd_probe Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 59/68] decnet: fix DN_IFREQ_SIZE Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 60/68] tipc: fix skb may be leaky in tipc_link_input Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 61/68] sfc: initialise found bitmap in efx_ef10_mtd_probe Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 62/68] net: fix possible overflow in __sk_mem_raise_allocated() Sasha Levin
2019-11-22  6:12 ` [PATCH AUTOSEL 4.4 63/68] net: dev: Use unsigned integer as an argument to left-shift Sasha Levin

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=20191122061301.4947-49-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).