From patchwork Tue Apr 9 09:47:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2414161 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A49A1DFB79 for ; Tue, 9 Apr 2013 09:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937213Ab3DIJrq (ORCPT ); Tue, 9 Apr 2013 05:47:46 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:54968 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933110Ab3DIJrn (ORCPT ); Tue, 9 Apr 2013 05:47:43 -0400 Received: by mail-bk0-f50.google.com with SMTP id jg1so3537764bkc.37 for ; Tue, 09 Apr 2013 02:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=Wx9xNkimc34xrY9b5Z7PlhJmA/w1DjwbSMdk5pcGLhY=; b=igrBUKu2RocoFOiwkPSM7aCqyngCjgmyPXbRj/Ep2d0LMnxGZ7RQrxfmAMnizxGbD0 +j/Su5DbBCkB+3WKcRAnoKnNQuI8vEqAlWiWSOcHW31m5UIW+/7B3bURAIKspDR4cdx/ w9xR35ybgjQtHPdmdRbcG3G6bDzU8MrRBTzCdzYK1xZgGn50+R/zgCKbOADczZi/Hyog S8p374CYfOhtpxK9hLbjDlPL2SoYFf/kgnK7HLL2s6dk+ju5T4XPqWl5aHPRgHBwKWs8 yaMCy8KHLjnec67GAnIZgGJ9Yhj4lEEn8oAJmgnV8DhOofThQvQJHpXS6apSSAWCbWCV sPKA== MIME-Version: 1.0 X-Received: by 10.205.1.5 with SMTP id no5mr369954bkb.64.1365500862499; Tue, 09 Apr 2013 02:47:42 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 9 Apr 2013 02:47:42 -0700 (PDT) Date: Tue, 9 Apr 2013 17:47:42 +0800 Message-ID: Subject: [PATCH] [media] rc: ene_ir: fix potential double free in ene_probe() From: Wei Yongjun To: maximlevitsky@gmail.com, mchehab@redhat.com Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Wei Yongjun Since rc_unregister_device() frees its argument, the subsequently call to rc_free_device() on the same variable will cause a double free bug. Fix by set argument to NULL, thus when fall through to rc_free_device(), nothing will be done there. Signed-off-by: Wei Yongjun --- drivers/media/rc/ene_ir.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index ee6c984..ed184f6 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -1098,6 +1098,7 @@ exit_release_hw_io: release_region(dev->hw_io, ENE_IO_SIZE); exit_unregister_device: rc_unregister_device(rdev); + rdev = NULL; exit_free_dev_rdev: rc_free_device(rdev); kfree(dev);