mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russ Gorby <russ.gorby@intel.com>
To: Greg Kroah-Hartman <gregkh@suse.de>,
	Russ Gorby <russ.gorby@intel.com>,
	linux-kernel@vger.kernel.org
Cc: suhail.ahmed@intel.com, russ.gorby@intel.com
Subject: [PATCH 5/5] tty: n_gsm: Fixed NULL ptr OOPs in tty_write_room()
Date: Fri,  3 Jun 2011 12:03:41 -0700	[thread overview]
Message-ID: <1307127821-21665-6-git-send-email-russ.gorby@intel.com> (raw)
In-Reply-To: <[PATCH 0/5] N_GSM patchset : 06/03/2011>

We saw a case where gsmld_output was called after the MUX
was shutdown. In this case gsm->tty was null so tty_write_room(NULL)
was called which resulted in an exception.

checked for gsm->tty == NULL in gsmld_output()

Signed-off-by: Russ Gorby <russ.gorby@intel.com>
---
 drivers/tty/n_gsm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 22c844d..2908199 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2168,6 +2168,8 @@ EXPORT_SYMBOL_GPL(gsm_alloc_mux);
 
 static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len)
 {
+	if (!gsm->tty)
+		return -ENXIO;
 	if (tty_write_room(gsm->tty) < len) {
 		set_bit(TTY_DO_WRITE_WAKEUP, &gsm->tty->flags);
 		return -ENOSPC;
-- 
1.7.0.4


  parent reply	other threads:[~2011-06-03 19:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[PATCH 0/5] N_GSM patchset : 06/03/2011>
2011-06-03 19:03 ` [PATCH 0/5] N_GSM patchset : 06/03/2011 Russ Gorby
2011-06-03 19:03 ` [PATCH 1/5] tty: n_gsm: Add raw-ip support Russ Gorby
2011-06-06  9:28   ` Alan Cox
2011-06-06 19:50     ` Gorby, Russ
2011-06-03 19:03 ` [PATCH 2/5] tty: n_gsm: expose gsmtty device nodes at ldisc open time Russ Gorby
2011-06-03 22:02   ` Alan Cox
2011-06-03 19:03 ` [PATCH 3/5] tty: n_gsm: Added refcount usage to gsm_mux and gsm_dlci structs Russ Gorby
2011-06-03 22:08   ` Alan Cox
2011-06-03 19:03 ` [PATCH 4/5] tty: n_gsm: initiate close of all DLCIs during mux shutdown Russ Gorby
2011-06-03 22:05   ` Alan Cox
2011-06-06 17:09     ` Gorby, Russ
2011-06-03 19:03 ` Russ Gorby [this message]
2011-06-03 22:10   ` [PATCH 5/5] tty: n_gsm: Fixed NULL ptr OOPs in tty_write_room() Alan Cox
2011-06-06 17:13     ` Gorby, Russ

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=1307127821-21665-6-git-send-email-russ.gorby@intel.com \
    --to=russ.gorby@intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhail.ahmed@intel.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

all inboxes | Powered by JetHome®