From: Fabio Estevam <fabio.estevam@freescale.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <zy900702@163.com>,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH] mkiss: Fix error handling in mkiss_open()
Date: Mon, 10 Aug 2015 14:22:43 -0300 [thread overview]
Message-ID: <1439227363-6737-1-git-send-email-fabio.estevam@freescale.com> (raw)
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
next reply other threads:[~2015-08-10 17:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 17:22 Fabio Estevam [this message]
2015-08-11 4:10 ` [PATCH] mkiss: Fix error handling in mkiss_open() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439227363-6737-1-git-send-email-fabio.estevam@freescale.com \
--to=fabio.estevam@freescale.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=zy900702@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).