diff mbox

mkiss: Fix error handling in mkiss_open()

Message ID 1439227363-6737-1-git-send-email-fabio.estevam@freescale.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam Aug. 10, 2015, 5:22 p.m. UTC
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(-)

Comments

David Miller Aug. 11, 2015, 4:10 a.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 */