Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1165211pxu; Fri, 16 Oct 2020 05:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA+y9GZwTOqqVFTRWYLQu8JKWUMxiUAaabGTf8Dq3PrV1YUCcAXid/kfzvTzG/8GHagMN6 X-Received: by 2002:a50:c38e:: with SMTP id h14mr3816531edf.174.1602852042951; Fri, 16 Oct 2020 05:40:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602852042; cv=none; d=google.com; s=arc-20160816; b=tiePAZzt6+CxLXn0sOp6Iir25biCCubV5EO9ZvvSYHRXsUD2bTDkzup9kTXn0BXOe4 Dynn1qRNyRNJMiLuG3KiFqsrLj7usp4SyeYqvnvtQuJ0+9Ic6K9A8Zb8fAycdcZE2+sk cuRLSKGHhsok0GZfitcLTuPjhp3S8A7WLYbstaWZ0AojzeB8X4V/TWR1KUamrThYBzuU GXmbwQj6Hw6tfeMjFj5hfygTZSL+9U8IsyfLaSBtELJJLcYJmzqVU7ZPgRfJTZUA0Rm8 lQ9N7kh5PYBYMUtDxSVQ6+fwfLgupTGLsiZd0855hzA4R0KZlUqVjRC0vHPw03152twT +pGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NuVeEU0u/uNBwtO+k7TADwv03G+kzKnJnK/kOE3rWaA=; b=uZwakCE8Svge/6Obd4A3QMu0KjZbpPvKiJKHkcV4MrY7AYJ6fGmh/B61mdTIXE2jq3 QSB3yJTDosE30sMuzCA7nV9ku6+qeguA26eHgF7GXVvH6Bjg+Ep/AO8pHQdSPgeGLWuS RZI7FZn7YhJ2zVKHluXajhnByfeRI3g7P7S+ItqBf0PM1LQauyeBCcvWHfAfGQiIAqjx mxbIAYlAe034ca3DM6Ex7AStyKlRNMKc4QHp1T3mtW0QjRZr5rcbznd2N3BORnA36XDg mSQXYjfehC433xifSYFAQuOogfp3SX9U7Ns+8n4wCp5BkERfgo7WRvUyxFhq30XEIEIp cldQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K2kWcA7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si1580833edy.118.2020.10.16.05.40.20; Fri, 16 Oct 2020 05:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K2kWcA7R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406152AbgJPJPU (ORCPT + 99 others); Fri, 16 Oct 2020 05:15:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:37964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394997AbgJPJJQ (ORCPT ); Fri, 16 Oct 2020 05:09:16 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D95D221FD; Fri, 16 Oct 2020 09:09:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839345; bh=rCuKaO0ItDgcez7vR2S0pKoYWlZRDIP/DdBssTSD7QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2kWcA7RKd8VvKELwPqfeXY1WJj3y0bAFwcwyO+404TSDgha0HQAFrYsy+5kMT6G0 IGsIhO3wfHdNzQBC0H+QElUFXOj8WW2CM3orXvghsU87vPN4UqxbIyPlGX5hUyIBS3 vuWs8KON/Ya8r06p2p7JnJ2MBBh6Ooq+iHshg2mA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Ben Hutchings , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.19 11/21] media: usbtv: Fix refcounting mixup Date: Fri, 16 Oct 2020 11:07:30 +0200 Message-Id: <20201016090437.858163112@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090437.301376476@linuxfoundation.org> References: <20201016090437.301376476@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Neukum commit bf65f8aabdb37bc1a785884374e919477fe13e10 upstream. The premature free in the error path is blocked by V4L refcounting, not USB refcounting. Thanks to Ben Hutchings for review. [v2] corrected attributions Signed-off-by: Oliver Neukum Fixes: 50e704453553 ("media: usbtv: prevent double free in error case") CC: stable@vger.kernel.org Reported-by: Ben Hutchings Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/usbtv/usbtv-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -113,7 +113,8 @@ static int usbtv_probe(struct usb_interf usbtv_audio_fail: /* we must not free at this point */ - usb_get_dev(usbtv->udev); + v4l2_device_get(&usbtv->v4l2_dev); + /* this will undo the v4l2_device_get() */ usbtv_video_free(usbtv); usbtv_video_fail: