From 7d31acda9f8eaa27e2fd232712f7e1f3e9a79bdb Mon Sep 17 00:00:00 2001 From: Tilman Schmidt Date: Sun, 7 Jun 2009 09:09:24 +0000 Subject: isdn: prevent NULL ptr Oops in capi_cmsg2str() 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 Signed-off-by: David S. Miller --- drivers/isdn/capi/capiutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/isdn/capi') diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index c7c29022a23..16f2e465e5f 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; -- cgit v1.2.3-70-g09d2