Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1088637ybt; Wed, 1 Jul 2020 18:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKN4R5MR0wJr1z/Kc1w+o/xCID39zKCAViF/0ofR68ctRvKBpZ95HBdxw2J/lWCgEL6oz6 X-Received: by 2002:a17:906:71c6:: with SMTP id i6mr26376763ejk.103.1593653793254; Wed, 01 Jul 2020 18:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653793; cv=none; d=google.com; s=arc-20160816; b=XfRDTgzLDkSmql2qQM2LqFO5/U9wQ879e1SAZfID78hmgAFZ49kPhKvZWC+8oIpXad e6gXAqmovgaicamz8UjBIqwWn2cQOZ7QjQA8SxBvlZXGHM5WpAcwxnKLabBsz8dMHD8d 55LDRaDHY5vAjtoRkdfjzQo3bzMIwGAL+4e1KLmIOPkM2FmzzW8pvdVauOCMMbrYk7oI DAZsaEbxHADItdyT+jOIukYuL/DBjWVEGqN2exqv7t3Ew4jIq/LLLRx3HV2MKVkTZObG D+PeRgaYfvPUgWWYAkZYTv5fCU/+59xdMHKLiG693+rw5TUejDUJfkHYyJTRbkK/d6U5 OMFg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xWxHZpFx7XB4tX5UMO7IetxpsPH7+agMuxRqRJQl89Q=; b=bIjbkNcQNPhjNbahlwXRUX52Tf4yzoV4EmSyRhmvJpGMehmwtizpiVzovSMzjIJa5Q jJ10rEvvA+cPEJQyrI0sGhigvaqKLOs7cqjfJfze52N5vg2HqBdCXhQ1RwrVXCKh6FRA 8GZdQaf3G7Z85RWXqYZG0TEJmc2/zbdqYI4uL1xRLvx8C+5RsIyhdapd1DwzBfSsRWDW Fy6PdN4JOVRDW0reH8Hrs1iv2hvM0xWq9QpDqM/jD1ikmBKkpZEbhtpUm7a1UY1eaaC4 XMZYV1hLplmAYxA45ibcmSSHAjVlZLOVz+PY1Wa84FeF5gtzLgD1cV9NTNSSEkLVRBU+ uWDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dhvyLizu; 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 dr10si6216632ejc.204.2020.07.01.18.36.10; Wed, 01 Jul 2020 18:36:33 -0700 (PDT) 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=default header.b=dhvyLizu; 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 S1728252AbgGBBgG (ORCPT + 99 others); Wed, 1 Jul 2020 21:36:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:53864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728278AbgGBBXT (ORCPT ); Wed, 1 Jul 2020 21:23:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BCD720A8B; Thu, 2 Jul 2020 01:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593652998; bh=lWL7UQC9ozt0/QZx+J+2+syn9yzi1khDLGN/pX0tpOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dhvyLizuy32hZ4QQJ/isZckT3dlQe1Hu+QErb6/Pimkm7oTmAhQy1OvhWGv8H1vTb I0ZMMw1IOe+Bf89qkPKiuLmtZGVXi5o9i6H1zo90RXqMcT5bTpnp9PxFJWNJZ3j/zo R2TOwSnbzvvQqwLrFz+LZtg1o098hazHbJ3Dfomc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zqiang , Alan Stern , Kyungtae Kim , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 19/53] usb: usbtest: fix missing kfree(dev->buf) in usbtest_disconnect Date: Wed, 1 Jul 2020 21:21:28 -0400 Message-Id: <20200702012202.2700645-19-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zqiang [ Upstream commit 28ebeb8db77035e058a510ce9bd17c2b9a009dba ] BUG: memory leak unreferenced object 0xffff888055046e00 (size 256): comm "kworker/2:9", pid 2570, jiffies 4294942129 (age 1095.500s) hex dump (first 32 bytes): 00 70 04 55 80 88 ff ff 18 bb 5a 81 ff ff ff ff .p.U......Z..... f5 96 78 81 ff ff ff ff 37 de 8e 81 ff ff ff ff ..x.....7....... backtrace: [<00000000d121dccf>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline] [<00000000d121dccf>] slab_post_alloc_hook mm/slab.h:586 [inline] [<00000000d121dccf>] slab_alloc_node mm/slub.c:2786 [inline] [<00000000d121dccf>] slab_alloc mm/slub.c:2794 [inline] [<00000000d121dccf>] kmem_cache_alloc_trace+0x15e/0x2d0 mm/slub.c:2811 [<000000005c3c3381>] kmalloc include/linux/slab.h:555 [inline] [<000000005c3c3381>] usbtest_probe+0x286/0x19d0 drivers/usb/misc/usbtest.c:2790 [<000000001cec6910>] usb_probe_interface+0x2bd/0x870 drivers/usb/core/driver.c:361 [<000000007806c118>] really_probe+0x48d/0x8f0 drivers/base/dd.c:551 [<00000000a3308c3e>] driver_probe_device+0xfc/0x2a0 drivers/base/dd.c:724 [<000000003ef66004>] __device_attach_driver+0x1b6/0x240 drivers/base/dd.c:831 [<00000000eee53e97>] bus_for_each_drv+0x14e/0x1e0 drivers/base/bus.c:431 [<00000000bb0648d0>] __device_attach+0x1f9/0x350 drivers/base/dd.c:897 [<00000000838b324a>] device_initial_probe+0x1a/0x20 drivers/base/dd.c:944 [<0000000030d501c1>] bus_probe_device+0x1e1/0x280 drivers/base/bus.c:491 [<000000005bd7adef>] device_add+0x131d/0x1c40 drivers/base/core.c:2504 [<00000000a0937814>] usb_set_configuration+0xe84/0x1ab0 drivers/usb/core/message.c:2030 [<00000000e3934741>] generic_probe+0x6a/0xe0 drivers/usb/core/generic.c:210 [<0000000098ade0f1>] usb_probe_device+0x90/0xd0 drivers/usb/core/driver.c:266 [<000000007806c118>] really_probe+0x48d/0x8f0 drivers/base/dd.c:551 [<00000000a3308c3e>] driver_probe_device+0xfc/0x2a0 drivers/base/dd.c:724 Acked-by: Alan Stern Reported-by: Kyungtae Kim Signed-off-by: Zqiang Link: https://lore.kernel.org/r/20200612035210.20494-1-qiang.zhang@windriver.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/usbtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 98ada1a3425c6..bae88893ee8e3 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -2873,6 +2873,7 @@ static void usbtest_disconnect(struct usb_interface *intf) usb_set_intfdata(intf, NULL); dev_dbg(&intf->dev, "disconnect\n"); + kfree(dev->buf); kfree(dev); } -- 2.25.1