From patchwork Wed May 5 05:58:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 96984 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o455xBU0027863 for ; Wed, 5 May 2010 05:59:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751543Ab0EEF7J (ORCPT ); Wed, 5 May 2010 01:59:09 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:59082 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213Ab0EEF7G (ORCPT ); Wed, 5 May 2010 01:59:06 -0400 Received: by fxm10 with SMTP id 10so3900022fxm.19 for ; Tue, 04 May 2010 22:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=nbS6O7Y4ZpGmEncop3ItSUtlrI0qo0crmUtZchrnqgw=; b=UBhjvAxupsvGcSplXbxEvIJZNik4tskjMpK8Rk6/660ToMz7XyCrPVyqNS42PRpaWR N6U0izrcHOfv1P9a9bbb9oJmKrC7lcWqPIXnTSfMYz8PIoIowgAFyWTIwkvORqBpNuCv aczbVsy680zZl1lRcAlFDBz6MGCbi/jnEehRE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=n5z1urUGHtIgV0N4t0f42snMbEWotwvp+czj1R5Za8j4PRT/OtxnKZDywrOKKfHYyJ 0Wmxl5Ouyx/zAGJjDJeRq6WwxENCSUvHGIyvFD9DRmmUu/xonSNDDf/Q70RZ7lf4qh+G KjFlgCp3LSEwybBNOInHDuhd/ZB7lu8HfxNQE= Received: by 10.223.65.73 with SMTP id h9mr4952255fai.75.1273039144465; Tue, 04 May 2010 22:59:04 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 1sm12842253fks.24.2010.05.04.22.59.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 May 2010 22:59:04 -0700 (PDT) Date: Wed, 5 May 2010 07:58:57 +0200 From: Dan Carpenter To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab Subject: [patch -next] media/mem2mem: dereferencing free memory Message-ID: <20100505055857.GD27064@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 05 May 2010 05:59:12 +0000 (UTC) diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index baf211b..b161d26 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c @@ -871,8 +871,10 @@ static int m2mtest_open(struct file *file) ctx->m2m_ctx = v4l2_m2m_ctx_init(ctx, dev->m2m_dev, queue_init); if (IS_ERR(ctx->m2m_ctx)) { + int ret = PTR_ERR(ctx->m2m_ctx); + kfree(ctx); - return PTR_ERR(ctx->m2m_ctx); + return ret; } atomic_inc(&dev->num_inst);