Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3560100pxb; Mon, 24 Jan 2022 12:13:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzDoGOgqpQvR1GdCI8GERfpFMQbxx/6a/+1tpTxGQICQ1pmJOztzPI1W5ruve8rm3eyzmp X-Received: by 2002:a17:90b:1c12:: with SMTP id oc18mr16857pjb.172.1643055211220; Mon, 24 Jan 2022 12:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055211; cv=none; d=google.com; s=arc-20160816; b=iNZswr6FUt4YL3SoMOWtltG+h8WAytNRP7TCUC5hwSmnVBShLtDelCINdp9D/u6K/5 1Th2Cax86L0tGf8sP8igqX8f1llr+PzZUmDr9Ys/uD/p0iHhqouQ1JZ7mSdPcMxVzXha SvybxDaH7XQEwIi4SRFHMDIxkevTMOg+bqbV3ip+ZAJhM2lPQ9wbylyGN4WedRCnNr01 Sh39rVdfKNIkv4pivYV60ONjoc6y1rsJxMPZk23OMcpSPPHDFASWWNJO4YSZorvK7PGx 9SbHLSL6qd4aq6rloyixIQmRRmVwaSBEvBZFbtak1hGPR1P2pM2dW/AsdqX/BVqTDtHA byPg== 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=eudG2Gwqhf81YSfObBCKvnkqTmrxQHe3d8lInxE4xzg=; b=E/pcoE43zPvp24K+Ox16yfQpuOZpvjhe2FhgWJXParB2NZnXkGDRSt484JZaiINYXw vqMEaugluHV1uZaFupGy+9VOEwmSd58dOVI/rE2aGtc/iDO2BH/zW0gBe4PGVh99EToK N5p7GtxjT5NC4aJLIO38A9vi/1zrDNh5z6KhrTlmJ74kRKCowhK5pLgP38iygYK9Xobn 29AD5w70iEVeq6hareDjv01Ps+WaVKGYM7EpVb3OXg3wV0BUbOMBVHzInbaV6Aa4Yf6r WACPScjRxjRl5IqvwcQMbyoYsR9nVd4wlhN7GBV3lyZPUkOy7V02HJ07wgjQZI1wC9OK Petw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z2CNoVgd; 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 x4si13255776plr.372.2022.01.24.12.13.18; Mon, 24 Jan 2022 12:13:31 -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=z2CNoVgd; 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 S239336AbiAXTQb (ORCPT + 99 others); Mon, 24 Jan 2022 14:16:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59474 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346157AbiAXTFH (ORCPT ); Mon, 24 Jan 2022 14:05:07 -0500 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 6C7D260B9E; Mon, 24 Jan 2022 19:05:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A35FC340E5; Mon, 24 Jan 2022 19:05:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051106; bh=ERGddSawKl59EbEI+JG96l036Vl1vsr6gg1J2QVKdGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z2CNoVgdyZHXgEz8w+l5ZIbt9Q6/tyumQn/AvQe47uzP68i3ila74CGiJwdGCObOy q8fEWh0OglaVJ4hRWE3fRMHirQdnPGqmMxiGN4GDs9zriS2FgI9EerVL/LawarjTxd 4VDBrLty3PNgcN6x+8Et9AY6A2rJ9MnkC24DoMxg= 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.14 056/186] usb: ftdi-elan: fix memory leak on device disconnect Date: Mon, 24 Jan 2022 19:42:11 +0100 Message-Id: <20220124183938.928348578@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 424ff12f3b51f..0231c0cc6481d 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -206,6 +206,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