** Description changed: + == Precise SRU Justification == + The default and max buffer size are set to inappropriate values for the + comedi staging driver. This results in program crashes. Patches have + been submitted upstream to resolve this issue and are currently + available in: + + git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git + staging-next + + I have also received confirmation from the bug reporter and patch author + that they intend to submit these to upstream stable as well. + + The changes are limited to a single staging driver which should minimize + the risk of regression. I have also received positive test confirmation + from the bug reporter that the patches noted below resolve the issue. + + == Fix == + commit 4d7df821 from staging-next needed very minor fixing up when + cherry-picking. commit 234bb3c6 from staging-next cherry-picked + cleanly. The last commit updates the configs: + + commit 4d7df821277e82ebe2fc9c9af07c928a83f572b8 + Author: Ian Abbott <[email protected]> + Date: Fri Apr 13 14:12:53 2012 +0100 + + staging: comedi: Add module parameters for default buffer size + + commit 234bb3c60f1f1489630750aba4adf40154e0bd70 + Author: Ian Abbott <[email protected]> + Date: Fri Apr 13 14:12:54 2012 +0100 + + staging: comedi: Add kernel config for default buffer sizes + + commit 96dddbbb8a9071cd1921575f864a5441fd7662a7 + Author: Leann Ogasawara <[email protected]> + Date: Fri Apr 13 20:40:29 2012 -0700 + + UBUNTU: [Config] Set CONFIG_COMEDI_DEFAULT_BUF_[SIZE_KB,MAXSIZE_KB] + + I've also pushed these to a branch if you'd prefer to pull from there: + + The following changes since commit + 4767f8d1efe2d8bc94cf6d6937c0a0d5328e6e08: + + Linux 3.2.15 (2012-04-14 06:50:30 -0600) + + are available in the git repository at: + + git://kernel.ubuntu.com/ogasawara/ubuntu-precise lp981234 + + for you to fetch changes up to 2bf208c4572e3ac2e7c364c4a26d4ecfd15e0412: + + UBUNTU: [Config] Set CONFIG_COMEDI_DEFAULT_BUF_[SIZE_KB,MAXSIZE_KB] + (2012-04-14 13:05:43 -0700) + + ---------------------------------------------------------------- + Ian Abbott (2): + UBUNTU: SAUCE: staging: comedi: Add module parameters for default buffer size + UBUNTU: SAUCE: staging: comedi: Add kernel config for default buffer sizes + + Leann Ogasawara (1): + UBUNTU: [Config] Set CONFIG_COMEDI_DEFAULT_BUF_[SIZE_KB,MAXSIZE_KB] + + debian.master/config/config.common.ubuntu | 2 ++ + drivers/staging/comedi/Kconfig | 20 ++++++++++++++++++++ + drivers/staging/comedi/comedi_fops.c | 27 ++++++++++++++++++++++++--- + drivers/staging/comedi/drivers.c | 15 +++++++++------ + drivers/staging/comedi/internal.h | 5 ++++- + 5 files changed, 59 insertions(+), 10 deletions(-) + + == Original Bug Description == There asynchronous buffer for the COMEDI drivers is only 65k and is hard coded in the kernel. With slower computers and slow userspace programs there is virtually always a buffer overflow which makes it impossible to run these programs, especially with DAQ cards which have a high resolution or those with high sampling rate. I'm attaching a patch which has been submitted and accepted upstream. Below the confirmation e-mail from Gregkh: Return-Path: <[email protected]> Delivered-To: [email protected] Envelope-To: [email protected] Received: (qmail 39856 invoked from network); 13 Apr 2012 18:20:21 -0000 Received: from as001.apm-internet.net (85.119.248.19) - by mail003.apm-internet.net with SMTP; 13 Apr 2012 18:20:21 -0000 + by mail003.apm-internet.net with SMTP; 13 Apr 2012 18:20:21 -0000 Received: (qmail 73709 invoked from network); 13 Apr 2012 18:20:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on - as001.apm-internet.net + as001.apm-internet.net X-Spam-Score: -0.1 - X-Spam-Report: - * -0.1 SPF_PASS SPF database pass + X-Spam-Report: + * -0.1 SPF_PASS SPF database pass X-Spam-Relay-Country: GB GB US US Received: from av002.apm-internet.net (85.119.248.59) - by as001.apm-internet.net with SMTP; 13 Apr 2012 18:20:20 -0000 + by as001.apm-internet.net with SMTP; 13 Apr 2012 18:20:20 -0000 Received: (qmail 98427 invoked from network); 13 Apr 2012 18:20:20 -0000 X-AV-Scan: clean Received: from relay004.apm-internet.net (85.119.248.7) - by av002.apm-internet.net with SMTP; 13 Apr 2012 18:20:20 -0000 + by av002.apm-internet.net with SMTP; 13 Apr 2012 18:20:20 -0000 Received: (qmail 73444 invoked from network); 13 Apr 2012 18:20:19 -0000 Received: from mail-pb0-f41.google.com (209.85.160.41) - by relay004.apm-internet.net with ESMTPS (RC4-SHA encrypted); 13 Apr 2012 18:20:20 -0000 + by relay004.apm-internet.net with ESMTPS (RC4-SHA encrypted); 13 Apr 2012 18:20:20 -0000 X-APM-IP: 209.85.160.41 X-APM-Score: -2 Received-SPF: pass (relay004.apm-internet.net: SPF record at _spf.google.com designates 209.85.160.41 as permitted sender) Received: by pbcup15 with SMTP id up15so3700835pbc.28 - for <[email protected]>; Fri, 13 Apr 2012 11:20:17 -0700 (PDT) + for <[email protected]>; Fri, 13 Apr 2012 11:20:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=google.com; s=20120113; - h=subject:to:from:date:message-id:mime-version:content-type - :content-transfer-encoding:x-gm-message-state; - bh=F0mM6Wrc1iIO+RcwOJc25lkJE4nAd4Fgxj+5MCNNxDU=; - b=SeejiQ22iVQnt8WizuUPzUg9VqmG1DLqH6nB5r3Xcc90PcIxRvsAjMs9/bykNbv1ol - lM4/AfL+un7p/R5P1Yv5GcRg8YWaocDMcsFyrTWaMx3BPonEkXK4WT1Lhw+IBiydEIpo - 3DLcTivSmAep8yiqfMx4zB+jn4jRyKwNLL5hfYi//YOLAMjKpLFqmMP6G5Dlc/Kp9PTf - s27/qyU/uX6wk6PHs4tjmvmX+pV5zcQa77U1CDSoCtj90qJsIwtrODVsqPvh9ZqBD6Mv - OR/bRYcKKlMGYYmtnMVs3sp+znE0ZCkXnhlPIVZqy7+rV5K3IpQP14tRgdIZdS8u4FNK - VqJw== + d=google.com; s=20120113; + h=subject:to:from:date:message-id:mime-version:content-type + :content-transfer-encoding:x-gm-message-state; + bh=F0mM6Wrc1iIO+RcwOJc25lkJE4nAd4Fgxj+5MCNNxDU=; + b=SeejiQ22iVQnt8WizuUPzUg9VqmG1DLqH6nB5r3Xcc90PcIxRvsAjMs9/bykNbv1ol + lM4/AfL+un7p/R5P1Yv5GcRg8YWaocDMcsFyrTWaMx3BPonEkXK4WT1Lhw+IBiydEIpo + 3DLcTivSmAep8yiqfMx4zB+jn4jRyKwNLL5hfYi//YOLAMjKpLFqmMP6G5Dlc/Kp9PTf + s27/qyU/uX6wk6PHs4tjmvmX+pV5zcQa77U1CDSoCtj90qJsIwtrODVsqPvh9ZqBD6Mv + OR/bRYcKKlMGYYmtnMVs3sp+znE0ZCkXnhlPIVZqy7+rV5K3IpQP14tRgdIZdS8u4FNK + VqJw== Received: by 10.68.132.36 with SMTP id or4mr6543286pbb.115.1334341217157; - Fri, 13 Apr 2012 11:20:17 -0700 (PDT) + Fri, 13 Apr 2012 11:20:17 -0700 (PDT) Return-Path: <[email protected]> Received: from localhost (c-67-168-183-230.hsd1.wa.comcast.net. [67.168.183.230]) - by mx.google.com with ESMTPS id vh10sm9365834pbc.29.2012.04.13.11.20.15 - (version=TLSv1/SSLv3 cipher=OTHER); - Fri, 13 Apr 2012 11:20:16 -0700 (PDT) + by mx.google.com with ESMTPS id vh10sm9365834pbc.29.2012.04.13.11.20.15 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 13 Apr 2012 11:20:16 -0700 (PDT) Subject: patch "staging: comedi: Add kernel config for default buffer sizes" added to staging tree To: [email protected],[email protected],[email protected] From: <[email protected]> Date: Fri, 13 Apr 2012 11:20:08 -0700 Message-ID: <[email protected]> MIME-Version: 1.0 Content-Type: text/plain; charset=ASCII Content-Transfer-Encoding: 8bit X-Gm-Message-State: ALoCoQlEvqUZ2Xtd66ofDeuWg5qV6v8uW82oXq3rGRQDbKuADvj2uoIK3rhnUuQ/d7ByKS81LT8s - This is a note to let you know that I've just added the patch titled - staging: comedi: Add kernel config for default buffer sizes + staging: comedi: Add kernel config for default buffer sizes to my staging git tree which can be found at - git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git + git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git in the staging-next branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will also will be merged in the next major kernel release during the merge window. If you have any questions about this process, please let me know. - From 234bb3c60f1f1489630750aba4adf40154e0bd70 Mon Sep 17 00:00:00 2001 From: Ian Abbott <[email protected]> Date: Fri, 13 Apr 2012 14:12:54 +0100 Subject: staging: comedi: Add kernel config for default buffer sizes Allow the default values for the module parameters for the default initial buffer size and default maximum buffer size to be specified in the kernel configuration. I'm not sure what the defaults for the defaults for the defaults should be, but 64 KiB seems to small, so I used values suggested by Bernd Porr, which are 2048 KiB for the default initial buffer size and 20480 for the default maximum buffer size. Signed-off-by: Ian Abbott <[email protected]> Cc: Bernd Porr <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- - drivers/staging/comedi/Kconfig | 20 ++++++++++++++++++++ - drivers/staging/comedi/comedi_fops.c | 12 +++++------- - 2 files changed, 25 insertions(+), 7 deletions(-) + drivers/staging/comedi/Kconfig | 20 ++++++++++++++++++++ + drivers/staging/comedi/comedi_fops.c | 12 +++++------- + 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 9037d02..a1cf0b0 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -14,6 +14,26 @@ config COMEDI_DEBUG - This is an option for use by developers; most people should - say N here. This enables comedi core and driver debugging. - + This is an option for use by developers; most people should + say N here. This enables comedi core and driver debugging. + +config COMEDI_DEFAULT_BUF_SIZE_KB + int "Comedi default initial asynchronous buffer size in KiB" + default "2048" + depends on COMEDI != n + ---help--- + This is the default asynchronous buffer size which is used for + commands running in the background in kernel space. This + defaults to 2048 KiB of memory so that a 16 channel card + running at 10 kHz has of 2-4 seconds of buffer. + +config COMEDI_DEFAULT_BUF_MAXSIZE_KB + int "Comedi default maximum asynchronous buffer size in KiB" + default "20480" + depends on COMEDI != n + ---help--- + This is the default maximum asynchronous buffer size which can + be requested by a userspace program without root privileges. + This is set to 20480 KiB so that a fast I/O card with 16 + channels running at 100 kHz has 2-4 seconds of buffer. + - menuconfig COMEDI_MISC_DRIVERS - tristate "Comedi misc drivers" - depends on COMEDI + menuconfig COMEDI_MISC_DRIVERS + tristate "Comedi misc drivers" + depends on COMEDI diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index ef7bbe4..3222ac6 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -55,9 +55,6 @@ MODULE_AUTHOR("http://www.comedi.org"); - MODULE_DESCRIPTION("Comedi core module"); - MODULE_LICENSE("GPL"); - + MODULE_DESCRIPTION("Comedi core module"); + MODULE_LICENSE("GPL"); + -#define DEFAULT_BUF_MAXSIZE_KB 64 -#define DEFAULT_BUF_SIZE_KB 64 - - #ifdef CONFIG_COMEDI_DEBUG - int comedi_debug; - EXPORT_SYMBOL(comedi_debug); + #ifdef CONFIG_COMEDI_DEBUG + int comedi_debug; + EXPORT_SYMBOL(comedi_debug); @@ -78,17 +75,18 @@ MODULE_PARM_DESC(comedi_num_legacy_minors, - "number of comedi minor devices to reserve for non-auto-configured devices (default 0)" - ); - + "number of comedi minor devices to reserve for non-auto-configured devices (default 0)" + ); + -unsigned int comedi_default_buf_size_kb = DEFAULT_BUF_SIZE_KB; +unsigned int comedi_default_buf_size_kb = CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB; - module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(comedi_default_buf_size_kb, - "default asynchronous buffer size in KiB (default " + module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR); + MODULE_PARM_DESC(comedi_default_buf_size_kb, + "default asynchronous buffer size in KiB (default " - __MODULE_STRING(DEFAULT_BUF_SIZE_KB) ")"); + __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB) ")"); - + -unsigned int comedi_default_buf_maxsize_kb = DEFAULT_BUF_MAXSIZE_KB; +unsigned int comedi_default_buf_maxsize_kb + = CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB; - module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR); - MODULE_PARM_DESC(comedi_default_buf_maxsize_kb, - "default maximum size of asynchronous buffer in KiB (default " + module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR); + MODULE_PARM_DESC(comedi_default_buf_maxsize_kb, + "default maximum size of asynchronous buffer in KiB (default " - __MODULE_STRING(DEFAULT_BUF_MAXSIZE_KB) ")"); + __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")"); - - static DEFINE_SPINLOCK(comedi_file_info_table_lock); - static struct comedi_device_file_info - -- + + static DEFINE_SPINLOCK(comedi_file_info_table_lock); + static struct comedi_device_file_info + -- 1.7.10 ProblemType: Bug DistroRelease: Ubuntu 12.04 Package: linux-image-3.2.0-23-generic-pae 3.2.0-23.36 ProcVersionSignature: Ubuntu 3.2.0-23.36-generic-pae 3.2.14 Uname: Linux 3.2.0-23-generic-pae i686 AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24. ApportVersion: 2.0.1-0ubuntu2 Architecture: i386 AudioDevicesInUse: - USER PID ACCESS COMMAND - /dev/snd/controlC0: bp1 1761 F.... pulseaudio + USER PID ACCESS COMMAND + /dev/snd/controlC0: bp1 1761 F.... pulseaudio CRDA: Error: [Errno 2] No such file or directory Card0.Amixer.info: - Card hw:0 'Intel'/'HDA Intel at 0xfdff8000 irq 45' - Mixer name : 'Realtek ALC888' - Components : 'HDA:10ec0888,1019e619,00100001' - Controls : 44 - Simple ctrls : 21 + Card hw:0 'Intel'/'HDA Intel at 0xfdff8000 irq 45' + Mixer name : 'Realtek ALC888' + Components : 'HDA:10ec0888,1019e619,00100001' + Controls : 44 + Simple ctrls : 21 Date: Fri Apr 13 23:32:26 2012 HibernationDevice: RESUME=UUID=b6911a72-ca8c-451f-980b-5f16df4e94f3 InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha i386 (20120201.2) IwConfig: - lo no wireless extensions. - - eth0 no wireless extensions. + lo no wireless extensions. + + eth0 no wireless extensions. MachineType: Acer AcerPower FH ProcEnviron: - LANGUAGE=en_GB:en - TERM=xterm - PATH=(custom, user) - LANG=en_GB.UTF-8 - SHELL=/bin/bash + LANGUAGE=en_GB:en + TERM=xterm + PATH=(custom, user) + LANG=en_GB.UTF-8 + SHELL=/bin/bash ProcFB: 0 radeondrmfb ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-23-generic-pae root=UUID=2a22481e-fd0f-4a5b-adb8-18566a6f8d65 ro quiet splash vt.handoff=7 RelatedPackageVersions: - linux-restricted-modules-3.2.0-23-generic-pae N/A - linux-backports-modules-3.2.0-23-generic-pae N/A - linux-firmware 1.79 + linux-restricted-modules-3.2.0-23-generic-pae N/A + linux-backports-modules-3.2.0-23-generic-pae N/A + linux-firmware 1.79 RfKill: - + SourcePackage: linux UpgradeStatus: No upgrade log present (probably fresh install) UserAsoundrc: - pcm.fileout { - type empty - slave.pcm "tee:default,'/tmp/out.raw',raw" - # 48000 S16_LE 2ch (aplay -t raw -f dat) - } + pcm.fileout { + type empty + slave.pcm "tee:default,'/tmp/out.raw',raw" + # 48000 S16_LE 2ch (aplay -t raw -f dat) + } dmi.bios.date: 03/03/2007 dmi.bios.vendor: Phoenix Technologies, LTD dmi.bios.version: R01-B4 dmi.board.name: E946GZ dmi.board.vendor: Acer dmi.chassis.type: 3 dmi.chassis.vendor: Broadwater dmi.chassis.version: 946GZT-AM dmi.modalias: dmi:bvnPhoenixTechnologies,LTD:bvrR01-B4:bd03/03/2007:svnAcer:pnAcerPowerFH:pvrR01-B4:rvnAcer:rnE946GZ:rvr:cvnBroadwater:ct3:cvr946GZT-AM: dmi.product.name: AcerPower FH dmi.product.version: R01-B4 dmi.sys.vendor: Acer
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/981234 Title: buffer overflows in comedi drivers To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/981234/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
