Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp438296pxb; Wed, 24 Feb 2021 06:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwko9ryMQSbTI7FCkeDbeQ6tv6vilaZaYLRMD/+dHKbooTNuy698J8jgyqoEGYKIep7Zt8t X-Received: by 2002:a05:6402:3508:: with SMTP id b8mr33472855edd.341.1614176328063; Wed, 24 Feb 2021 06:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614176328; cv=none; d=google.com; s=arc-20160816; b=gJ7TRdjCogqlzrcS+xgHZO7kjV9phEBBcwcu9hZKg78MwIludqnmjO3xJRIaAKk7Fr vN7UtFNVgpNqeoLwXOn+I1HPYGico1hnZTRv1GAiszP9a/NxEw5EmyEiOkw8EliJbTcm 1i3ipDBdkmiII0NFnlWAQi3ktSzbXnW0F36pr14nTtynDYgBvHZheUBVinR008/iX3dV V/jnFEsFnMie2OIGiT4J4jKEvkKbcZhzngnXii+hDGXprQtgc341L0OSBUA8tiGfRgWs tcnd8fScJ1o1agPXUeF7Buez432Thdc6t/L4NA8Ah+VMH6jpMXmxczVe3Zxtl5Gv0DEy iKGQ== 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=VKc2Xoq2pUZz4NrIdZMTukuKcrcsN81FTIieAyz/dtc=; b=sEsglCmwDhnXZb+ASzIwhpbjAzQki7nL8cuoB1++4YGrWw7k1+FfB9igKfkU+AZ/lQ SNBjcwpGDB3YI0pHKyAhCT5/Un/cVFF8sct5fveAt0+oZCTMZqtPGnNG0+x9mQZ05hNn SZwnu+68RY9C+3GUUm5JeZTytgQT9ZJfhcdQW+qj+BwIzS351TXVHBADbN4Q2MWZPt5L 8DLDNczfirhgzgqiNO2FHrxVQOBBt/ZVkfNc0+dmhlcr3L79COuZAIRNbI4cyshTSpiZ bKXgF6dmXYXhXtPXAdwsow42JTSPlI+EY4WDSfmt61C8LRzAsgTL2y2BWH/umocdH6lF cHEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N8LxvnMW; 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 j23si1366304eje.581.2021.02.24.06.18.02; Wed, 24 Feb 2021 06:18:48 -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=N8LxvnMW; 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 S233864AbhBXONC (ORCPT + 99 others); Wed, 24 Feb 2021 09:13:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:58412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236027AbhBXNIh (ORCPT ); Wed, 24 Feb 2021 08:08:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 005DA64F97; Wed, 24 Feb 2021 12:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171289; bh=EYRaWi8blV+9ujZEjSsC41wqYz+mU0lCnju3XoBnxrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N8LxvnMWZREQJhw9l26gWWQW56myZLkztc3Mj+NVc88C/73BunGQN9svQRVVMtXVr HjQ2H+23QaP1bpEEC+47JfZ2BER6h/iK9dzdb7QOEGjiOGcz0xIEd6Xr2kNCoXReFG p8kfI3CFhwmUaPHVcd9Q9nbVjaIsGabXbnv4Duhb2DkhCpo+YNGsRCZjuMlmQ7Zr1l gUXZvATAKpwsv5WQ6FRNMsFDT243vs4ifceQvhYi5dGN2Ao2JcJztbb7KDc30PGyOr 35nU4puuhwvZWCIs89vY2jDXlTraoYuYXpVIdepDinZfte2ZwgMl9EXt141keJ1JHs T2jviTJZxjeOw== 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 4.19 11/26] udlfb: Fix memory leak in dlfb_usb_probe Date: Wed, 24 Feb 2021 07:54:19 -0500 Message-Id: <20210224125435.483539-11-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125435.483539-1-sashal@kernel.org> References: <20210224125435.483539-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 5a0d6fb02bbc5..f7823aa99340d 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1020,6 +1020,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