Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3589419pxb; Mon, 24 Jan 2022 12:58:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWpOQSz1reqpaPFr7elIAY31eRmRKHAJ/w3n4Io8R8e7TPlef7orTBBVMabraFpVaUtBqm X-Received: by 2002:a17:902:b78b:b0:14b:1339:58da with SMTP id e11-20020a170902b78b00b0014b133958damr16165212pls.98.1643057904312; Mon, 24 Jan 2022 12:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057904; cv=none; d=google.com; s=arc-20160816; b=rg3B2wM6QwLerem2hkc7Y186vAIm6mtLnJzEYiBMej3iPNJ0ewC5oS7pDtKucQQjt0 Wi76sfr5Vezaswy2uxQ0RBYsePededOF267vyLwqChn0GLAIS9Q5pdkJ5PNeDOLzxcud +2nnP44ySEkHO92p11pW5gXzavsZ+91gr86NPEEP1Lh6vwSbfPbUNrrO95L59H5AnX7i 1CzOxodfT3yRLmvCplyuk3Fl83jvLRLQVqTJINOnQLIRWI0toddDVc1nHHgYrRkIbOUS QW0jx+C/30y3XtBkEWi+YjiobA3Q/PUucsFSKMc7VmYAT/7pbHL2B8V/2fsUQ3VoI3XT FMUw== 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=hqN+rLvWOSGPc+YKriD9iam6XHNegq/4pea0syVht8c=; b=nWpf+Bonj28ZluUf1RwCWhq29BpRwTWxGYXp+H2j7JD3VYb0xZ+qlzj7X0GuhFfgLC +MH8DWizoIzRycKsNAtQFsp1Qk0SYuiOASeF0onj+89VOwp2oTms4mRCDFq4e5CnjslC 0p5cP+7CijCXAKcJQDQ2ZDymXxemLvswEtEjXD+LZuk6rvp5s+kPMGrZD+EA/GtLLsVz j3/7od7JPzfvTjp34nyCO3s3pHJtkiEYBH49iW/wPBonVcJJ+f+WiYEuNGQNg+6vAm9+ FC2ddtvgFU0S1ak5kaKcPtFJpqdjhF5PhCuwz/udCWT5ovk22UxCN3DA1d7iPPwkGdw3 q+wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LSEKNFEI; 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 z11si13884534pgh.786.2022.01.24.12.58.11; Mon, 24 Jan 2022 12:58:24 -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=LSEKNFEI; 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 S1356660AbiAXUTp (ORCPT + 99 others); Mon, 24 Jan 2022 15:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346369AbiAXUCt (ORCPT ); Mon, 24 Jan 2022 15:02:49 -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 D4385C068097; Mon, 24 Jan 2022 11:29:06 -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 CE687B8122F; Mon, 24 Jan 2022 19:29:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E920C340E5; Mon, 24 Jan 2022 19:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052541; bh=WHWLhQoZZnT8xOEB9aZ3Z5FX6A3t6ikqFX0N6eVEfK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LSEKNFEIxzhQWTiutiaSc3x1P9y11BffA/IvKg+ISFUXFerFdLH5QIOSk3dWpqns7 GkPHGhMpUl2QfZL+DcHwDrnHR/eE07N9JDRSwyp6/IyhKdI4qPL1DwGjUNCgFSR+Py /bI3yLm6gIadcT6gNXADQvtyFgmFk4G/vX/LPd3Y= 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.4 092/320] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:41:16 +0100 Message-Id: <20220124183956.872044331@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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 cdee3af33ad7b..684800c66bb4d 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