From patchwork Tue Apr 9 09:43:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2414091 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 65F98DF25A for ; Tue, 9 Apr 2013 09:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935222Ab3DIJnL (ORCPT ); Tue, 9 Apr 2013 05:43:11 -0400 Received: from mail-bk0-f54.google.com ([209.85.214.54]:52862 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935034Ab3DIJnK (ORCPT ); Tue, 9 Apr 2013 05:43:10 -0400 Received: by mail-bk0-f54.google.com with SMTP id q16so3531940bkw.13 for ; Tue, 09 Apr 2013 02:43:09 -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=Xz4E3LrqwGr8mQ0pM2iUI7TnxPPMUh8XDWxqRaMzZcQ=; b=R+qqz+a0craT1qcXh/5eUv47E2bdBtC1/xqHFrS5xtki+i+Grze8PxDbS1HQ+MB7of 5IfDIKOLO7+wqBMXPFH5Web0qi474AfOuRpAsB6wq0zS2wSITpHxNJ963Edbfnho2JO5 DHIcBh5G6LofGmaTtrj0fBrq2fpkiKOznZNHQ//ydTwt2CnEPCo0yducueKvRKg/zJYN NlmhIMgYyUc4K5dg+ipk6h3iHQfeWc+v5k1FO1ZE5k8Zjxa4dh8BnpaWPtGkm8YcQX+P 1mTMb3Sfd0eCtvjPkOF4JRApdknSAkUrVNMFPRtr/bbhfqEV72K95O5O6XhxlfOEJGKE vmag== MIME-Version: 1.0 X-Received: by 10.205.104.8 with SMTP id dk8mr12477231bkc.34.1365500589219; Tue, 09 Apr 2013 02:43:09 -0700 (PDT) Received: by 10.204.30.210 with HTTP; Tue, 9 Apr 2013 02:43:09 -0700 (PDT) Date: Tue, 9 Apr 2013 17:43:09 +0800 Message-ID: Subject: [PATCH] [media] rc: ttusbir: fix potential double free in ttusbir_probe() From: Wei Yongjun To: sean@mess.org, 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/ttusbir.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/ttusbir.c b/drivers/media/rc/ttusbir.c index cf0d47f..891762d 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -347,6 +347,7 @@ static int ttusbir_probe(struct usb_interface *intf, return 0; out3: rc_unregister_device(rc); + rc = NULL; out2: led_classdev_unregister(&tt->led); out: