Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547213pxb; Mon, 24 Jan 2022 11:56:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIPXMdCpfzp87Yy28orD9o6l5fLT1x/iMmkcGAtLvoNizepHKDxzAMQe4ODmDcEH6FjF5M X-Received: by 2002:a17:90b:910:: with SMTP id bo16mr3523468pjb.26.1643054213288; Mon, 24 Jan 2022 11:56:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054213; cv=none; d=google.com; s=arc-20160816; b=V5NSumjDlxVD0zbWIhcRn3XYlHetsKmQGc2bNdt4+XFrGmMP5E1q9WROyee6Z/mvmY aaIIMCtEn03HGGm+p123uriM02kxEBD9smebuJ51SWYkDQuajmlTvFx4KhqwfaB/njc1 BufLZtcE+mPGOSF4fuQrFoX/tKMeQl+nMnHJMJIaNLbL+8eewwrRb1Cw7+r7LK7TjXPe JHw8bGR1DF7biXBSXc3lPinpT4mBsiYvSa226F9bYFBqS6VfIq/j00a2WF0mzDwGmkms 7DKO+FK+MM1QMnnuY8eR+DV/MfgotVinG8V6MXgyx6yZQS/fxRjfsj3iQ6Xc4+Dc84Yk qVBA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Xc3FfaYjVHRLce5jhvL2ZeiqDS5lsReToY4W4jXHDw=; b=KqzeglSxKwfk4P2KZr4yux3BGK1HQzG1/iB9RPgK8pKcPzKjIir7Ol8DqJYBudgDqd XmaxfSDIE7i6d2AjRe3ycWDrZxciPkNevI7vR5hqOztkPn4IHIcOAZMDu7JBxLuxqu4c 59bgBp0ys8CT3c5kWZXIrEvubcNQWjiZnHnf+Kn3qBBbVYxm9tbgO1bfzJ6E9wVZUMiD Bp/OlQ5/TkQHcaJBrhT9eupOoo2zSjjh6dhYj8sTs5Z3J1uy6N4Fo48bNBchIc3Ennyt mOGXgSnhWrRJ4QLpYegnQpG3ulGc7W6riQdg4TvJPOrDWSwBPgO7HfytTIg3HinZo5GS GSgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AEkfDuNL; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e5si15314905pgu.816.2022.01.24.11.56.39; Mon, 24 Jan 2022 11:56:53 -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=@linuxfoundation.org header.s=korg header.b=AEkfDuNL; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245691AbiAXSu1 (ORCPT + 99 others); Mon, 24 Jan 2022 13:50:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245526AbiAXStk (ORCPT ); Mon, 24 Jan 2022 13:49:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A25C5C06176A; Mon, 24 Jan 2022 10:49:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 40885614D2; Mon, 24 Jan 2022 18:49:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20AB9C340E5; Mon, 24 Jan 2022 18:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050173; bh=unDISHqfT2l35nCeXqnlHSiBvJ2C0S4ZO6Uu0LBzuqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEkfDuNLYlOzUSmwtHmSg6riG1omor+vrHNwBgVvA5AYEf5qMd8P7lqNJ9JbjVJJ4 MOdtvRe9qsaCH2lYTUxxtBv9sKj/x0Arg6I7vvWzaxiZftO+8sJlRna16HdVciFMbL K2DU/QEEiirB0pFTBwe/RuGximq2+M6PYmQuwI64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 4.4 033/114] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:42:08 +0100 Message-Id: <20220124183928.139941564@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun [ Upstream commit 1646566b5e0c556f779180a8514e521ac735de1e ] 'ftdi' is alloced when probe device, but not free on device disconnect, this cause a memory leak as follows: unreferenced object 0xffff88800d584000 (size 8400): comm "kworker/0:2", pid 3809, jiffies 4295453055 (age 13.784s) hex dump (first 32 bytes): 00 40 58 0d 80 88 ff ff 00 40 58 0d 80 88 ff ff .@X......@X..... 00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N.. backtrace: [<000000000d47f947>] kmalloc_order_trace+0x19/0x110 mm/slab_common.c:960 [<000000008548ac68>] ftdi_elan_probe+0x8c/0x880 drivers/usb/misc/ftdi-elan.c:2647 [<000000007f73e422>] usb_probe_interface+0x31b/0x800 drivers/usb/core/driver.c:396 [<00000000fe8d07fc>] really_probe+0x299/0xc30 drivers/base/dd.c:517 [<0000000005da7d32>] __driver_probe_device+0x357/0x500 drivers/base/dd.c:751 [<000000003c2c9579>] driver_probe_device+0x4e/0x140 drivers/base/dd.c:781 Fix it by freeing 'ftdi' after nobody use it. Fixes: a5c66e4b2418 ("USB: ftdi-elan: client driver for ELAN Uxxx adapters") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211217083428.2441-1-weiyongjun1@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/ftdi-elan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 52c27cab78c3e..6f6315082bc44 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -209,6 +209,7 @@ static void ftdi_elan_delete(struct kref *kref) mutex_unlock(&ftdi_module_lock); kfree(ftdi->bulk_in_buffer); ftdi->bulk_in_buffer = NULL; + kfree(ftdi); } static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) -- 2.34.1