From patchwork Thu Mar 1 14:45:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 144057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 3DAA31007D5 for ; Fri, 2 Mar 2012 01:46:02 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S37GO-0001Oc-6A; Thu, 01 Mar 2012 14:45:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S37GL-0001No-VQ for kernel-team@lists.ubuntu.com; Thu, 01 Mar 2012 14:45:46 +0000 Received: from 79-78-220-96.dynamic.dsl.as9105.com ([79.78.220.96] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S37GL-0001bP-Pb; Thu, 01 Mar 2012 14:45:45 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [lucid, lucid/fsl-imx51 CVE 1/2] block: Fix io_context leak after clone with CLONE_IO Date: Thu, 1 Mar 2012 14:45:42 +0000 Message-Id: <1330613143-10318-2-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1330613143-10318-1-git-send-email-apw@canonical.com> References: <1330613143-10318-1-git-send-email-apw@canonical.com> Cc: Andy Whitcroft X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Louis Rilling With CLONE_IO, copy_io() increments both ioc->refcount and ioc->nr_tasks. However exit_io_context() only decrements ioc->refcount if ioc->nr_tasks reaches 0. Always call put_io_context() in exit_io_context(). Signed-off-by: Louis Rilling Signed-off-by: Jens Axboe (cherry picked from commit 61cc74fbb87af6aa551a06a370590c9bc07e29d9) CVE-2012-0879 BugLink: http://bugs.launchpad.net/bugs/940743 Signed-off-by: Andy Whitcroft --- block/blk-ioc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/blk-ioc.c b/block/blk-ioc.c index d4ed600..dcd0412 100644 --- a/block/blk-ioc.c +++ b/block/blk-ioc.c @@ -80,8 +80,8 @@ void exit_io_context(void) ioc->aic->exit(ioc->aic); cfq_exit(ioc); - put_io_context(ioc); } + put_io_context(ioc); } struct io_context *alloc_io_context(gfp_t gfp_flags, int node)