From patchwork Tue Apr 9 09:43:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2414111 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 960853FD8C for ; Tue, 9 Apr 2013 09:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935246Ab3DIJn4 (ORCPT ); Tue, 9 Apr 2013 05:43:56 -0400 Received: from mail-bk0-f48.google.com ([209.85.214.48]:35744 "EHLO mail-bk0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935034Ab3DIJnz (ORCPT ); Tue, 9 Apr 2013 05:43:55 -0400 Received: by mail-bk0-f48.google.com with SMTP id jf3so3432755bkc.7 for ; Tue, 09 Apr 2013 02:43:54 -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=ib30pJHO2gLfcrbfyihrGtbhbkCGQu/TUfm1db3lUdo=; b=Ad+graDAH9z7/5x8BYWM2jRzIXkrsozWPyUqVqvcelTaPCu0vfVhOSzGJ3cSXlCBQp uqRT9/RKfbo9A+4vBQvm9DdMPuc+3s6pwnXI3n0W4zfK/8lzJArIjJaB65ej6fhyNeOF OrBMgiR0h2n+Fa3EszBdEllvl+BhvpPaAG63XlIjL9F2XaSHrSrBu0LeXde3y+/NbTqr jvF9gtYEfIIp18yMh8SXROfeeANK6TvsdrR2zVCYXXZlhirPjbyYJKLwwFrCyCjIn0Db haEt7c31gI2UCjo5ssUKroaDOnrMQppcl44BE2pOrClACWPdbwNBRt3UU9ziGQkpFw6e yfnw== MIME-Version: 1.0 X-Received: by 10.205.114.136 with SMTP id fa8mr12343907bkc.48.1365500634003; Tue, 09 Apr 2013 02:43:54 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 9 Apr 2013 02:43:53 -0700 (PDT) Date: Tue, 9 Apr 2013 17:43:53 +0800 Message-ID: Subject: [PATCH] [media] rc: ite-cir: fix potential double free in ite_probe() From: Wei Yongjun To: mchehab@redhat.com, matthijs@stdin.nl, ben@decadent.org.uk, david@hardeman.nu, jarod@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/ite-cir.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/ite-cir.c b/drivers/media/rc/ite-cir.c index dd82373..63b4225 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1613,6 +1613,7 @@ exit_release_cir_addr: release_region(itdev->cir_addr, itdev->params.io_region_size); exit_unregister_device: rc_unregister_device(rdev); + rdev = NULL; exit_free_dev_rdev: rc_free_device(rdev); kfree(itdev);