linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove()
@ 2020-11-06 19:24 Dan Carpenter
  2020-11-09  9:34 ` Lars Poeschel
  2020-11-09  9:46 ` Miguel Ojeda
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-11-06 19:24 UTC (permalink / raw)
  To: Miguel Ojeda Sandonis, Lars Poeschel; +Cc: linux-kernel, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-09  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 19:24 [PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove() Dan Carpenter
2020-11-09  9:34 ` Lars Poeschel
2020-11-09  9:46 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).