Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2880366yba; Mon, 22 Apr 2019 14:54:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDeV7aFpzAc83NT7X0lyWmsOAd/xbFKInnHZeIw+Jyi4qX7teEZZtToXEAI5qmVvZGFjgy X-Received: by 2002:a65:6150:: with SMTP id o16mr21236785pgv.285.1555970050120; Mon, 22 Apr 2019 14:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555970050; cv=none; d=google.com; s=arc-20160816; b=F/6A8OLpm64E9JeLGGx4Y5PQN1LlqhaudNSbxVFhNZmCTZLMdRs4NKDpWvvgEyNNf7 uRACXOEFLktw5Qxl9bVrnoQbQckN21loZh6cAYg2TZcIBndsKDcHMkjQhe3/UudBOgg0 mYZyxplzPJLxxv8UFlCgyKSbsHBLqiM8qjo6azzRTPiMxnNCD+ItUAHfzMHJMxgRAbNi 2imbAcvNa5leLaCBew0dtnioUMSAlsY0Nk192lVSWzQEYp390S1Ny3XrB0q12cSng7wj Lv68dgjeaHdDo7jAdISUg78hieliLFQCfXOqOiIm8E7ZiBcT7lg+nAO0UD9L82f6yA3Q nObQ== 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=xYALFNf93qtcicrUrGmmPRDBMJbITgo9Jk4034LsV30=; b=v0MguVVoRNnvrU36qZ3UyH/I6VoN/Zm4RCqIbPR/UdF3ApYZ2xzbj6v6fFCnW21LUx IdzYdVoCG99C//LUsJKtVnYktC+Zw7TRQ4mJwJIwmwEyw064a7DWOwfEJbjSr48eRTuz BEzjTXT2U1krUcU+89HvD/6kBgloSgOeE5FIcxB3XQqbrIWYaXh2iaW/fqrwpwkbFqAs LrvvkdPnHAZrwJ6XRKUGDGgAKJ7tomFyeGS76F83BBXczYTlW21G+YNeBiMS64+8M7Zn mzb6TJoRNx6S6k44YEX32Eqhj09trlZEO/d17t088V5MGOR/rSmtCheF4r7OXr/Oa37i vefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jq0GmIKu; 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 r3si13234890pgp.45.2019.04.22.14.53.52; Mon, 22 Apr 2019 14:54:10 -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=Jq0GmIKu; 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 S1728679AbfDVTmP (ORCPT + 99 others); Mon, 22 Apr 2019 15:42:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:42562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728292AbfDVTmN (ORCPT ); Mon, 22 Apr 2019 15:42:13 -0400 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 CA646214AE; Mon, 22 Apr 2019 19:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962132; bh=7rYj/+g1YhsbLdyz4Q8xGdqAbHLyEZLrYGWMfOQUH2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jq0GmIKuTzehBbOhg4/KAwamMmWe8aaS7ZgTNklOJ+0p4KwtWAhS17ZLYpHn2xdYV eO5THrHbd71Splxdh4HpO+TlPcL6L5jMNAIS6qEFnAqDKQuM5S6X0Ie1bV5G3BvhnH /0u0JMzMGe+z5KWGqz7fD7z8J19kANT+xsSVQueg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , Stefan Schmidt , Sasha Levin Subject: [PATCH AUTOSEL 5.0 07/98] net: ieee802154: fix a potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:40:34 -0400 Message-Id: <20190422194205.10404-7-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-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 2795e8c251614ac0784c9d41008551109f665716 ] In case alloc_ordered_workqueue fails, the fix releases sources and returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Acked-by: Michael Hennerich Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin (Microsoft) --- drivers/net/ieee802154/adf7242.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c index cd1d8faccca5..cd6b95e673a5 100644 --- a/drivers/net/ieee802154/adf7242.c +++ b/drivers/net/ieee802154/adf7242.c @@ -1268,6 +1268,10 @@ static int adf7242_probe(struct spi_device *spi) INIT_DELAYED_WORK(&lp->work, adf7242_rx_cal_work); lp->wqueue = alloc_ordered_workqueue(dev_name(&spi->dev), WQ_MEM_RECLAIM); + if (unlikely(!lp->wqueue)) { + ret = -ENOMEM; + goto err_hw_init; + } ret = adf7242_hw_init(lp); if (ret) -- 2.19.1