All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: davem@davemloft.net, Karsten Keil <karsten-keil@t-online.de>,
	isdn4linux@listserv.isdn4linux.de,
	i4ldeveloper@listserv.isdn4linux.de,
	Netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] isdn: prevent NULL ptr Oops in capi_cmsg2str()
Date: Sun,  7 Jun 2009 21:09:24 +0200 (CEST)	[thread overview]
Message-ID: <20090607-patch-03.tilman@imap.cc> (raw)
In-Reply-To: <20090607-patch-00.tilman@imap.cc>

The dereferencing of the private pointer cmsg->m in capi_cmsg2str() may
cause an Oops in case of an error, which is particularly inconvenient
as that function is typically used to format an error message. Add a
NULL pointer check to avoid this.

Impact: error handling improvement
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/capi/capiutil.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index c7c2902..16f2e46 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -989,6 +989,8 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg)
 {
 	_cdebbuf *cdb;
 
+	if (!cmsg->m)
+		return NULL;	/* no message */
 	cdb = cdebbuf_alloc();
 	if (!cdb)
 		return NULL;
-- 
1.6.2.1.214.ge986c


WARNING: multiple messages have this Message-ID (diff)
From: Tilman Schmidt <tilman@imap.cc>
To: davem@davemloft.net, Karsten Keil <karsten-keil@t-online.de>,
	isdn4linux@listserv.isdn4linux.de,
	i4ldeveloper@listserv.isdn4linux.de,
	Netdev <netdev@vger.kernel.org>,
	LKML <linux-ker
Subject: [PATCH 3/4] isdn: prevent NULL ptr Oops in capi_cmsg2str()
Date: Sun,  7 Jun 2009 21:09:24 +0200 (CEST)	[thread overview]
Message-ID: <20090607-patch-03.tilman@imap.cc> (raw)
In-Reply-To: <20090607-patch-00.tilman@imap.cc>

The dereferencing of the private pointer cmsg->m in capi_cmsg2str() may
cause an Oops in case of an error, which is particularly inconvenient
as that function is typically used to format an error message. Add a
NULL pointer check to avoid this.

Impact: error handling improvement
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
 drivers/isdn/capi/capiutil.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index c7c2902..16f2e46 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -989,6 +989,8 @@ _cdebbuf *capi_cmsg2str(_cmsg * cmsg)
 {
 	_cdebbuf *cdb;
 
+	if (!cmsg->m)
+		return NULL;	/* no message */
 	cdb = cdebbuf_alloc();
 	if (!cdb)
 		return NULL;
-- 
1.6.2.1.214.ge986c


  parent reply	other threads:[~2009-06-07 19:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-07 19:09 [PATCH 0/4] isdn: patches for 2.6.31 (v2) Tilman Schmidt
2009-06-07 19:09 ` Tilman Schmidt
2009-06-07 19:09 ` [PATCH 2/4] isdn: kerneldoc for capiutil.c Tilman Schmidt
2009-06-07 19:09   ` Tilman Schmidt
2009-06-07 19:09 ` [PATCH 1/4] isdn: rename capi_ctr_reseted() to capi_ctr_down() Tilman Schmidt
2009-06-07 19:09   ` Tilman Schmidt
2009-06-07 19:09 ` [PATCH 4/4] isdn: extend INTERFACE.CAPI document Tilman Schmidt
2009-06-07 19:09   ` Tilman Schmidt
2009-06-07 19:09 ` Tilman Schmidt [this message]
2009-06-07 19:09   ` [PATCH 3/4] isdn: prevent NULL ptr Oops in capi_cmsg2str() Tilman Schmidt
2009-06-08  7:46 ` [PATCH 0/4] isdn: patches for 2.6.31 (v2) 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=20090607-patch-03.tilman@imap.cc \
    --to=tilman@imap.cc \
    --cc=davem@davemloft.net \
    --cc=i4ldeveloper@listserv.isdn4linux.de \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=karsten-keil@t-online.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.