From patchwork Tue Apr 9 09:43:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2414101 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 074CEDF25A for ; Tue, 9 Apr 2013 09:43:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935235Ab3DIJnf (ORCPT ); Tue, 9 Apr 2013 05:43:35 -0400 Received: from mail-bk0-f47.google.com ([209.85.214.47]:34621 "EHLO mail-bk0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935034Ab3DIJne (ORCPT ); Tue, 9 Apr 2013 05:43:34 -0400 Received: by mail-bk0-f47.google.com with SMTP id ik5so3445756bkc.20 for ; Tue, 09 Apr 2013 02:43:33 -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=peuxcWUXJ3Sz8Lfnkwsycl1yHQdD96kdZk0qhbQZhX0=; b=xW4hqxNtp5hYc/hyhwuJyK5XWjArmsUUTmSZAXMnCsAinxBR7LQIa79m+dl1c3lvLj ElWpQz1HbKEaYPMT5ProwEcoL0Wb3sORLY01ocEolNrSnxT1sIlrDSGzJNECIGa6k+/g dRicQmyx1nJhLTbfs3MdcNY87dINY/kULzSlARRDpJzTVto4NkU4w3S7WPvZ+BkRaXA5 i49STxvcJsS3aqS/KZJyVVnaNmS8RCfazIqy/uHuQ9u2S0LdJ3yUyTaSYHAYuXsvZBv3 T97b04yD7gppAS7henQ/jnwDgYpIQnLVxbUmCxFMlztTeoV9SaM2y3bG9R4WtcQBzkwU H2eg== MIME-Version: 1.0 X-Received: by 10.204.135.12 with SMTP id l12mr5055486bkt.101.1365500613091; Tue, 09 Apr 2013 02:43:33 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 9 Apr 2013 02:43:33 -0700 (PDT) Date: Tue, 9 Apr 2013 17:43:33 +0800 Message-ID: Subject: [PATCH] [media] rc: winbond-cir: fix potential double free in wbcir_probe() From: Wei Yongjun To: david@hardeman.nu, 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/winbond-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/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 535a18d..87af2d3 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -1151,6 +1151,7 @@ exit_release_wbase: release_region(data->wbase, WAKEUP_IOMEM_LEN); exit_unregister_device: rc_unregister_device(data->dev); + data->dev = NULL; exit_free_rc: rc_free_device(data->dev); exit_unregister_led: