Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp405175pxj; Thu, 20 May 2021 12:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLGuGVVG7HQ+9gARL5TGITskY+BDUmtzj0ntXluJ+rz7wZ9mjf9GFwLKjRyC27oN3l265B X-Received: by 2002:a6b:dc06:: with SMTP id s6mr7336568ioc.130.1621537401345; Thu, 20 May 2021 12:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621537401; cv=none; d=google.com; s=arc-20160816; b=QByYSkAqWAmojikMUFCyTrA0HwzjNPlznOpnHACwLq5+6Ai05bNrddO67SmbP8ZMrb AxudFmd5sdTsHUN+6abqCLxwt9k0nis5VBFeSUPy61jdjMuNc6I8jdPod1Oye/oeX5qo iSd1LserQv8ALYSY6SfYsG04pC/ZBNmKbIawB07MY45cw4Zr1P8dVGuVBw1n1tlnpczF jCYtw68s1/u8lZJSsSDkijOLdFyR1T6O/f1/+skupcBlgCYn+o4Uc60EFkMfekxLEp+6 S0+/DnO0B2PXowpADh01Tz9XEBdYjLHQM02Wj1ja8WOLrErxtfYdaJXN11nRnyxiHote XoeQ== 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=ZOZbwahVuVhdImWivREjApN/V0c+2ajdDnwfFOKW5nY=; b=lYh5s5pqg3NBFqaXR6G8PLZjDyzlKLhCHOrEZTzEJACEKeRHbBiQ0bxzNVCQulSJbc A08Lqi8s4Bm+GyqFNa0P/c6Ymr8RnYdjX34Md/E8yLEFFQA/2kKMkD0JwQ72BSlgEpEw qPT+Ktue8e1046iy/XPziicwKtZPecrqNvU8PWTa5WpEjwty6XsutexMiJT0+MCgWkf1 8LnvXkqBz52zPsgXRbDvq3ug0upeo3mcfj++n0DUYB1HG6IpCozEU4yXY6MbnbfmdNcm 16mUpxBrWHodpEx1LinOX0BxEGtRLO6GZPe+yvU3a5PTbDe9VgAGh/yP80AA8D0yMcot j/ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DvbKcayE; 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 v8si3573481ilu.72.2021.05.20.12.03.08; Thu, 20 May 2021 12:03:21 -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=DvbKcayE; 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 S236946AbhETKbW (ORCPT + 99 others); Thu, 20 May 2021 06:31:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:51826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235216AbhETKTG (ORCPT ); Thu, 20 May 2021 06:19:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CCCCA619A3; Thu, 20 May 2021 09:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504014; bh=dIQwHZRW1nuaV/U8JlEyKoa47ZeXRKYoOtsBAICauTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DvbKcayEVEiqRf0Rw6iU1ttjf4N5fDsGD9TU6O+sgkLnuOXuROKQSH/oS6rHhfMhr 02ufuMlNBDPlfsICYcujBeP8yhUbsKztqsjrcUKtl8QpC6wJyHwecaLoP/JAjX6SJP RLmRuvBm1FgqBIwYuaynYv73siIiagOsxQSTcgng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffrey Mitchell , Tyler Hicks Subject: [PATCH 4.14 021/323] ecryptfs: fix kernel panic with null dev_name Date: Thu, 20 May 2021 11:18:33 +0200 Message-Id: <20210520092120.843449103@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 @@ -506,6 +506,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";