mkiss: Fix error handling in mkiss_open()

This change “mkiss: Fix error handling in mkiss_open()” in Linux kernel is authored by Fabio Estevam <fabio.estevam [at]> on Mon Aug 10 14:22:43 2015 -0300.

mkiss: Fix error handling in mkiss_open()

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 <>
Signed-off-by: Fabio Estevam <>
Signed-off-by: David S. Miller <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 9d332d9.

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

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

The commit for this change in Linux stable tree is 9d332d9 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *