Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3288781ybb; Tue, 31 Mar 2020 02:10:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvy1WGJj/Jiqz1Opqm9/1A3oW/ZnB94nAZrB8ByokASkVoJGY6FH7FDf782Rj98MHUEAV7H X-Received: by 2002:a9d:4698:: with SMTP id z24mr11952565ote.271.1585645838008; Tue, 31 Mar 2020 02:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645838; cv=none; d=google.com; s=arc-20160816; b=BfLaQxxj16S+kAzvZF1XNkfyJoqfIHMZsAJ5lItxuhIppok1GqZT8x5yRxW2JPdXwo zWXytZrK8F//HBGnmwW+/CVjsj5oVP5R7tN0XxBbuhQDMbNwkVUvf2ZypVBh0y3zrgbe qFx23A1Oc1z1emxeJJhcg4jz/K+y9Lv/1PpEs7/f0pitD3Y40y05hZYx6WPW8bD9Vzmh B1JQQ/51/phNEBLPdziqekHLoMZBMOF3niWHfvpAcrmGfAmWlmh9zfik1CTYZB8s+KeU pQSCDbsYTHJqrlrBKpw8HvY/5YahAkzPhkhkrIfu4wU1VaRE+y7rVgPq6WVppLtDpmkA A25Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OUY7cy8ftL51KVsJHAQL83uX+v3L4bZrW5ueA7ftypo=; b=H6+PnXYD54E5F9jlDb670sPwlF91GHWyFxj95OcPvKKwCblERfgf4IfLZPoRuDE+qD A5E0ugifTAe+n1qZfCL0jNAuZH6u/1I4ZvK7i+xJ6hNL7g0tCbMCrDdprkrBuIzhqODS iG6Ewv3PDtAeLp+S1Cun01hD9viq3gh/RncKfbM0HkN//8v8og22q2tteHA29Ii3yaI/ hXfOZnrtJh+PCo0Sc+o9WKITapXMtr72bN1FRjont0y/00GAcrVFClnJbvxgADXox/yM mnRiGlG5rSs9+W+tiq0q8xbs2oARkSYUAnA/Ih9xhYQmlSYJSqCYYagWoWkyLIfomQeU JZLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VHgnBh0C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si6562405oib.268.2020.03.31.02.10.26; Tue, 31 Mar 2020 02:10:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VHgnBh0C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731562AbgCaJKD (ORCPT + 99 others); Tue, 31 Mar 2020 05:10:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:53622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731558AbgCaJKD (ORCPT ); Tue, 31 Mar 2020 05:10:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 39E9720675; Tue, 31 Mar 2020 09:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645802; bh=i54h0PpoMrZjEXGvANY6FaJbACna+TsoRHILdEn6CI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHgnBh0C2mMKcnEmQIhXvB422yfh6EGALtxEmtLXzSgQZMYXHmOHJ2Jf/vcPqf1KY jfiiugSz8CFzcVEDpYMOlU1XEF25M+/xG1cDwWVlTb/QYuln4Z9BsJr2bmghXLSKOQ aRb6r7KtJq9wcwdDgBZoEpg7MrO/I31mHjCfQySM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dafna Hirschfeld , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.5 170/170] media: v4l2-core: fix a use-after-free bug of sd->devnode Date: Tue, 31 Mar 2020 10:59:44 +0200 Message-Id: <20200331085440.662743229@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dafna Hirschfeld commit 6990570f7e0a6078e11b9c5dc13f4b6e3f49a398 upstream. sd->devnode is released after calling v4l2_subdev_release. Therefore it should be set to NULL so that the subdev won't hold a pointer to a released object. This fixes a reference after free bug in function v4l2_device_unregister_subdev Fixes: 0e43734d4c46e ("media: v4l2-subdev: add release() internal op") Cc: stable@vger.kernel.org Signed-off-by: Dafna Hirschfeld Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-device.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -179,6 +179,7 @@ static void v4l2_subdev_release(struct v if (sd->internal_ops && sd->internal_ops->release) sd->internal_ops->release(sd); + sd->devnode = NULL; module_put(owner); }