From: Dan Carpenter <dan.carpenter@oracle.com>
To: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>,
Lars Poeschel <poeschel@lemonage.de>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove()
Date: Fri, 6 Nov 2020 22:24:15 +0300 [thread overview]
Message-ID: <20201106192415.GA2696904@mwanda> (raw)
The kfree() needs to be moved down a line to prevent a use after free.
Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/auxdisplay/lcd2s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/auxdisplay/lcd2s.c b/drivers/auxdisplay/lcd2s.c
index cfa5f86deeef..3eb7f04db6cb 100644
--- a/drivers/auxdisplay/lcd2s.c
+++ b/drivers/auxdisplay/lcd2s.c
@@ -348,8 +348,8 @@ static int lcd2s_i2c_remove(struct i2c_client *i2c)
{
struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c);
- kfree(lcd2s->charlcd);
charlcd_unregister(lcd2s->charlcd);
+ kfree(lcd2s->charlcd);
return 0;
}
--
2.28.0
next reply other threads:[~2020-11-06 19:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 19:24 Dan Carpenter [this message]
2020-11-09 9:34 ` [PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove() Lars Poeschel
2020-11-09 9:46 ` Miguel Ojeda
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=20201106192415.GA2696904@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=poeschel@lemonage.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox