Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2989676yba; Mon, 22 Apr 2019 17:17:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxz1Mj2BWri9UjreF/c/xJ12P17z/tzhp49D6O/1KJ6bM0nrX29w3SdDNHMP0qR4sXIWTj X-Received: by 2002:a63:c61:: with SMTP id 33mr22190929pgm.293.1555978660684; Mon, 22 Apr 2019 17:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555978660; cv=none; d=google.com; s=arc-20160816; b=qHOScm+Kvm4iU8quXtUUWVjhSBuwM8HS539DNXA5w5loAJ6XhcFzV6Oci/RkAAQgdP L20Lj1mthBNEkvu5KH/zFterbPT4x1S7PZVrOp5KXjdcuA97TRNI+5eemNpcE85CKYPk 5VIJCsWNKriLDo0icq6tSUQ2j/NNG4wAAsUN152p3xFsTJgZvL4MolJ7rj4LPKAN8qtl yc1uGKzxc3MJQDIEbVhPoHNB5WiJP03ujqkaKg2me7/6ZCQtERtBwJ2ASbT1ntwWLhwt hJCu3XgEY6yCSZG79WlBvqx9o9difQyqsYoIWePWrDYvWSEVbGTXYZ+3WPaI0/bgbAuZ 73gQ== 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=i3wYwTL8iozWwqvSrk32VHQmjyNLAz+HZEj7vGgcEejXlRB3ASQPRSyq5hEwBJXEr5 BJyfsvvED2NbZZQOkX3O9lT3TSbVL76e8athJmkEutuEcF/u+pSCZPbiS7aTV2PTp5N5 pnzIr0GYgsISAGeEFzicnZk6yMHREcNIcuh0ryzu7zX61ojnrdhU28DTpV+lqx9RIrUY tlovsyb+OSn1fcvDENRko712bDnI695gZABOaFq+8nlxrmRbOHMiWqTSPtBGj4S6KbAO a4Ddo8DQPyvyrJZtiOpuAIIcjqMzNqLULxg4G6owVoHDLik+zed8jPkKKzKJhHNEb1vn 1boQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="isvMu/TS"; 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 v23si3223605pga.500.2019.04.22.17.17.25; Mon, 22 Apr 2019 17:17:40 -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="isvMu/TS"; 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 S1732218AbfDVUEy (ORCPT + 99 others); Mon, 22 Apr 2019 16:04:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:47124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729722AbfDVTpY (ORCPT ); Mon, 22 Apr 2019 15:45:24 -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 E168A218D9; Mon, 22 Apr 2019 19:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962323; bh=7rYj/+g1YhsbLdyz4Q8xGdqAbHLyEZLrYGWMfOQUH2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=isvMu/TSYl1aZPRXKy3QbecFVXJdTgccir+4hVgA1Nco5R1s8wEfHaBL+QOugxKWv Do1efc0IRzAVrC20iHXAs3MYmuCvWPnVCZJQmGiFTrsrpdOCFjliHKqU0Wm86P7McF hekdBQOkam38u6WJkAJ8gq6rKYvKUwEq8I3ZJ1M8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , Stefan Schmidt , Sasha Levin , linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 03/68] net: ieee802154: fix a potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:44:11 -0400 Message-Id: <20190422194516.11634-3-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-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