Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344315pxv; Sun, 4 Jul 2021 16:07:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9oRs+XAK+REOkGIbfciCYnQRGN9lKxHKb3VXiGvzfmI1AvwkRIcNFfy+BzpGzmShhZg/V X-Received: by 2002:a92:d10c:: with SMTP id a12mr1931790ilb.100.1625440026204; Sun, 04 Jul 2021 16:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440026; cv=none; d=google.com; s=arc-20160816; b=m1Vq9O1TbB6qc+BXgHaOFomH96vpVp8CyKMM34vcQeBPGjdB8tjmje5XtpWhHxkjHS sR1RzoKrjZFIctN0tX5T3VvjMvZyrRKbYCbqlh2ndEwm1k9PUsdPg847emCB4CFIz1rK FWhWx8Xheb6XWOJpeBTHwEKoibUaJ/kAR8VCBzSqKfvJh4ifuLVOpScnghZN6AAiOcWK pkrCB7XErW9iTPceLldayLuEktmjPNJGEvwwdvMY29i3PYFeSmGmaSFCeVzJdX7aTIj5 RB4OhVWfEUdElHukYI3qYDcAyU5lsvd4ZX4Gcz/teKbF8auDLiboSuUM8MhWlvmfytUc O/Eg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M2x/1hTnQGddwq5W6ViFuxsWF24XpzSwDdauj6cByBc=; b=WZgYVM0o6PbvSfh6I4btjS/6KIU+zD61zEg9ci/rhb/+UVf0iQS85H+dyXYokT/qGl nZ4ZlmxSd93BHv3LtU+cTQQBRHhanXkIKpyvtPedBEh/sGast47l468h/y4fZI1+ZcQY 3cztS59trq+csl+T2w+izPcrlRsO2j1hWnUwIGajVa+vxLBJVn+8SkX7QU6+cZbJgmPT 7MiMLaBjyTZcQfpYmDM6UwnIvY7yHwMh34C5/LMDhtq0HcNKTgaSeTl8dny3Mw7yc64m q0GxXkS4E6ceS2idoFdeNWcSxV2tb91bwIVdR54O8BaqWA4dpeuEPgFBQrQt9wM+wmhO yLuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jc+4nPTi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si8797512ilj.106.2021.07.04.16.06.54; Sun, 04 Jul 2021 16:07:06 -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=k20201202 header.b=jc+4nPTi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbhGDXI0 (ORCPT + 99 others); Sun, 4 Jul 2021 19:08:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:46604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbhGDXH5 (ORCPT ); Sun, 4 Jul 2021 19:07:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1BD96192E; Sun, 4 Jul 2021 23:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439921; bh=LYo60E9hzNfnIeU6O7W5VONI9WogMKheLf5JCQtvhwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jc+4nPTiMNDKdgMy+DGPq8zVrpUxvb7riFR+AEIy6aE2bvoKdf35U+FNU51HqwwKU oaW+A2FtLneHNPqRhxskVpJtSu8Bi1oxdJnrXsn5QqoiTxkoPDUwteAHS1F4yyJwUC luLCIY6K3OBsUp4LXXZppbL5g0+InLc5NtOJxOuP18zt0GY+NF6fWm+Ejk0h/zWMH2 XtUEpwpbh8bOqL2JZAf+o8DXXcZVCug4e9pyAFHPuNWdTuHKxaxZJ7nWeqz2+t3no6 gEfHS0qLtSnuO8jFJNuOYo4VXpHaRsR2AR5fdi7e2tPd1a0kcdrxDr17gqfgiCxeAE H5nhImzlT1/gA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lv Yunlong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 44/85] media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release Date: Sun, 4 Jul 2021 19:03:39 -0400 Message-Id: <20210704230420.1488358-44-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lv Yunlong [ Upstream commit 7dd0c9e547b6924e18712b6b51aa3cba1896ee2c ] A use after free bug caused by the dangling pointer filp->privitate_data in v4l2_fh_release. See https://lore.kernel.org/patchwork/patch/1419058/. My patch sets the dangling pointer to NULL to provide robust. Signed-off-by: Lv Yunlong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/v4l2-core/v4l2-fh.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c index 684574f58e82..90eec79ee995 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -96,6 +96,7 @@ int v4l2_fh_release(struct file *filp) v4l2_fh_del(fh); v4l2_fh_exit(fh); kfree(fh); + filp->private_data = NULL; } return 0; } -- 2.30.2