Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7655014pxu; Sat, 26 Dec 2020 00:06:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxB3puqbSOJNTGTZebmBZ0x1+qV2N7EpiIgLuhYWgVE/2EWmTZgVHi9rhcOlyv/92SN9WDv X-Received: by 2002:aa7:db56:: with SMTP id n22mr35122698edt.4.1608969972233; Sat, 26 Dec 2020 00:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608969972; cv=none; d=google.com; s=arc-20160816; b=GF2z+GE/zPcC3i5qEodj8QYuIfBcXb12ANSTvXRKAlQI16Pn4Q24Ww+tCBc0xo0RnU TO+a+DR6JeEOIGTgIEiJETB1dFCgBsRKKbQVVUtdFoiI8oHzzXMYAxx0gz6uLaJ6vVlg hW12fP8zC3si7e1wrAhZ5QD16U3jquwniNaZf+T8Fh/vOtfjdDp/SXFWkHJE2EjhODuB PekIPdhLonXdu2j6iUCT+Sy7UjvxFyCpu2xEXfmVl5FXfSScg6IftYxgERhUI5uy3W51 1QCR5dDFcM8TNQ4oR3889Uc1ksfQnDLGiolTCVroy/V8gMK1bcDGEvxUGJNrdaBV2a1C LkmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=wj+27aY+I5itk5wh+t3WhIgTgFC0k0yI3DArYGF5zwE=; b=xXr6JLPKyhLrSWl5Kj74keVTGj7QvITuEZXLYEVOmIQcEgRgi7nicz+SQnEvum/iB6 u7m38kJgoRwvayAcRymGJKEPsd+ycrUKYzZh9tyRQ2NEwGsZTLFH1EkbSqKOVi4IXf8s 0mp8FJUL37ob96lklKXOs/4UUazkMEpkCl3ATmWg400oc8ho9sqKB4S6372YQ5eRdrE1 F8lotgn00iAsLU+0glRDSEnooG4y4BiqlaooZTnB6LPjziMzLM8qR420F/VdLhEtwpi0 Lhr4+khudmMpErZkoWPs01zr1Hkf1zs1miyp8SrL6yGsQEPDqdd9hOvWEbBJDUi5knXs FLtQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si16803134edy.540.2020.12.26.00.05.48; Sat, 26 Dec 2020 00:06:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726014AbgLZIEK (ORCPT + 99 others); Sat, 26 Dec 2020 03:04:10 -0500 Received: from mail.zju.edu.cn ([61.164.42.155]:61510 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725809AbgLZIEJ (ORCPT ); Sat, 26 Dec 2020 03:04:09 -0500 Received: from localhost.localdomain (unknown [10.192.85.18]) by mail-app3 (Coremail) with SMTP id cC_KCgDX32sy7uZf2rYQAA--.27169S4; Sat, 26 Dec 2020 16:03:02 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Greg Kroah-Hartman , Camylla Goncalves Cantanheide , Zhang Qilong , Colin Ian King , Masahiro Yamada , Michael Straube , Allen Pais , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8192u: Add null check in rtl8192_usb_initendpoints Date: Sat, 26 Dec 2020 16:02:56 +0800 Message-Id: <20201226080258.6576-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgDX32sy7uZf2rYQAA--.27169S4 X-Coremail-Antispam: 1UD129K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qrrzjiaqtzq6lmxovvfxof0/1tbiAgYEBlZdtRrnPgAPs0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.1