From patchwork Fri Aug 3 07:32:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kbuild test robot X-Patchwork-Id: 174905 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 AA0582C0084 for ; Fri, 3 Aug 2012 17:32:51 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155Ab2HCHcu (ORCPT ); Fri, 3 Aug 2012 03:32:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:20439 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167Ab2HCHcs (ORCPT ); Fri, 3 Aug 2012 03:32:48 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 03 Aug 2012 00:32:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="192797559" Received: from unknown (HELO wfg-t420.sh.intel.com) ([10.255.20.169]) by fmsmga001.fm.intel.com with ESMTP; 03 Aug 2012 00:32:44 -0700 Received: from wfg by wfg-t420.sh.intel.com with local (Exim 4.77) (envelope-from ) id 1SxCNE-0003Jp-Hm; Fri, 03 Aug 2012 15:32:40 +0800 Date: Fri, 3 Aug 2012 15:32:40 +0800 From: Fengguang Wu To: David Miller Cc: netdev@vger.kernel.org, dan.carpenter@oracle.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, joe@perches.com, isdn@linux-pingi.de, linux-kernel@vger.kernel.org Subject: [PATCH v2] isdnloop: fix and simplify isdnloop_init() Message-ID: <20120803073240.GA12723@localhost> References: <20120802110543.GA21745@localhost> <20120802.162156.1853851468137303302.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120802.162156.1853851468137303302.davem@davemloft.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Aug 02, 2012 at 04:21:56PM -0700, David Miller wrote: > From: Fengguang Wu > Date: Thu, 2 Aug 2012 19:05:43 +0800 > > > Fix a buffer overflow bug by removing the revision transform code. > > > > [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7 > > [ 22.097508] isdnloop: (loop0) virtual card added > > [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972 > > [ 22.174400] > > [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129 > > [ 22.624071] Call Trace: > > [ 22.720558] [] ? CallcNew+0x56/0x56 > > [ 22.815248] [] panic+0x110/0x329 > > [ 22.914330] [] ? isdnloop_init+0xaf/0xb1 > > [ 23.014800] [] ? CallcNew+0x56/0x56 > > [ 23.090763] [] __stack_chk_fail+0x2b/0x30 > > [ 23.185748] [] isdnloop_init+0xaf/0xb1 > > > > Signed-off-by: Fengguang Wu > > The reason the "$Revision ..." prefix is there is so that automated > version control tools will change the string automatically when code > is committed in CVS. > > In the GIT era this revision style is obsolete. > > Therefore you might as well just delete this crap altogether. OK. The below updated version will simply print the hard coded revision number as it's unlikely to change any more. Thanks, Fengguang --- isdnloop: fix and simplify isdnloop_init Fix a buffer overflow bug by hard coding the revision number. [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7 [ 22.097508] isdnloop: (loop0) virtual card added [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972 [ 22.174400] [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129 [ 22.624071] Call Trace: [ 22.720558] [] ? CallcNew+0x56/0x56 [ 22.815248] [] panic+0x110/0x329 [ 22.914330] [] ? isdnloop_init+0xaf/0xb1 [ 23.014800] [] ? CallcNew+0x56/0x56 [ 23.090763] [] __stack_chk_fail+0x2b/0x30 [ 23.185748] [] isdnloop_init+0xaf/0xb1 Signed-off-by: Fengguang Wu --- drivers/isdn/isdnloop/isdnloop.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux.orig/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:24:49.047544323 +0800 +++ linux/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:27:39.503548375 +0800 @@ -16,7 +16,6 @@ #include #include "isdnloop.h" -static char *revision = "$Revision: 1.11.6.7 $"; static char *isdnloop_id = "loop0"; MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); @@ -1494,16 +1493,7 @@ isdnloop_addcard(char *id1) static int __init isdnloop_init(void) { - char *p; - char rev[10]; - - if ((p = strchr(revision, ':'))) { - strcpy(rev, p + 1); - p = strchr(rev, '$'); - *p = 0; - } else - strcpy(rev, " ??? "); - printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev); + printk(KERN_NOTICE "isdnloop-ISDN-driver Rev 1.11.6.7\n"); if (isdnloop_id) return (isdnloop_addcard(isdnloop_id));