Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp764109pxb; Mon, 16 Aug 2021 17:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNyRSJUk3eB8kx8vbuZ7zYvMqXzTRJ0pZzx6xUl0dozDOEL73FGrRAYTr7WtSznwJlpgNn X-Received: by 2002:a17:906:498b:: with SMTP id p11mr853270eju.295.1629160694099; Mon, 16 Aug 2021 17:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629160694; cv=none; d=google.com; s=arc-20160816; b=VoSgs3yssy2IyJHVG+Quy8aPRgSb/OyyVvpnXCl8/MPnIj/33fHduMfJI9yGu9fyJX EhcII3us7t5vvB/U3G+jnrcxNkoYO/ynFK4VGHffBSlwaXqn5Me8ECdu7JcDuQc6bkYG TJxiXAxJZDPE0ZI3bxzsZlbkfozbT6HQw+qW7fisNLh3l5WkylmAH77lCDpdu/BV/MYW OmebuLD2Zs1bS45ne+L6yH8sxaogtqU3uXyclsuLz2V5/ExI9PUBcErtaWGMfw2PQGdx WmTqsccMK3jWf3x3byemb8hSjzDdvKaUbByGm9TrVq6gpJMgyBciD/KUFK6d0hJYifKS w8FQ== 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=dnoZOuXsiDtXCIXZ96Iwxlhq92N4uUPuVxbp/cJz0iI=; b=TxApqVRObDxlvEMppvHJv0X3vk5Pv6vInpMnhGRBuV/vrmJ88S+TtgoajBm3kXfkMo Am/vsY3OhF7qIaFHstwJ+cgWncQVtSFj8iQpV/LcwTVlQkCZ1qTuvVHuUDLOB8bn8CwA GkYccQBcCQx2N+iNgP4xqo2KwOUFIc5GhdVPvEbda+g+Wy9r5EEZmZ8auaxYUuJ64bDb L/TSd6EUS/pQ5RA7hpJLaeUMF0b3SzCT+BSb4ezrkOYCrbXbUAP865lqBamrSpUm4A1h 6YfPiRuaTU746DA3var2Z7/eAHrOhcxh8sFeMutcP3aRPFBhgeUvXu67pPnRIxWMr42H 2B4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f+93b0oi; 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 v17si501638edd.77.2021.08.16.17.37.51; Mon, 16 Aug 2021 17:38:14 -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=f+93b0oi; 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 S235819AbhHQAgj (ORCPT + 99 others); Mon, 16 Aug 2021 20:36:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236051AbhHQAgY (ORCPT ); Mon, 16 Aug 2021 20:36:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBEAE60FC3; Tue, 17 Aug 2021 00:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629160552; bh=EG8oCqNCpJ9I9kaz9k9fICEPwDby1FZHFnk/nQTYB7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+93b0oiiBM0fR+YzyLZ/gUQO7NS9jgUK98b8w2nuHnhe9GYcWbY66B27/4iAtqoN O9kxXTly0Uf7Cs1AMG7w4lKAM8VBcS0xNJ+PpSKMIoaSFNsm+iVFYyNIDyeHefCxsG F6Nfi39so0gt/G7lRIR4huzLaoK1kentHP5v/LbMArSPgX5z0p34CJcTZ3X1wcptWh 5OpavjCAmnPOWkSzgxrkKtMYKy4ZutuBokqhsNMqIT73VTtHcq6I2X2cqrcXgm5E++ BFWAhpupwYt58lAJlLlUP8WdPbDzR+E5v/5+iUwqToIWqo3oymTjd3Gz1IUGX8SGHL ySBeAuT9lppoA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Miklos Szeredi , Colin Ian King , Sasha Levin , linux-unionfs@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 11/12] ovl: fix uninitialized pointer read in ovl_lookup_real_one() Date: Mon, 16 Aug 2021 20:35:35 -0400 Message-Id: <20210817003536.83063-11-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210817003536.83063-1-sashal@kernel.org> References: <20210817003536.83063-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: Miklos Szeredi [ Upstream commit 580c610429b3994e8db24418927747cf28443cde ] One error path can result in release_dentry_name_snapshot() being called before "name" was initialized by take_dentry_name_snapshot(). Fix by moving the release_dentry_name_snapshot() to immediately after the only use. Reported-by: Colin Ian King Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index 41ebf52f1bbc..ebde05c9cf62 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -392,6 +392,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, */ take_dentry_name_snapshot(&name, real); this = lookup_one_len(name.name.name, connected, name.name.len); + release_dentry_name_snapshot(&name); err = PTR_ERR(this); if (IS_ERR(this)) { goto fail; @@ -406,7 +407,6 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, } out: - release_dentry_name_snapshot(&name); dput(parent); inode_unlock(dir); return this; -- 2.30.2