* [PATCH] Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()"
@ 2014-05-29 7:01 Daeseok Youn
2014-05-29 16:11 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Daeseok Youn @ 2014-05-29 7:01 UTC (permalink / raw)
To: lidza.louina, gregkh
Cc: markh, dan.carpenter, driverdev-devel, devel, linux-kernel
This reverts commit 0ade4a34fd439d62df46937e8f3e584eb0879579.
This patch removes kfree for serial_ports in dgap_tty_register_ports()
if the "brd->printer_ports" allocation fails and serial_ports may be
freed by calling dgap_tty_uninit() within other patch.
That patch has an error handling but incomplete cleanup
so it need to call kfree() for brd->serial_ports in
dgap_tty_register_ports().
Conflicts:
drivers/staging/dgap/dgap.c
---
drivers/staging/dgap/dgap.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 48c13c9..f0556ee 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -4145,8 +4145,10 @@ static int dgap_tty_register_ports(struct board_t *brd)
brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
GFP_KERNEL);
- if (!brd->printer_ports)
+ if (brd->printer_ports == NULL) {
+ kfree(brd->serial_ports);
return -ENOMEM;
+ }
for (i = 0; i < brd->nasync; i++) {
tty_port_init(&brd->serial_ports[i]);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()"
2014-05-29 7:01 [PATCH] Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()" Daeseok Youn
@ 2014-05-29 16:11 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2014-05-29 16:11 UTC (permalink / raw)
To: Daeseok Youn
Cc: lidza.louina, devel, driverdev-devel, linux-kernel, dan.carpenter
On Thu, May 29, 2014 at 04:01:27PM +0900, Daeseok Youn wrote:
> This reverts commit 0ade4a34fd439d62df46937e8f3e584eb0879579.
>
> This patch removes kfree for serial_ports in dgap_tty_register_ports()
> if the "brd->printer_ports" allocation fails and serial_ports may be
> freed by calling dgap_tty_uninit() within other patch.
> That patch has an error handling but incomplete cleanup
> so it need to call kfree() for brd->serial_ports in
> dgap_tty_register_ports().
>
> Conflicts:
>
> drivers/staging/dgap/dgap.c
> ---
> drivers/staging/dgap/dgap.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
-ENOSIGNEDOFFBY :(
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-29 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29 7:01 [PATCH] Revert "staging: dgap: remove unneeded kfree() in dgap_tty_register_ports()" Daeseok Youn
2014-05-29 16:11 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox