Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2468633pxj; Mon, 10 May 2021 03:51:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYOu3Xi8WE9cnZNwNgCsfzBiyAvgPhCSzjlLpvaOJd3Z42UVP1eMfojz8FhjeSVEMWxw5t X-Received: by 2002:a05:6602:2bef:: with SMTP id d15mr4603132ioy.13.1620643868437; Mon, 10 May 2021 03:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643868; cv=none; d=google.com; s=arc-20160816; b=ggDvXlWNH03m1ah3iZfhKvQH9WNuxhw+QbuHboO0VI6S7OXzzOLCgZ4BjulvGm+LAs ujJ8+WzXsBjIZMMG2uJ+ItG288lLm3xR6Unp8+oNM5KuOLa4LPofDTfH/iVjdqvMZD+3 XOohGN4KLmxL1+Fth3I0Ml/TXZ26/qFPuSPsdY3RjR7YlKvuzvGpXogu8E3L5UWPr90F PYpcL+1AHAt1DhBtc9gcE8EzVIbtLBUxoFSF7Qpvx1cLdxM3XNrzI4PUXMqwUn13RmwW Q4yx8CWGnjPHzZBvrrCnTq+AkIiNvEGQCqw357Enm9K5dJbopx4YddMQIa4njpqeg6xo GVqQ== 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=buhGWf/1ju3VJOo4jxzisDw7rGRcxvBtz2u0dMkUU7Y=; b=dhV6SCe7kIMCpKeuVYTBwhBBUHxZxdfLph1bJ+j6CmrXaWp2zrVQZBeGBVFgFx+Ixb auRc3uBXKG3vwGHAkdHSCjNw6+Ri3VNsk+gY929nSEdfcwxx3iIhAuDXGJ41I6vL025F r/MScCwMKzkD2eR7N9JzTE/zlED44HSTQHaaViEE4gZb5k52CG13yj5aJPpvJy4gyFQp P2FuADptRvMSgLie+zFuuzQnGWw4i9yiGl6Jd1ksnIwqR4I/Q3RmERtHbzCuMRL++m2i oO23/MAarL56ZXcMs0/DrbfsqCxDCJ1li9+3QWHtBB/WQoHaG7rmvMrIZIxlwj0bVJgO npBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O7GsfmJ9; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si10098847jav.83.2021.05.10.03.50.56; Mon, 10 May 2021 03:51:08 -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=@linuxfoundation.org header.s=korg header.b=O7GsfmJ9; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232321AbhEJKun (ORCPT + 99 others); Mon, 10 May 2021 06:50:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:48982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233004AbhEJKk7 (ORCPT ); Mon, 10 May 2021 06:40:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 596286101D; Mon, 10 May 2021 10:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642699; bh=SvxhWZ34ayENmMcCz/K3zPsrZ+A03KowhXP6NSbfnG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7GsfmJ9tkG2H6j8uPpfzgWAXQoKtY4uYGMPwXZg0I9HNm5cVV0qkOs8vbXcaMPaR O1KrTqrDVFY7Q2QgfIIUVRP3eBaZrFq7nqiH7/fTEcoE2ZlBLfJCloV2Q5rPQjrtMH skOdFbiwdMV4DmUU7shSOV2vOyLFlivEuS6kyPac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrey Mitchell , Tyler Hicks Subject: [PATCH 5.10 016/299] ecryptfs: fix kernel panic with null dev_name Date: Mon, 10 May 2021 12:16:53 +0200 Message-Id: <20210510102005.378009422@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Jeffrey Mitchell commit 9046625511ad8dfbc8c6c2de16b3532c43d68d48 upstream. When mounting eCryptfs, a null "dev_name" argument to ecryptfs_mount() causes a kernel panic if the parsed options are valid. The easiest way to reproduce this is to call mount() from userspace with an existing eCryptfs mount's options and a "source" argument of 0. Error out if "dev_name" is null in ecryptfs_mount() Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig") Cc: stable@vger.kernel.org Signed-off-by: Jeffrey Mitchell Signed-off-by: Tyler Hicks Signed-off-by: Greg Kroah-Hartman --- fs/ecryptfs/main.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(str goto out; } + if (!dev_name) { + rc = -EINVAL; + err = "Device name cannot be null"; + goto out; + } + rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid); if (rc) { err = "Error parsing options";