From patchwork Sun May 23 11:02:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tilman Schmidt X-Patchwork-Id: 53319 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9887BB7D24 for ; Sun, 23 May 2010 21:24:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116Ab0EWLY2 (ORCPT ); Sun, 23 May 2010 07:24:28 -0400 Received: from gimli.pxnet.com ([195.227.45.7]:56623 "EHLO mail.pxnet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753709Ab0EWLYZ (ORCPT ); Sun, 23 May 2010 07:24:25 -0400 X-Greylist: delayed 663 seconds by postgrey-1.27 at vger.kernel.org; Sun, 23 May 2010 07:24:23 EDT Received: from xenon.ts.pxnet.com ([10.8.0.10]) (user=ts author=<> mech=DIGEST-MD5 bits=0) by mail.pxnet.com (8.13.8/8.13.8) with ESMTP id o4NBDjms004591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 23 May 2010 13:13:48 +0200 Received: by xenon.ts.pxnet.com (Postfix, from userid 1000) id 7F2F44012B; Sun, 23 May 2010 13:02:08 +0200 (CEST) From: Tilman Schmidt Subject: [PATCH 1/2] isdn/capi: make reset_ctr op truly optional To: Karsten Keil , David Miller CC: Hansjoerg Lipp , Karsten Keil , i4ldeveloper@listserv.isdn4linux.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20100523-patch-gigaset-01.tilman@imap.cc> In-Reply-To: <20100523-patch-gigaset-00.tilman@imap.cc> References: <20100523-patch-gigaset-00.tilman@imap.cc> Date: Sun, 23 May 2010 13:02:08 +0200 (CEST) X-Spam-Score: -1.088 () AWL,BAYES_05,RDNS_NONE X-Scanned-By: MIMEDefang 2.68 on 195.227.45.7 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The CAPI controller operation reset_ctr is marked as optional, and not all drivers do implement it. Add a check to the kernel CAPI whether it exists before trying to call it. Impact: oops prevention Signed-off-by: Tilman Schmidt --- drivers/isdn/capi/kcapi.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c index bd00dce..bde3c88 100644 --- a/drivers/isdn/capi/kcapi.c +++ b/drivers/isdn/capi/kcapi.c @@ -1147,6 +1147,12 @@ load_unlock_out: if (ctr->state == CAPI_CTR_DETECTED) goto reset_unlock_out; + if (ctr->reset_ctr == NULL) { + printk(KERN_DEBUG "kcapi: reset: no reset function\n"); + retval = -ESRCH; + goto reset_unlock_out; + } + ctr->reset_ctr(ctr); retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED);