Received: by 10.213.65.68 with SMTP id h4csp246171imn; Fri, 23 Mar 2018 03:50:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELsknT57E9aJnFbh1Tu36tbBMHL8SxoPSXm+k1vgG65UnjSPKZllug8K9W33+VHY7GBVK+jr X-Received: by 10.167.128.194 with SMTP id a2mr23897700pfn.186.1521802230776; Fri, 23 Mar 2018 03:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521802230; cv=none; d=google.com; s=arc-20160816; b=aLjogrPOQ5GjXjLBfMsa9AMEujPH8A3WbTvkSIZBG0PTl56zRC4Wqc3zX/J7zCzyB6 jLB22qExyLa1XHUqx4+dhc5yllSdk3GQ5ZEgntbvZm3/OWpDHQRBYM7SWwM1EACMJu0C fzOwxIrgLa11Yd4Mr0Fttv2JNVVDKyfnvUDC7pIn0bQAzhJ/UMJe47ZajLJa0f5EpUj5 XudJ05hBHTcDxpyw1B60nlM6bFubIdqM4OcTIlhdu8sjbyRnB1ibVQIrVaX7V+gHtzxt UYFrbqMbvu/0YBCVTynjnyfZEEFakaNAZOaqRyX5r3OZvwSFzzwy8RsDtC6d0o1pLrvO kf1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JD5LTOXNNU1S0KKiG/x72+/vpGMbukTIcV/4T0gnZUA=; b=IxUYxfhi9/8yOdxNVP+D07KFns41jWCNGOixNc98Q/r8AEXqEyposMiNqBhSmjANTp C44AW4RNxbLQB+rSic3bRLiqpnEIJCaqp71QYUltqZSR2L0+ca2UQI4MCwK8Eo43MDNz +V487va2+x/f0adm4plKPt4RZPXVCEbPINd/5ZbkwW1OLqTII2Y8ghUIoNGwqYKxpkwc g/v6xeiDzYykaFpOJt4AOVc8VKq1zSvLK1n946NmrU3Q8TP73xzjA3oY3NBkLt0OE+uu 27QDBPjv6IQQQaqgZ6I44NLQ0KYQ/gh0StDJHD2wx2oT11bMsAmSRgjWxmdcyU4wXU1s BXxw== ARC-Authentication-Results: i=1; mx.google.com; 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 t26si1729619pfg.414.2018.03.23.03.50.16; Fri, 23 Mar 2018 03:50:30 -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; 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 S1756045AbeCWKO7 (ORCPT + 99 others); Fri, 23 Mar 2018 06:14:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45440 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752731AbeCWKO5 (ORCPT ); Fri, 23 Mar 2018 06:14:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F077C1270; Fri, 23 Mar 2018 10:14:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Kalle Valo , Sasha Levin Subject: [PATCH 4.4 48/97] rndis_wlan: add return value validation Date: Fri, 23 Mar 2018 10:54:35 +0100 Message-Id: <20180323094200.302960637@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pan Bian [ Upstream commit 9dc7efd3978aa67ae598129d2a3f240b390ce508 ] Function create_singlethread_workqueue() will return a NULL pointer if there is no enough memory, and its return value should be validated before using. However, in function rndis_wlan_bind(), its return value is not checked. This may cause NULL dereference bugs. This patch fixes it. Signed-off-by: Pan Bian Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/rndis_wlan.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -3425,6 +3425,10 @@ static int rndis_wlan_bind(struct usbnet /* because rndis_command() sleeps we need to use workqueue */ priv->workqueue = create_singlethread_workqueue("rndis_wlan"); + if (!priv->workqueue) { + wiphy_free(wiphy); + return -ENOMEM; + } INIT_WORK(&priv->work, rndis_wlan_worker); INIT_DELAYED_WORK(&priv->dev_poller_work, rndis_device_poller); INIT_DELAYED_WORK(&priv->scan_work, rndis_get_scan_results);