Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3705546pxb; Mon, 24 Jan 2022 15:54:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjA6AX9hGSC7ULBrMMBSyITdgMkr+m/qvX5Lgjdybjxql3VMmk9/QxjfAvvqIZZ1j9xaRp X-Received: by 2002:a05:6a00:8cc:b0:4a8:262:49e1 with SMTP id s12-20020a056a0008cc00b004a8026249e1mr15724202pfu.28.1643068469789; Mon, 24 Jan 2022 15:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068469; cv=none; d=google.com; s=arc-20160816; b=oMBWyZ4jcQfsqGFEsVbbDEGgOSdXkDE+g7dOf2JNEFZOGpC2sCyLaFC+1/IMd8z5Yt LvLooDykWpIGMQlH9q6wbHq51wrV/G7u++oEb710Z1ZY4mQyIbgDjgGzrFifFqqk0DOp 4q1miYHkzBGyPS6AGGi0HhZbe3RM0+KYiOQHg7K1odTLUyFbs1U68udGPVd5+w9QZn84 4rhD+PzwbRKENtP3bA8jN4WuogfotvJNKkNT9WFufm7OWR6ooqCRXPAIunwA4LrqxsUb 6yd/cBzLaq9g1JlGn8qTVAFmSlsEf+KuaUFvioTqi+zkIdmbWBTjC0na2YyjAVNaZZMG 58MQ== 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=7vVWLCzQjGOzCjpKnIrPIitpU2+eDQSu1Cb1JoXIRlQ=; b=0qEQyPcpxTNlNd+KtCa8RlsQ2kpGweErNzgLqKF41HL0KIMMUxki42KqBV0Ol/LXyd VvgSjPTZFKeQLaYvJzTFWqropWfW2O1Ww+6GAgRaSHmssteyDcNfV11zo+bFHpKHrgiP GHSDpe9K21OxaNhXjgP6fyeu+7pF7632J0uKt0UN7GVZ0aMXwtouWAXzo15RSZ4qLLyI RenDCXZt0y1TeCGeng4s+n4Hj8aXvNWM7njIGqS8eWWgF+50V430r+4VL+C+ylZ2/d0X JYK/BMvwxyvbVdAsPAXYWpg/26FH1fdGJ3pDRC5jUfo2wqs5NrWAPy0QG8rE/+yRW4hg L0oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1pSj3wM4; 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 i63si6371194pge.143.2022.01.24.15.54.17; Mon, 24 Jan 2022 15:54:29 -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=1pSj3wM4; 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 S1386565AbiAXXrd (ORCPT + 99 others); Mon, 24 Jan 2022 18:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1576167AbiAXWzo (ORCPT ); Mon, 24 Jan 2022 17:55:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2938EC0680B6; Mon, 24 Jan 2022 13:09:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id E552AB810BD; Mon, 24 Jan 2022 21:09:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4096C340E5; Mon, 24 Jan 2022 21:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058587; bh=dxGuISMhA9ZEc5sX9BfzvJSZLkFpxqiBwP7QfUE9xig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1pSj3wM4a+31jGMLDDN7TH1lW71Fxy8/fy42D5ArO0Z2a92PXBciB6GPJZekbV+Br mz+O4Bkkog3r0UuYY7ZxsQUwkeGwHIuTk/OuJAinK5nSmOsZ8qbBDug/v3kqehlNq6 mwAvOD1ZvVu58ZQaRhj2DOkGTj8W4v5M7cZy0seQ= 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 5.16 0304/1039] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:34:53 +0100 Message-Id: <20220124184135.531746303@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 e5a8fcdbb78e7..6c38c62d29b26 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -202,6 +202,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