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: 17841 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UPV5A-0005or-4V; Tue, 09 Apr 2013 11:43:16 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp id 1UPV58-00072j-Ei; Tue, 09 Apr 2013 11:43:15 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935222Ab3DIJnL (ORCPT + 1 other); 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 X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.4.9.93323 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' CN_TLD 0.1, FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_900_999 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_HTTP_RECEIVED 0, __PHISH_SPEAR_STRUCTURE_1 0, __PHISH_SPEAR_STRUCTURE_2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' 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: