From patchwork Sat May 15 09:46:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 99809 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 o4F9lY6D028001 for ; Sat, 15 May 2010 09:47:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754128Ab0EOJrB (ORCPT ); Sat, 15 May 2010 05:47:01 -0400 Received: from mgw1.diku.dk ([130.225.96.91]:44228 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753446Ab0EOJq7 (ORCPT ); Sat, 15 May 2010 05:46:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id B268252C532; Sat, 15 May 2010 11:46:58 +0200 (CEST) Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3o4A1FOQgKuW; Sat, 15 May 2010 11:46:54 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id 3283252C4FB; Sat, 15 May 2010 11:46:54 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 552E66DFD17; Sat, 15 May 2010 11:39:43 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 185AD200BE; Sat, 15 May 2010 11:46:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 10B74200BC; Sat, 15 May 2010 11:46:54 +0200 (CEST) Date: Sat, 15 May 2010 11:46:54 +0200 (CEST) From: Julia Lawall To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 4/4] drivers/media/video: Eliminate use after free Message-ID: MIME-Version: 1.0 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]); Sat, 15 May 2010 09:47:34 +0000 (UTC) diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index baf211b..fb73f34 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c @@ -858,6 +858,7 @@ static int m2mtest_open(struct file *file) { struct m2mtest_dev *dev = video_drvdata(file); struct m2mtest_ctx *ctx = NULL; + int err; ctx = kzalloc(sizeof *ctx, GFP_KERNEL); if (!ctx) @@ -871,8 +872,9 @@ 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)) { + err = PTR_ERR(ctx->m2m_ctx); kfree(ctx); - return PTR_ERR(ctx->m2m_ctx); + return err; } atomic_inc(&dev->num_inst);