From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Yenya Kasprzak <kas@fi.muni.cz>,
linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH 1/1] Char: moxa, fix refcounting in moxa_poll_port
Date: Sun, 15 Mar 2009 10:37:24 +0100 [thread overview]
Message-ID: <1237109844-3866-1-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <49BCCAE0.6010303@gmail.com>
Repost, sorry, scripts don't understand Reported-by.
--
There is missing tty_kref_put on some paths in moxa_poll_port,
although the reference is always taken. Fix it.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Reported-by: Jan 'Yenya' Kasprzak <kas@fi.muni.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
---
drivers/char/moxa.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 8b0da97..4a4cab7 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1486,11 +1486,11 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
}
if (!handle) /* nothing else to do */
- return 0;
+ goto put;
intr = readw(ip); /* port irq status */
if (intr == 0)
- return 0;
+ goto put;
writew(0, ip); /* ACK port */
ofsAddr = p->tableAddr;
@@ -1499,16 +1499,17 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
ofsAddr + HostStat);
if (!inited)
- return 0;
+ goto put;
if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */
tty_insert_flip_char(tty, 0, TTY_BREAK);
tty_schedule_flip(tty);
}
- tty_kref_put(tty);
if (intr & IntrLine)
moxa_new_dcdstate(p, readb(ofsAddr + FlagStat) & DCD_state);
+put:
+ tty_kref_put(tty);
return 0;
}
--
1.6.2
next prev parent reply other threads:[~2009-03-15 9:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-14 21:36 MOXA I/O errors on 2.6.28+ Jan Kasprzak
2009-03-14 21:42 ` Alan Cox
2009-03-14 22:41 ` Jan Kasprzak
2009-03-15 9:31 ` Jiri Slaby
2009-03-15 9:36 ` [PATCH 1/1] Char: moxa, fix refcounting in moxa_poll_port Jiri Slaby
[not found] ` <20090315105530.6f1782be@lxorguk.ukuu.org.uk>
2009-03-15 11:52 ` Jiri Slaby
2009-03-15 9:37 ` Jiri Slaby [this message]
2009-03-15 15:25 ` Jan Yenya Kasprzak
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=1237109844-3866-1-git-send-email-jirislaby@gmail.com \
--to=jirislaby@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=kas@fi.muni.cz \
--cc=linux-kernel@vger.kernel.org \
/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