Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756068AbZFGTK2 (ORCPT ); Sun, 7 Jun 2009 15:10:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754774AbZFGTJl (ORCPT ); Sun, 7 Jun 2009 15:09:41 -0400 Received: from gimli.pxnet.com ([195.227.45.7]:43714 "EHLO mail.pxnet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbZFGTJf (ORCPT ); Sun, 7 Jun 2009 15:09:35 -0400 From: Tilman Schmidt Subject: [PATCH 3/4] isdn: prevent NULL ptr Oops in capi_cmsg2str() To: davem@davemloft.net, Karsten Keil , isdn4linux@listserv.isdn4linux.de, i4ldeveloper@listserv.isdn4linux.de, Netdev , LKML Message-ID: <20090607-patch-03.tilman@imap.cc> In-Reply-To: <20090607-patch-00.tilman@imap.cc> References: <20090607-patch-00.tilman@imap.cc> Date: Sun, 7 Jun 2009 21:09:24 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1047 Lines: 32 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/