diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-08-10 14:22:43 -0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-10 21:10:31 -0700 |
commit | 9d332d92a95c9c67abe08b5f7cba64d8fc1e3c76 (patch) | |
tree | 8a659d60ce53b7874e61be581820ab9cb5e9d048 | |
parent | 182554570a3f01457202206ac784b488cd190f75 (diff) |
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 <zy900702@163.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/hamradio/mkiss.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 2ffbf13471d0..216bfd350169 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 */ |