Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1045558AbdDWNd3 (ORCPT ); Sun, 23 Apr 2017 09:33:29 -0400 Received: from sesbmg22.ericsson.net ([193.180.251.48]:57513 "EHLO sesbmg22.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755642AbdDWNdS (ORCPT ); Sun, 23 Apr 2017 09:33:18 -0400 X-AuditID: c1b4fb30-abffb70000006667-15-58fcad1a6199 From: Jon Maloy To: Pan Bian , Ying Xue , "David S. Miller" CC: "netdev@vger.kernel.org" , "tipc-discussion@lists.sourceforge.net" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/1] tipc: check return value of nlmsg_new Thread-Topic: [PATCH 1/1] tipc: check return value of nlmsg_new Thread-Index: AQHSvACw8roJ2ioJzkObv8GPU8XZHKHS9AVQ Date: Sun, 23 Apr 2017 13:33:09 +0000 Message-ID: References: <1492931359-25004-1-git-send-email-bianpan2016@163.com> In-Reply-To: <1492931359-25004-1-git-send-email-bianpan2016@163.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: 163.com; dkim=none (message not signed) header.d=none;163.com; dmarc=none action=none header.from=ericsson.com; x-originating-ip: [24.225.233.31] x-microsoft-exchange-diagnostics: 1;DB5PR0701MB1958;7:rNO/qPcHttCFNZH+Xd2BIQPzVwKIfPUJD/M2G4SJzTLT9NxfWBaCxatjIpt45gl0PqHb6yfNYBZozsBETywhmMGmwmytU1iNbH/inSArpk9fzRwxDhEhJ2Ressigq16gtoCyTpgbBlBibtm5LrrAqz1wEY4dI/5UFmIxt9OrcSyTBoslRDrFHpqOOQenxfYVeB3mSiDuLEn9+vgF4M77XLMHDDoDdJ0iaFt+7vVW8NY6wIowazpLdhw2LQ/7/15JXXXYuUYc5PYvl4WA0xpcPFTTcZFl5KnPhcaTk6k54Qdk25oMqF+t9e1AgLMjEp0tF16L3c2lhTAMW2Ndu9tFRQ== x-ld-processed: 92e84ceb-fbfd-47ab-be52-080c6b87953f,ExtAddr x-ms-office365-filtering-correlation-id: 4e9cd8e1-b7b9-4ab3-a1e0-08d48a4d4830 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075);SRVR:DB5PR0701MB1958; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(143289334528602)(9452136761055)(42262312472803)(130843839470238); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406138)(20161123558085)(6072148);SRVR:DB5PR0701MB1958;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0701MB1958; x-forefront-prvs: 0286D7B531 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39450400003)(39850400002)(39840400002)(39400400002)(39410400002)(13464003)(377454003)(6506006)(2950100002)(5660300001)(4326008)(9686003)(345774005)(189998001)(3280700002)(3660700001)(86362001)(38730400002)(305945005)(53546009)(7736002)(25786009)(74316002)(6246003)(2906002)(6436002)(2900100001)(53936002)(33656002)(66066001)(50986999)(76176999)(54356999)(229853002)(54906002)(8936002)(8676002)(3846002)(6116002)(7696004)(102836003)(81166006)(55016002)(99286003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0701MB1958;H:DB5PR0701MB1958.eurprd07.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2017 13:33:09.1281 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0701MB1958 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHKsWRmVeSWpSXmKPExsUyM2K7ja7M2j8RBpMbNC3afz1hs5hzvoXF 4vKuOWwWxxaIWWw5n+XA6rF4xRRWjy0rbzJ57F7wmcnj8ya5AJYoLpuU1JzMstQifbsEroxr u14yFdzjqujZfYGtgfENRxcjJ4eEgInE22+9jF2MXBxCAusZJV5fv8gC4ZxglOh8+x7MYRHo ZZbYfPAeK0RmHpNEz/Hp7BDOc0aJa4f3sIMMYxPQkHg5rYMRxBYRKJA4O/cSM0gRs8BpRokd a/8xgSSEBewkbr96CjSXA6jIXuLU5giIeiOJxW8egfWyCKhKnL3wgxnE5hVIkDj+8iY7SLmQ gLNE23UzkDCngIvE5kv7wCYyCohJfD+1BsxmFhCXuPVkPhPEbwISS/acZ4awRSVePv4H9gCj QCejxI1vp6GKFCXOb1gEdqeEQB+zxKnuh1AdNhIzuqdD2b4SnTdusEEUTWSUePbhBDtEIl/i 3LepLBB2tcSetUuhir4xSZz48pcNIiEjcfzXbHaIRBOrxJ7DD9khQSElcfdKJ+MERq1ZSG6H sHUkFuz+xAZha0ssW/iaeRY4OAQlTs58wrKAkWUVo2hxanFSbrqRkV5qUWZycXF+nl5easkm RmCqObjlt8EOxpfPHQ8xCnAwKvHwKsz6HSHEmlhWXJl7iFGCg1lJhPfcgj8RQrwpiZVVqUX5 8UWlOanFhxilOViUxHkd912IEBJITyxJzU5NLUgtgskycXBKNTD2p58J5HQJ/vtn8lOu8MUb ZN8tti7xuqeXFZRp//PyXv7ngrbGLtvyP719ZjPDQyFbIHfK5fJfG/bv/zA/4XQP6w3jK2F/ pEJl3hy0v5J4d3lHFPOC+gPn9y/h06t7FeDodPaCuf4fz+OWfXEvf/LcVMssWJt0ePGSrMqT LuJH0mbw/nZ8l1alxFKckWioxVxUnAgAg+XWLDEDAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v3NDXarH004379 Content-Length: 1312 Lines: 41 Acknowledged. Thank you for doing this job. ///jon > -----Original Message----- > From: Pan Bian [mailto:bianpan2016@163.com] > Sent: Sunday, April 23, 2017 03:09 AM > To: Jon Maloy ; Ying Xue > ; David S. Miller > Cc: netdev@vger.kernel.org; tipc-discussion@lists.sourceforge.net; linux- > kernel@vger.kernel.org; Pan Bian > Subject: [PATCH 1/1] tipc: check return value of nlmsg_new > > Function nlmsg_new() will return a NULL pointer if there is no enough > memory, and its return value should be checked before it is used. > However, in function tipc_nl_node_get_monitor(), the validation of the > return value of function nlmsg_new() is missed. This patch fixes the bug. > > Signed-off-by: Pan Bian > --- > net/tipc/node.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/tipc/node.c b/net/tipc/node.c index 4512e83..568e48d 100644 > --- a/net/tipc/node.c > +++ b/net/tipc/node.c > @@ -2098,6 +2098,8 @@ int tipc_nl_node_get_monitor(struct sk_buff *skb, > struct genl_info *info) > int err; > > msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); > + if (!msg.skb) > + return -ENOMEM; > msg.portid = info->snd_portid; > msg.seq = info->snd_seq; > > -- > 1.9.1 >