Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp4589670pja; Thu, 21 Nov 2019 22:25:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzPE8JBLhYvGWdjzO8dVCfg7j+h5AE/dXe/AQEK3I6m//8TWDxA9wtMPefU7DLmmIP/1CPi X-Received: by 2002:a17:906:3710:: with SMTP id d16mr20191415ejc.132.1574403903054; Thu, 21 Nov 2019 22:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574403903; cv=none; d=google.com; s=arc-20160816; b=Zn/iIApSe0BhM3VIv6wYnaqVGKFpUhdtSyIAErRS2rwoZ3mfbv+S8e/hWGF5finlE8 ttd26ApbnUnLzVK5yn3pjZec+2jgVeXK+BNsm2OWKN4CuYO4fg9VanDV48XudsgBTMFv 6wNIpUqPw81L1J4NYb29sv4R+pcAH9bfBqSJVADVbv1eVd8nkfCkYTTwQo2/1imDbqR/ +V/AAvRFW1iDjAFtyD+gI6ResqEXX8MCFBFt2HO9vjbQ2fhGuSNPAZ7ZkmCmkFxWpcFO DBWz8/B8rEvSVQ7pw3SwBwOIg2sFosVFpWN4i8ltYoDzHDimWWUQ033Y9ipt/TP33bJn UUQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l47umnwMV0J7ocOK1W9fN+jd4+bh1CF93tL9rT1WH40=; b=WDKBZEx53TsVKN/0ROVpxnVIbsRV8phWJ21zxZgeeDllEZ+2MnA7hv9kZzAIH9yz1S vdZvloNNUkyr+ZgmcNe7bNNYecEM+LIUkqqdawFoiL+PZdkaIAmb/jRuwwLDPM82sjyv SQ3WbL0EYSgcUxqAqjJvra7af32xYHSsVsllE+5ZF7RZDO0IPtMsp3pbyBlXN7eRGM+Z BRrOTiaRa4R7G1rpHH+21XSx1wMvaUV+/jVP7C36sOmPI7mrt0h1pp13ylHzP+yW6+X2 wh6WOKmuy6IhVDNbuCBLjEk+Z0DxOENuMc3nbaRgoyhpsp1fCgwDj5cb+L/8kzytL7pQ swxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o0GwlbDW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gs26si3542301ejb.309.2019.11.21.22.24.39; Thu, 21 Nov 2019 22:25:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=o0GwlbDW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728365AbfKVGWZ (ORCPT + 99 others); Fri, 22 Nov 2019 01:22:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:57336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbfKVFv7 (ORCPT ); Fri, 22 Nov 2019 00:51:59 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 86A8820726; Fri, 22 Nov 2019 05:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574401919; bh=pkcgl8GLrGanjEtXFJT5zlPNjUrk/9i/0wS56xwsYuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0GwlbDWFA0i6ykjPYkGxPjt4CSh6SRn0vtIzhMou14jMP+sceUrogP9ttqpuLIPc Y1qrw/FjssGJx/OqUL1O6ih+ViIS6f6u3AlyrjR+bn9wBteCvuMwsQMhdsj9+xUzSL hkzJ6tlY6AHMSh3LTvYMND+29yTYs9vUfPLs0PA8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net Subject: [PATCH AUTOSEL 4.19 149/219] tipc: fix a missing check of genlmsg_put Date: Fri, 22 Nov 2019 00:48:01 -0500 Message-Id: <20191122054911.1750-142-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122054911.1750-1-sashal@kernel.org> References: <20191122054911.1750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kangjie Lu [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 6494d6b5e1b24..fab0384d2b4b3 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -983,6 +983,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