* [PATCH] mkiss: Fix error handling in mkiss_open()
@ 2015-08-10 17:22 Fabio Estevam
2015-08-11 4:10 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2015-08-10 17:22 UTC (permalink / raw)
To: davem; +Cc: netdev, zy900702, Fabio Estevam
If register_netdev() fails we are not propagating the error and
we return success because ax_open() succeeded previously.
Fix this by checking the return value of ax_open() and
register_netdev() and propagate the error in case of failure.
Reported-by: RUC_Soft_Sec <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/net/hamradio/mkiss.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 2ffbf13..216bfd3 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -728,11 +728,12 @@ static int mkiss_open(struct tty_struct *tty)
dev->type = ARPHRD_AX25;
/* Perform the low-level AX25 initialization. */
- if ((err = ax_open(ax->dev))) {
+ err = ax_open(ax->dev);
+ if (err)
goto out_free_netdev;
- }
- if (register_netdev(dev))
+ err = register_netdev(dev);
+ if (err)
goto out_free_buffers;
/* after register_netdev() - because else printk smashes the kernel */
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mkiss: Fix error handling in mkiss_open()
2015-08-10 17:22 [PATCH] mkiss: Fix error handling in mkiss_open() Fabio Estevam
@ 2015-08-11 4:10 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-08-11 4:10 UTC (permalink / raw)
To: fabio.estevam; +Cc: netdev, zy900702
From: Fabio Estevam <fabio.estevam@freescale.com>
Date: Mon, 10 Aug 2015 14:22:43 -0300
> If register_netdev() fails we are not propagating the error and
> we return success because ax_open() succeeded previously.
>
> Fix this by checking the return value of ax_open() and
> register_netdev() and propagate the error in case of failure.
>
> Reported-by: RUC_Soft_Sec <zy900702@163.com>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-11 4:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 17:22 [PATCH] mkiss: Fix error handling in mkiss_open() Fabio Estevam
2015-08-11 4:10 ` David Miller
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).