Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2248214ybd; Mon, 24 Jun 2019 03:16:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjdhJzprtZdo5rx6o7FyRxeaq/wckJRv05wKfmhdtSqDHQhuz5wHgoZG7xqSCICQ/SvWP9 X-Received: by 2002:a63:6c4a:: with SMTP id h71mr31647216pgc.331.1561371364862; Mon, 24 Jun 2019 03:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371364; cv=none; d=google.com; s=arc-20160816; b=rk8owEOkJ9ukkBTPVd7P0wMIOEZpIcgAj5q6CkohrvIj2ZsIBIXjdDXOgjVtI68fpw t/tZrHJ9LXt8V/kUC9aJyxb2q++HS1Wn6zKE95FPfSjhOdyLgiRW4KrfRIjbLyEVVYV0 cokZ2Hq5/xyhNYPW7tr5TT/7xBgPZG9xuRWDmEIod/tWUS6zy/IGExJDRvdgpkq03ao4 T9wZ76uL30mDhWszL0a2TD/lr/73QxJEhlWUO0W6dKaqk12ygAZIwCHqdxAaXTDPWXqQ 21y9GRNayj3iE3PoWt/uogSDBS0Dd9BYUy8sEFj0lfQLKbhoM6oaVEjJhQ0PKEnsCVY6 iceg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jtIh4uWso4R8uIJtqJdlYVwlr9KFjaF7mA1vdlADAH8=; b=Syoq3iZqhaRy+DTkiro25zAOmEHdl1JGbFufiGqzWd1qfBWL93NFcKsHujgSN7iQ8J nORQ193W5fARjT5IxJP2RRughue+/NJUhT9oTMh+C+RiB74I5UH6OJsjKS36saCiniEk 2hik7I6DXcnZRTCVJWAnZuO7jCQnqkmOlAp6Oedh9nHPKpiM1h1n2QIpN3hxDdfCVzK1 uFKVnHdH7vcfpZq4G/AthzPo8ikJzGOHjIo2QC4rCYQ/Mj/xcuyWIzJO9ewNttIDby5Q wNrg2DDykANWpbApemIvJNoTkdolVkAMNlnEMQFywUC5hjMiY/WGqplYPsmTaJ3jlJG8 vWYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=esuQWnoS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si9852205pfc.245.2019.06.24.03.15.48; Mon, 24 Jun 2019 03:16:04 -0700 (PDT) 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=esuQWnoS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729924AbfFXKPn (ORCPT + 99 others); Mon, 24 Jun 2019 06:15:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:52144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730379AbfFXKOo (ORCPT ); Mon, 24 Jun 2019 06:14:44 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8CEC9205C9; Mon, 24 Jun 2019 10:14:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371284; bh=B8haucdH0Bac5XxjC19HYszcAgma7sNI2LLJyXDiMss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=esuQWnoSLb11kZY7VkZljHEGPv5sVZd5YZKAnYE7jXmbtTKBh98fj3QZaqJ7lduG1 DMVvkIQLRIzH0p0tL0NaAoTsDupfHvIUrxAFKMfDFJ1oo6NtTbkvM5J7crntMjl2yZ R6cZ/PIB3hkoU8j9sE1PyWmIczwLmSdxc7akCTek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gen Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 065/121] mdesc: fix a missing-check bug in get_vdev_port_node_info() Date: Mon, 24 Jun 2019 17:56:37 +0800 Message-Id: <20190624092324.129228105@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 80caf43549e7e41a695c6d1e11066286538b336f ] In get_vdev_port_node_info(), 'node_info->vdev_port.name' is allcoated by kstrdup_const(), and it returns NULL when fails. So 'node_info->vdev_port.name' should be checked. Signed-off-by: Gen Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- arch/sparc/kernel/mdesc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 9a26b442f820..8e645ddac58e 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c @@ -356,6 +356,8 @@ static int get_vdev_port_node_info(struct mdesc_handle *md, u64 node, node_info->vdev_port.id = *idp; node_info->vdev_port.name = kstrdup_const(name, GFP_KERNEL); + if (!node_info->vdev_port.name) + return -1; node_info->vdev_port.parent_cfg_hdl = *parent_cfg_hdlp; return 0; -- 2.20.1