All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Graute <oliver.graute@gmail.com>
To: Li Zetao <lizetao1@huawei.com>
Cc: dmitry.torokhov@gmail.com, u.kleine-koenig@pengutronix.de,
	felix@kaechele.ca, ye.xingchen@zte.com.cn,
	joelselvaraj.oss@gmail.com, andreas@kemnade.info,
	viro@zeniv.linux.org.uk, dario.binacchi@amarulasolutions.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: edt-ft5x06 - fix memleak when rmmod edt_ft5x06
Date: Fri, 11 Oct 2024 15:08:06 +0200	[thread overview]
Message-ID: <ZwkjNoa63gH5U6Mu@graute-think> (raw)
In-Reply-To: <20241010154010.3228450-1-lizetao1@huawei.com>

On 10/10/24, Li Zetao wrote:
> When insmod and rmmod the edt_ft5x06 driver, kmemleak reported a
> memory leak issue:
>   $ modprobe edt-ft5x06
>     edt_ft5x06 0-0004: touchscreen probe failed
>   $ modprobe -r edt-ft5x06
> 
>   unreferenced object 0xffff88810b38c8a0 (size 8):
>     comm "modprobe", pid 23672, jiffies 4295355205
>     hex dump (first 8 bytes):
>       93 00 00 00 00 00 00 00                          ........
>     backtrace (crc a10fb312):
>       [<ffffffff81e12f70>] __kmalloc_noprof+0x2f0/0x3d0
>       [<ffffffff8368c3b6>] __regmap_init+0x2d26/0x4810
>       [<ffffffffc06b4875>] __regmap_init_i2c+0x65/0x80 [regmap_i2c]
>       [<ffffffffc07108a6>] edt_ft5x06_ts_probe+0xd6/0x3410 [edt_ft5x06]
>       [<ffffffff83bd85d1>] i2c_device_probe+0x3c1/0x8b0
> 	...
> 
> This is caused by not releasing the tsdata->regmap resource in time on
> the probe failure path. By adding the err_regmap_exit label, execute
> regmap_exit on the error path to release map resources. However, it
> should be noted that during the ts identify stage, regmap_exit may be
> performed first and then regmap may be reinitialized, so when
> edt_ft5x06_ts_identify() returns an error, it need to check whether the
> regmap initialization failed.
> 
> Fixes: 9dfd9708ffba ("Input: edt-ft5x06 - convert to use regmap API")
> Signed-off-by: Li Zetao <lizetao1@huawei.com>

Reviewed-by: Oliver Graute <oliver.graute@kococonnector.com>

  reply	other threads:[~2024-10-11 13:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 15:40 [PATCH] Input: edt-ft5x06 - fix memleak when rmmod edt_ft5x06 Li Zetao
2024-10-11 13:08 ` Oliver Graute [this message]
2024-10-19  0:20   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZwkjNoa63gH5U6Mu@graute-think \
    --to=oliver.graute@gmail.com \
    --cc=andreas@kemnade.info \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=felix@kaechele.ca \
    --cc=joelselvaraj.oss@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizetao1@huawei.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ye.xingchen@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.