Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp19077ybp; Thu, 3 Oct 2019 14:08:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjl0EaTb59e8QnjdsaCWQNrqKEOmvw+D1zBSv5sMEVpIX7KOexeYQcnznp/gLdjQWsXpfQ X-Received: by 2002:aa7:c4d0:: with SMTP id p16mr11815436edr.266.1570136881761; Thu, 03 Oct 2019 14:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570136881; cv=none; d=google.com; s=arc-20160816; b=BOyxVObOaj50ob7Yu4P+8LY0K9HhC228GLWmWooMxQv+Kj66/anxNX248pED3pCpZ3 zF1zABHVe1QfGCffaXcF7E7tQKh7lIuAYPgwKaNFYCqT9ZpahxW/TIVQNS1tdiBkcbC1 Yy8Uk0ZIOxp4PsoVCJnUc0J7FVGTsgQ3BHXNq+0/FojVSsjWuJPtlcVaA49cAqcZc4PK paPaUT8uew2mN3QymHXXc05wMkoQpe8Kv5zBndyd+mgzYLt2XNOFnTwt2xH9nLjjBLEq Yh0cZrvHsXCKTbK4ZUJFGxCJkLR/JY5PlJ7tLje0wvhntBhvwSAliQ8u7zKVfx4WXw+v XSqw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=pPlZt26qb0wHIw5ND/7Lf7nkXVZUbxI2YbcdOEBwCa4=; b=VdSWpdeLDfIA2jOCrmZOD2VYSEsQROMFeZC5YMh88FEVkLMi9R8FvVyGgjPDbhGaAQ KPKnRiGdNurEiN9dqrQUj01AF5J6kn2icxXRO8k+fig4mRSVyxqvHqC8uvbmmMGT7Ic6 f6g9Ggaf1xiM9uRUkNdKVTN/+/6FykiP/H8AZ4vYNTSdJzcvK+HtXEeuLEhDwJSYQyQL Q35BpSOJ2tHomN6cjLjZs0DHocpgkazJbzEFnmTRxKBMuSVNoAA90ZAuKcz1N2W6lmUJ CSj7y2XhGWb8u9tsqSOXiI8ZU8vS5pqEYCYH2IrzVtLss+HDgPRpXet6FyXdX0WMrGIl IE+A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si2363034edb.133.2019.10.03.14.07.37; Thu, 03 Oct 2019 14:08:01 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730436AbfJCVF6 (ORCPT + 99 others); Thu, 3 Oct 2019 17:05:58 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58274 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730162AbfJCVF6 (ORCPT ); Thu, 3 Oct 2019 17:05:58 -0400 Received: from mail-pl1-f197.google.com ([209.85.214.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iG8IN-0001ua-S7 for linux-kernel@vger.kernel.org; Thu, 03 Oct 2019 21:05:56 +0000 Received: by mail-pl1-f197.google.com with SMTP id f10so2508587plr.7 for ; Thu, 03 Oct 2019 14:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pPlZt26qb0wHIw5ND/7Lf7nkXVZUbxI2YbcdOEBwCa4=; b=SSjJOA/oTFuh7oHWhc5oQVs5H6eCJ3SHKfBU9eRm7zum8nn+svzI1vrodoFMptINl7 GERx/TXIFRrFBALr/uHgIpvbSqzEv56bCMirqGJXzv4V9y7qhwju7YCsocfy4CN6dfSN /u7GTCfNo2w4dW4CACJ9OrhoPY4Dcs4oZqFPvXWRoy5CzZwDEu5OmKGmx4cbUncF05vJ hxM+YTBkLRMAujZMH5AJ2aOBCWjRpQFwVTy/2ny4RnnbSFAQK3Us+LbrgCDYG05CFVPs eNBupRKbrTRJEKKf7yf5jqJRGzcArjQAnz4kXuZRK7eITP4QCynXOdMb1aTtnarkZIU5 hefQ== X-Gm-Message-State: APjAAAU+nImw1NVKRfg9I9K507VjZdkpH6fNd3uj12zITh7XUl+/3HC1 TXP/2PVgI4vl5GZ1sY56se4ASujMuh4PqP/xeX9cqzsY/HehguH9RB9q10+ESKiV0O3hjDnPdsk csboprVJcvgR2lqBK9EZXLUZcfkYqj2ZBZTBV1fWwcw== X-Received: by 2002:a63:161b:: with SMTP id w27mr11299787pgl.38.1570136753865; Thu, 03 Oct 2019 14:05:53 -0700 (PDT) X-Received: by 2002:a63:161b:: with SMTP id w27mr11299756pgl.38.1570136753514; Thu, 03 Oct 2019 14:05:53 -0700 (PDT) Received: from [192.168.0.179] (c-71-63-171-240.hsd1.or.comcast.net. [71.63.171.240]) by smtp.gmail.com with ESMTPSA id s1sm3781165pjs.31.2019.10.03.14.05.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Oct 2019 14:05:52 -0700 (PDT) Subject: Re: [PATCH] staging: rtl8188eu: fix null dereference when kzalloc fails To: Dan Carpenter Cc: Larry.Finger@lwfinger.net, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190927214415.899-1-connor.kuehl@canonical.com> <20191001131122.GC22609@kadam> From: Connor Kuehl Message-ID: Date: Thu, 3 Oct 2019 14:05:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191001131122.GC22609@kadam> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/19 6:11 AM, Dan Carpenter wrote: > > There is another one earlier in the function as well. > > drivers/staging/rtl8188eu/os_dep/usb_intf.c > 336 > 337 pnetdev = rtw_init_netdev(padapter); > 338 if (!pnetdev) > 339 goto free_adapter; > 340 SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj)); > 341 padapter = rtw_netdev_priv(pnetdev); > 342 > 343 if (padapter->registrypriv.monitor_enable) { > 344 pmondev = rtl88eu_mon_init(); > 345 if (!pmondev) > 346 netdev_warn(pnetdev, "Failed to initialize monitor interface"); > > goto free_adapter. > > 347 padapter->pmondev = pmondev; > 348 } > 349 > 350 padapter->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); > 351 if (!padapter->HalData) > 352 DBG_88E("cant not alloc memory for HAL DATA\n"); > 353 > >> padapter->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); >> - if (!padapter->HalData) >> - DBG_88E("cant not alloc memory for HAL DATA\n"); >> + if (!padapter->HalData) { >> + DBG_88E("Failed to allocate memory for HAL data\n"); > > Remove this debug printk. > >> + goto free_adapter; >> + } Hi Dan, Sorry for such a late response! By the time I saw the e-mail with your feedback I also saw another e-mail saying this patch was accepted into a staging-linus tree. I'll address your comments in a separate patch. Thank you, Connor