From patchwork Tue Apr 9 09:44:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2414121 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 9B1653FD8C for ; Tue, 9 Apr 2013 09:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935310Ab3DIJoc (ORCPT ); Tue, 9 Apr 2013 05:44:32 -0400 Received: from mail-bk0-f43.google.com ([209.85.214.43]:51217 "EHLO mail-bk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935034Ab3DIJoa (ORCPT ); Tue, 9 Apr 2013 05:44:30 -0400 Received: by mail-bk0-f43.google.com with SMTP id jm2so3574528bkc.30 for ; Tue, 09 Apr 2013 02:44:29 -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=YtX5WXSuCHYq62/qUrOvEXyqk5IyWoSYKRyJvF5v4T8=; b=vZO8X2xM6we9MY8bzxsIIpgBj5slmfaKCWW0IKP2GeZc7fU4NXzltou7+6HwwmRsE+ Vk0ekA3hTE70MPceJsdKRngekJ0SmLBWpe6qT+pcmZqN9whB7oaJ8PrNFjV6f1JYZ/1j 1lphOKAYLpKe6DPbYzxgl57r2e2mi613dPgmj7vzK8zNxkT4ag7/9ZVj4MOonKxp8bp+ 1o8TY7hbB45JtMezyRB8Zd5oqyMlgQlwuuP40XfCmkWCYjDHqlIR3yJ0OUDHUFLdOrCV 1sAkOBb3olNnvpKtkmDNBep1KJO8HIhHAtU5xEGyPso8KWpXDF8ZHnV6DRkZ8Jc9ShnC 2BCg== MIME-Version: 1.0 X-Received: by 10.205.1.5 with SMTP id no5mr365918bkb.64.1365500669353; Tue, 09 Apr 2013 02:44:29 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 9 Apr 2013 02:44:29 -0700 (PDT) Date: Tue, 9 Apr 2013 17:44:29 +0800 Message-ID: Subject: [PATCH] [media] rc: nuvoton-cir: fix potential double free in nvt_probe() From: Wei Yongjun To: mchehab@redhat.com, matthijs@stdin.nl, david@hardeman.nu, jarod@redhat.com, ben@decadent.org.uk 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/nuvoton-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/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 40125d7..21ee0dc 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -1107,6 +1107,7 @@ exit_release_cir_addr: release_region(nvt->cir_addr, CIR_IOREG_LENGTH); exit_unregister_device: rc_unregister_device(rdev); + rdev = NULL; exit_free_dev_rdev: rc_free_device(rdev); kfree(nvt);