Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp420486pxb; Wed, 24 Feb 2021 05:57:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2qgPyCL738xktTWwqkjaLI+fGOUCDrZtQE3Kk1uU3+2WgN2pYoLAUNd5QQi53NDmSnqIY X-Received: by 2002:aa7:c80e:: with SMTP id a14mr20204895edt.295.1614175023962; Wed, 24 Feb 2021 05:57:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614175023; cv=none; d=google.com; s=arc-20160816; b=Nu3MCVMUFHZ+pbuhhHJgEL3BMK/RLjU3ZsOqjlV1XpIIKKJzbXdHL9+0rimpf0kx2h ScxfVfA4LKQFDvxAHufZk/RVoifcIwBwWSf2fyty90RHLUEAVI/fThfgssn2QHPoiygp HyUdyhWlBuIbta0EYeE5wIN6OiY9OOOda4WGY5pNgtzQHdTlGqSZPctn6urJ8rDahCW6 BL3Dditu/XRqbN0s92ZlYdzSO4N+NW7PjgsDum4CoZ2yHFheNiwcVXU53d6hxgHqrwxK BsOrcBfvv574nqJf2G5DaOXEU/gJ8T3FDoL/PDFUvUNx4hX6IreUsPHSI/J8fZSnAJsP tpVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=APSFswxXOsozuG0d9piXm8YQpaEY69/UYFSQAOtLojM=; b=aRq9W2GAzOFC0THGklKo+CFzpZx7PAK33gm9MplyIw2cqNjXZH1ehjtbRMNiwvnINr e1XNwrugTaL6DBd+n2+RMWnkFzfCFKPw8jEzVjCjPgi61J/ZlO9FyrWfIiOE9/zkSIFG cvt00giwMsteYcdJefNWLRXDpnlz6dhVzwKoV9s36T/B/9YmtUGQCValN1Clxt6OFaz/ rElV/jVpeB2D58s+Ol1IDyBXNBL4eH4ZtjlHlMV/lGSmcmbK3OBc28BBg8p7Ib3yM6PJ folbl8faehHIqxckyVQL+4FwvTYe8aUoImPWHwJcPA9dtiYL7ls4uST6rsmYuUjEXUmc QFHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WgvLUVbA; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si1280569edv.230.2021.02.24.05.56.35; Wed, 24 Feb 2021 05:57:03 -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=@kernel.org header.s=k20201202 header.b=WgvLUVbA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236388AbhBXNqy (ORCPT + 99 others); Wed, 24 Feb 2021 08:46:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235713AbhBXNFC (ORCPT ); Wed, 24 Feb 2021 08:05:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5291064F79; Wed, 24 Feb 2021 12:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171241; bh=2BViZ6ARLrHIIICIYpZ5B5VmfL3TQt3NPutl+sBbQbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgvLUVbAJCTISXCTrvfJADO1TR3SLN16rDhuTxyHIxX7X/r49Mez3BGsIeEyVjYAW y/nx7KnbwHQs1Y6ggs6K2RnnX8ltV3Ni5gE+Dcohd5QP0P1zLyXi+KhQSikXMw2QlQ cvWXJ/woAazf49G89aLh1Ss859HBNeN9AdAg1BXRXDs/W0h8HQ1pEwREmD/Akt8fuM ECNLU+pgxYb4cNKER6la2rddAASKb3rck9R/rSJqeqjhgBPXb6WVPUac5O4bz66Nkr zdgCt3VqxlJ9LGdkcO5b3e0dCDAKVbWfz1O3DKRDfql/kZ1Hj04WE/zwv1lE7IiJIM aoahjTBOBlCmw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zqiang , syzbot+c9e365d7f450e8aa615d@syzkaller.appspotmail.com, Daniel Vetter , Sasha Levin , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 15/40] udlfb: Fix memory leak in dlfb_usb_probe Date: Wed, 24 Feb 2021 07:53:15 -0500 Message-Id: <20210224125340.483162-15-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125340.483162-1-sashal@kernel.org> References: <20210224125340.483162-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zqiang [ Upstream commit 5c0e4110f751934e748a66887c61f8e73805f0f9 ] The dlfb_alloc_urb_list function is called in dlfb_usb_probe function, after that if an error occurs, the dlfb_free_urb_list function need to be called. BUG: memory leak unreferenced object 0xffff88810adde100 (size 32): comm "kworker/1:0", pid 17, jiffies 4294947788 (age 19.520s) hex dump (first 32 bytes): 10 30 c3 0d 81 88 ff ff c0 fa 63 12 81 88 ff ff .0........c..... 00 30 c3 0d 81 88 ff ff 80 d1 3a 08 81 88 ff ff .0........:..... backtrace: [<0000000019512953>] kmalloc include/linux/slab.h:552 [inline] [<0000000019512953>] kzalloc include/linux/slab.h:664 [inline] [<0000000019512953>] dlfb_alloc_urb_list drivers/video/fbdev/udlfb.c:1892 [inline] [<0000000019512953>] dlfb_usb_probe.cold+0x289/0x988 drivers/video/fbdev/udlfb.c:1704 [<0000000072160152>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396 [<00000000a8d6726f>] really_probe+0x159/0x480 drivers/base/dd.c:554 [<00000000c3ce4b0e>] driver_probe_device+0x84/0x100 drivers/base/dd.c:738 [<00000000e942e01c>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844 [<00000000de0a5a5c>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431 [<00000000463fbcb4>] __device_attach+0x122/0x250 drivers/base/dd.c:912 [<00000000b881a711>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491 [<00000000364bbda5>] device_add+0x5ac/0xc30 drivers/base/core.c:2936 [<00000000eecca418>] usb_set_configuration+0x9de/0xb90 drivers/usb/core/message.c:2159 [<00000000edfeca2d>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238 [<000000001830872b>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293 [<00000000a8d6726f>] really_probe+0x159/0x480 drivers/base/dd.c:554 [<00000000c3ce4b0e>] driver_probe_device+0x84/0x100 drivers/base/dd.c:738 [<00000000e942e01c>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:844 [<00000000de0a5a5c>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431 Reported-by: syzbot+c9e365d7f450e8aa615d@syzkaller.appspotmail.com Signed-off-by: Zqiang Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20201215063022.16746-1-qiang.zhang@windriver.com Signed-off-by: Sasha Levin --- drivers/video/fbdev/udlfb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index fe373b63ddd6d..ecbfbbf1c1a79 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1017,6 +1017,7 @@ static void dlfb_ops_destroy(struct fb_info *info) } vfree(dlfb->backing_buffer); kfree(dlfb->edid); + dlfb_free_urb_list(dlfb); usb_put_dev(dlfb->udev); kfree(dlfb); -- 2.27.0