Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6585218imu; Sun, 2 Dec 2018 22:24:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9fz2gjMgK3CMYet/NwIE4nMDIby1kMH58TAQY2wkInL2DOnVXvVTCm8KvS6OlVoTrblIh X-Received: by 2002:a17:902:7603:: with SMTP id k3mr14920535pll.285.1543818244547; Sun, 02 Dec 2018 22:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543818244; cv=none; d=google.com; s=arc-20160816; b=tsVr8OrbEz1gLHl21UBMXIYPNlxWGjvW6xafRShWnINDMOv1gGCjwOAEa6gyFIsYDk wmPlW4EkO5GBiStoQWjB5XAk8+LtVGzXQ9s8ACt82A8fMOzbB0itnQLwYl2o3CH2KjQ5 uc0ZcD3s49ISybua19lHNH4vGikmH+2n+JG5GNKrcTroSuw0JskeDMQg4v7RGEbBu/eY YRMcZxzLla2mP3yDfAXqKhzAs4PBVKJj4QSSaJl7BIROolZyqqF1asFJQTWFYk14hZzs pBbH8QuDZn8wrlVL5zShz7wgl8awEpW51q8chI6DZF0S3zz/UwbjwMBNW/50SgSzc3E4 zIPQ== 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:mime-version :message-id:date:subject:cc:to:from; bh=qXBHneiF7c3vKiAKgC8yovHkHz1QHSB7YytFsAiFe+s=; b=N9Qv/iGTJzWJZzgLqt/guOl88vc689TneQEWDsjMD0hem3uZWfsALS44DVJ5hb8bra QrfrgoBrpmioJhRn+fmQGDK90DwaOk8/EZNIYc3ccUTKbbpajdLSVcT3kdISPvGpoFER Fj+XDiZidr9PLIwczvt6J3eHrcrCcMyIX/5FpISq/z7uVNbLuwQabL0MnysUqkmpwV5W LlyqtgzazE1CBCXc9nEEgx9n1Q2YqRUtfEea5eLvN73Mg4vXSohJmqpkwnGpBuPzELA5 bD2tOK6Zuqo1pq70JCf7FGIJ6cxlvsF93syYj6uagx2lto+yb/iM3yIBxTTUBTwumhdQ 3bzw== 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 q20si11809852pgl.268.2018.12.02.22.23.50; Sun, 02 Dec 2018 22:24:04 -0800 (PST) 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 S1725889AbeLCGWC (ORCPT + 99 others); Mon, 3 Dec 2018 01:22:02 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:8288 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725824AbeLCGWC (ORCPT ); Mon, 3 Dec 2018 01:22:02 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id EEC02247E69156DC34F0; Mon, 3 Dec 2018 14:21:55 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wB36LnJ0033684; Mon, 3 Dec 2018 14:21:49 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from LIN-A6CB96A0603.zte.intra ([10.90.106.118]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018120314215533-14385734 ; Mon, 3 Dec 2018 14:21:55 +0800 From: Wen Yang To: Bernie Thompson , Bartlomiej Zolnierkiewicz Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, Wen Yang Subject: [PATCH] udlfb: fix potential NULL pointer dereference in dlfb_usb_probe Date: Mon, 3 Dec 2018 14:21:25 +0800 Message-Id: <20181203062125.34880-1-wen.yang99@zte.com.cn> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-12-03 14:21:55, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-12-03 14:21:49 Content-Transfer-Encoding: quoted-printable X-MAIL: mse01.zte.com.cn wB36LnJ0033684 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes a possible null pointer dereference in dlfb=5Fusb=5Fprobe, detected by the semantic patch deref=5Fnull.cocci, with the following warning: drivers/video/fbdev/udlfb.c:1704:11-15: ERROR: dlfb is NULL but dereference= d. The following code has potential null pointer references: 1597 /* usb initialization */ 1598 dlfb =3D kzalloc(sizeof(*dlfb), GFP=5FKERNEL); 1599 if (!dlfb) { ... 1601 goto error; 1602 } ... 1703 error: 1704 if (dlfb->info) { 1705 dlfb=5Fops=5Fdestroy(dlfb->info); 1706 } else if (dlfb) { 1707 usb=5Fput=5Fdev(dlfb->udev); 1708 kfree(dlfb); 1709 } Signed-off-by: Wen Yang CC: Bernie Thompson CC: Bartlomiej Zolnierkiewicz CC: linux-fbdev@vger.kernel.org CC: dri-devel@lists.freedesktop.org CC: linux-kernel@vger.kernel.org --- drivers/video/fbdev/udlfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index 070026a7e55a..df37cfaa2362 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1701,7 +1701,7 @@ static int dlfb=5Fusb=5Fprobe(struct usb=5Finterface = *intf, return 0; =20 error: - if (dlfb->info) { + if (dlfb && dlfb->info) { dlfb=5Fops=5Fdestroy(dlfb->info); } else if (dlfb) { usb=5Fput=5Fdev(dlfb->udev); --=20 2.19.1