Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6887866ybe; Wed, 18 Sep 2019 10:39:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+i8lKqPmyFfIo7lieLAjQ6JVulYPbrPW2LuKMiKXO40vW9J7Ot1w2Kpdf/R5ZFtJrCwZf X-Received: by 2002:a50:dac2:: with SMTP id s2mr11681018edj.26.1568828357201; Wed, 18 Sep 2019 10:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568828357; cv=none; d=google.com; s=arc-20160816; b=XcqbJ+H6mz8A/9MUhmxvQU4C8PJYqHAG43RgUjyLwkSecXu8Gz1ttO0ka/4CltIUmq UhGKZn4X/AncIiGDBu10VRTdYJNag6x6HIxxoTnMk4blSJ+l3FAL+JDVWzAPJSHK4eIP SqkJN48yH99koNQowSTe/FawP/q9u3TbRjXQG5t0KWL8LFAdHD9tpPTyIX5Wex+7jKtc ThpnAgDGKTd7pvWpIvbSH86YRHytzJPiRg/HW77GeJkXEDMSYTSfKHw2/QAJ92mUR3Ow TqD0WFpWvUgGJg/jybftyrgOJ7kXHRhFaynci19RGQR0AsMN58i3Jy1Brds5AMIYU7D8 aWcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=6HmAGDFdHRUI7cgzm9JSM02l9i/iZkony6zX76ehEFc=; b=SyFi0RMfMZ8//mSt6yxq4wlTRdX/hJf4ZdTXf5Haly73+aBluTMKV7nGxMetD3mw/3 /Qp7R6oHpJSj+lwTDx6ve1jtm0LYhtCMdw36xXz8Rki9jOHCm4Y7/e3AcEwoRBEVzcZM vg05IKSRgulqXg2klXiQj3hnrHewd2dM/JzY5IJs6yM2hqrXOzDXDlpuaaFlOoPxvvcK bnCI7xjVaOiQz0gLGexJBZZDQ8kYrzZ6AU9QOSnKZZnvazBtQpbfgxbbZuv07C6Q1ELs 9jKd1H6ZWhBRws/DvcnAdAgGNVQGN9U8qf/0exMVSrkDqFndkb0U1BIBO8FvBFXoM8Ee 6MtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=fJeTQLiP; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1si3722995ede.255.2019.09.18.10.38.53; Wed, 18 Sep 2019 10:39:17 -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=@oracle.com header.s=corp-2019-08-05 header.b=fJeTQLiP; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731980AbfIRQdf (ORCPT + 99 others); Wed, 18 Sep 2019 12:33:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56488 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbfIRQdf (ORCPT ); Wed, 18 Sep 2019 12:33:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IGNYs1021936; Wed, 18 Sep 2019 16:33:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2019-08-05; bh=6HmAGDFdHRUI7cgzm9JSM02l9i/iZkony6zX76ehEFc=; b=fJeTQLiPV9WGyPXdsaGLXbqyxtZ0dkcpeDknz+1xiZ54yEGqyLI48fw9ds0+8uJcVWIE lPnn0KDQ6OUkA2EwFGeLEoAVS28JICfQdKExYfNF2PLGl1R/49K7San+cxdgkdmGTx9c BjWZyv6o7ZWbG0Nrkx1vfKLoQ3lnXlb0Ra3BHiHm3qgFCNOrCp5y6R+B01cY9bH6l3la iMlcw4afmANYPAFI9h33pLN9NluLuJaspDTyhK6E1YRgrwKql0pNWQW1XpvAOvXuLDpC z/Vq9Ushftf33zL0VWIJKjVL1w0uRiL2CEWg935eTXMO3pah9bQZefY612trOlYAaO8h jg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2v385dw5bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:33:29 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IGMsJc173841; Wed, 18 Sep 2019 16:33:28 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2v37mmwt5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:33:28 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8IGXRab029952; Wed, 18 Sep 2019 16:33:27 GMT Received: from x250.idc.oracle.com (/10.191.241.104) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Sep 2019 09:33:27 -0700 From: Allen Pais To: netdev@vger.kernel.org Cc: davem@davemloft.net, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/net/fjes: fix a potential NULL pointer dereference Date: Wed, 18 Sep 2019 22:03:15 +0530 Message-Id: <1568824395-4162-1-git-send-email-allen.pais@oracle.com> X-Mailer: git-send-email 1.9.1 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=825 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909180156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=909 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909180156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur. Signed-off-by: Allen Pais --- drivers/net/fjes/fjes_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index bbbc1dc..2d04104 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1237,8 +1237,15 @@ static int fjes_probe(struct platform_device *plat_dev) adapter->open_guard = false; adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0); + if (unlikely(!adapter->txrx_wq)) + goto err_free_netdev; + adapter->control_wq = alloc_workqueue(DRV_NAME "/control", WQ_MEM_RECLAIM, 0); + if (unlikely(!adapter->control_wq)) { + destroy_workqueue(adapter->txrx_wq); + goto err_free_netdev; + } INIT_WORK(&adapter->tx_stall_task, fjes_tx_stall_task); INIT_WORK(&adapter->raise_intr_rxdata_task, -- 1.9.1