Skip to content

Commit

Permalink
mkiss: Fix error handling in mkiss_open()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Fabio Estevam authored and David S. Miller committed Aug 11, 2015
1 parent 1825545 commit 9d332d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/hamradio/mkiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 9d332d9

Please sign in to comment.