Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9098640pxu; Mon, 28 Dec 2020 06:36:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzk1HnI1XKBvtHFJfd5Pipzf+H0J0qYY62A2nwKnO1NRUFLsoVBlGOt/cu8N8MUngAkfebn X-Received: by 2002:aa7:d7d8:: with SMTP id e24mr41887963eds.135.1609166178723; Mon, 28 Dec 2020 06:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166178; cv=none; d=google.com; s=arc-20160816; b=auuWzW221FJBUCAfdzsflaBtY7fDcCJUPcRZprHMaw2pLrQry2eVhFx0pwfw2L5Iux NzL6ajJQxhiA7zkynvty6MT/LiM6kTf8WFUvV0/Zck+0yl/4Mq61W1bClvfF2zogopzS G+YefqhXgpOppPS0ogjWOQiZEPZIxG8XC5AlY7GJZ+UMOgVuk06l6gttzVKfayEKTA9R I9J+cUWtCBreutivutS4aGythDUt2pXbybOYm9jUzfrxRnNXy8GKzskvbbE98f5o1yax GLsCy1NXSVPhj4OBvVFeHgIgaVmxg7y/8hfQa9NZ9wPGwhtIBgfmBJvIMuMskoZHIHSY Tx5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pWCl9RcBENpxTxnj4TOkVoyRcnV7I4X9Z8TjuJqsHdI=; b=wrYUI7cKPKRUjrKo1B13vqNXoCMMRjFq8mknl7yjE4v2gvPwgzhJZwLmesjfDVkiIy KMl8pyPk5qvCk8TeFT+jatShSOiVkchkR4FU4Il1LrgL5MhVCvPW7MCtHUJaIxPghp3i yzafdgG3I3+BsuwNw08+kYZF4yko2pkwRo9C3dv46aulzu6FwHm7kkj683WZOnNXGcPz MqgE6tArr1LQmtH6syH2Fdb5cAB0qSnFX63i7SdQfzhXAJjCtgUpk9gAPSQNtKrRWvuI JC0XZNKsYqHQH6ae/dWzkc02NJ/sX+10nqVpyO4Sxqj92445+LJzvUgTFfn/NY1x/Tj2 o5tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fsrNpcHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si7si18579732ejb.5.2020.12.28.06.35.56; Mon, 28 Dec 2020 06:36:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fsrNpcHB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505113AbgL1Ody (ORCPT + 99 others); Mon, 28 Dec 2020 09:33:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:40806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392119AbgL1Odm (ORCPT ); Mon, 28 Dec 2020 09:33:42 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93BA4225AB; Mon, 28 Dec 2020 14:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609166007; bh=jVzPh64KOHpk2wtB0i1401+raWRvFMw+qX6VfNWNKVw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fsrNpcHBGtIt0x6DWFK8BlEvhp9YsDF5iDFpZ5i1B6moNuprAIC7kVq/ZpfewLdrE sOi5bEqN/F1siFzTQECaRyUZvdWd/L1ITXxFjRsuxLWhe4A0TialonZ2CmqUdd6KIJ gLAkTIUQnY0z1Uua5VRPWYehfhJ4Nfvz2j19Z9v0= Date: Mon, 28 Dec 2020 15:11:14 +0100 From: Greg Kroah-Hartman To: Dinghao Liu Cc: kjlu@umn.edu, devel@driverdev.osuosl.org, Camylla Goncalves Cantanheide , Zhang Qilong , linux-kernel@vger.kernel.org, Colin Ian King , Allen Pais , Masahiro Yamada Subject: Re: [PATCH] staging: rtl8192u: Add null check in rtl8192_usb_initendpoints Message-ID: References: <20201226080258.6576-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201226080258.6576-1-dinghao.liu@zju.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 26, 2020 at 04:02:56PM +0800, Dinghao Liu wrote: > There is an allocation for priv->rx_urb[16] has no null check, > which may lead to a null pointer dereference. > > Signed-off-by: Dinghao Liu > --- > drivers/staging/rtl8192u/r8192U_core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c > index 93676af98629..9fc4adc83d77 100644 > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -1608,6 +1608,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) > void *oldaddr, *newaddr; > > priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); > + if (!priv->rx_urb[16]) > + return -ENOMEM; > priv->oldaddr = kmalloc(16, GFP_KERNEL); > if (!priv->oldaddr) > return -ENOMEM; There is a bug here, where the memory is not freed from the alloc urb call, right? Anyway, something to fix up in a leter patch, thanks. greg k-h