From patchwork Thu Apr 4 20:32:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 2394931 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 E50643FD8C for ; Thu, 4 Apr 2013 20:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764846Ab3DDUct (ORCPT ); Thu, 4 Apr 2013 16:32:49 -0400 Received: from mail.pripojeni.net ([178.22.112.14]:51049 "EHLO smtp.pripojeni.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1764854Ab3DDUcS (ORCPT ); Thu, 4 Apr 2013 16:32:18 -0400 Received: from bellona.site ([178.22.112.2]) by smtp.pripojeni.net (Kerio Connect 7.2.0 patch 1); Thu, 4 Apr 2013 22:32:13 +0200 From: Jiri Slaby To: jirislaby@gmail.com Cc: linux-kernel@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH 2/5] MEDIA: ttusbir, fix double free Date: Thu, 4 Apr 2013 22:32:09 +0200 Message-Id: <1365107532-32721-2-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1365107532-32721-1-git-send-email-jslaby@suse.cz> References: <1365107532-32721-1-git-send-email-jslaby@suse.cz> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org rc_unregister_device already calls rc_free_device to free the passed device. But in one of ttusbir's probe fail paths, we call rc_unregister_device _and_ rc_free_device. This is wrong and results in a double free. Instead, set rc to NULL resulting in rc_free_device being a noop. Signed-off-by: Jiri Slaby Cc: Sean Young Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Acked-by: Sean Young --- drivers/media/rc/ttusbir.c | 1 + 1 file changed, 1 insertion(+) 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: