isdn: prevent NULL ptr Oops in capi_cmsg2str()
authorTilman Schmidt <tilman@imap.cc>
Sun, 7 Jun 2009 09:09:24 +0000 (09:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jun 2009 07:45:51 +0000 (00:45 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/capi/capiutil.c

index c7c29022a23a5231ceb03fb115f7f29727417d3d..16f2e465e5f90df5e24634ddcdf9849c32313780 100644 (file)
@@ -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;