Skip to contentSkip to conversation

serial: liteuart: fix missing drvdata

PATCH Superseded Ilia Sergachev 3 participants 5 messages Nov 15, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: liteuart: fix missing drvdata

drvdata has to be set in _probe() - otherwise platform_get_drvdata() causes null pointer dereference BUG in _remove()

---
 drivers/tty/serial/liteuart.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serial/liteuart.c +2 -0
index dbc0559a9157..f075f4ff5fcf 100644
@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
 	port->line = dev_id;
 	spin_lock_init(&port->lock);
 
+	platform_set_drvdata(pdev, port);
+
 	return uart_add_one_port(&liteuart_driver, &uart->port);
 }
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 23 lines · Ilia Sergachev

drvdata has to be set in _probe() - otherwise platform_get_drvdata() causes null pointer dereference BUG in _remove()

---
 drivers/tty/serial/liteuart.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serial/liteuart.c +2 -0
index dbc0559a9157..f075f4ff5fcf 100644
@@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
 	port->line = dev_id;
 	spin_lock_init(&port->lock);
 
+	platform_set_drvdata(pdev, port);
+
 	return uart_add_one_port(&liteuart_driver, &uart->port);
 }
 
Signature · 1 line
2.25.1

What commit does this fix?

thanks,

greg k-h

#2 lore raw

I'd say 1da81e5562fac8286567422cc56a7fbd0dc646d4 - where liteuart_probe() and liteuart_remove() were initially implemented.

Ilia

Quoted 5 lines · On Mon, 15 Nov 2021 08:01:55 +0100 Greg Kroah-Hartman…

What commit does this fix?

thanks,

greg k-h

#3 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 2 lines · Ilia Sergachev

I'd say 1da81e5562fac8286567422cc56a7fbd0dc646d4 - where liteuart_probe() and liteuart_remove() were initially implemented.

Can you resend this with that information in the changelog as a "Fixes:" tag please?

thanks,

greg k-h

#4 lore raw
In reply to Ilia Sergachev

On Mon, Nov 15, 2021 at 4:34 AM Ilia Sergachev <[email protected]> wrote:

Besides what Greg asked for, can you rephrase Subject to something like "serial: liteuart: Fix NULL pointer dereference in ->remove()"

Quoted 2 lines

drvdata has to be set in _probe() - otherwise platform_get_drvdata() causes null pointer dereference BUG in _remove()

Don't forget the grammatical period.

Code looks good to me, though.

Signature · 2 lines
With Best Regards,
Andy Shevchenko