* [PATCH] staging: dgnc: Fix a NULL pointer dereference
@ 2016-05-04 5:41 Daeseok Youn
2016-05-04 5:56 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Daeseok Youn @ 2016-05-04 5:41 UTC (permalink / raw)
To: lidza.louina
Cc: markh, gregkh, driverdev-devel, devel, linux-kernel,
kernel-janitors, dan.carpenter
The error handling for print_drive after calling tty_alloc_driver()
was needed. But there was error handling but too late for this.
Error handling code moved after tty_alloc_driver() call.
Fixes: 60b3109e5e2d ("staging: dgnc: use tty_alloc_driver instead of kcalloc")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
drivers/staging/dgnc/dgnc_tty.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 2cecdb0..392d532 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -224,6 +224,11 @@ int dgnc_tty_register(struct dgnc_board *brd)
TTY_DRIVER_DYNAMIC_DEV |
TTY_DRIVER_HARDWARE_BREAK);
+ if (IS_ERR(brd->print_driver)) {
+ rc = PTR_ERR(brd->print_driver);
+ goto unregister_serial_driver;
+ }
+
snprintf(brd->print_name, MAXTTYNAMELEN, "pr_dgnc_%d_", brd->boardnum);
brd->print_driver->name = brd->print_name;
@@ -235,11 +240,6 @@ int dgnc_tty_register(struct dgnc_board *brd)
brd->print_driver->init_termios = DgncDefaultTermios;
brd->print_driver->driver_name = DRVSTR;
- if (IS_ERR(brd->print_driver)) {
- rc = PTR_ERR(brd->print_driver);
- goto unregister_serial_driver;
- }
-
/*
* Entry points for driver. Called by the kernel from
* tty_io.c and n_tty.c.
--
2.8.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: dgnc: Fix a NULL pointer dereference
2016-05-04 5:41 [PATCH] staging: dgnc: Fix a NULL pointer dereference Daeseok Youn
@ 2016-05-04 5:56 ` Greg KH
2016-05-04 5:57 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2016-05-04 5:56 UTC (permalink / raw)
To: Daeseok Youn
Cc: lidza.louina, markh, driverdev-devel, devel, linux-kernel,
kernel-janitors, dan.carpenter
On Wed, May 04, 2016 at 02:41:22PM +0900, Daeseok Youn wrote:
> The error handling for print_drive after calling tty_alloc_driver()
> was needed. But there was error handling but too late for this.
> Error handling code moved after tty_alloc_driver() call.
>
> Fixes: 60b3109e5e2d ("staging: dgnc: use tty_alloc_driver instead of kcalloc")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
> drivers/staging/dgnc/dgnc_tty.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Patch doesn't apply at all, does it need something else to be merged
first?
confused,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: dgnc: Fix a NULL pointer dereference
2016-05-04 5:56 ` Greg KH
@ 2016-05-04 5:57 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2016-05-04 5:57 UTC (permalink / raw)
To: Daeseok Youn
Cc: lidza.louina, markh, driverdev-devel, devel, linux-kernel,
kernel-janitors, dan.carpenter
On Tue, May 03, 2016 at 10:56:09PM -0700, Greg KH wrote:
> On Wed, May 04, 2016 at 02:41:22PM +0900, Daeseok Youn wrote:
> > The error handling for print_drive after calling tty_alloc_driver()
> > was needed. But there was error handling but too late for this.
> > Error handling code moved after tty_alloc_driver() call.
> >
> > Fixes: 60b3109e5e2d ("staging: dgnc: use tty_alloc_driver instead of kcalloc")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> > ---
> > drivers/staging/dgnc/dgnc_tty.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Patch doesn't apply at all, does it need something else to be merged
> first?
Oh nevermind, I tried applying it to the wrong git tree, my fault...
I need some sleep...
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-04 5:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 5:41 [PATCH] staging: dgnc: Fix a NULL pointer dereference Daeseok Youn
2016-05-04 5:56 ` Greg KH
2016-05-04 5:57 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox