From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:55958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729082AbeJEXRV (ORCPT ); Fri, 5 Oct 2018 19:17:21 -0400 From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Weinberger , Sasha Levin Subject: [PATCH AUTOSEL 3.18 6/6] ubifs: Check for name being NULL while mounting Date: Fri, 5 Oct 2018 12:17:50 -0400 Message-Id: <20181005161750.20823-6-sashal@kernel.org> In-Reply-To: <20181005161750.20823-1-sashal@kernel.org> References: <20181005161750.20823-1-sashal@kernel.org> Sender: stable-owner@vger.kernel.org List-ID: From: Richard Weinberger [ Upstream commit 37f31b6ca4311b94d985fb398a72e5399ad57925 ] The requested device name can be NULL or an empty string. Check for that and refuse to continue. UBIFS has to do this manually since we cannot use mount_bdev(), which checks for this condition. Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system") Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- fs/ubifs/super.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 2f7a74e73b7d..a6a2108bf620 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1917,6 +1917,9 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode) int dev, vol; char *endptr; + if (!name || !*name) + return ERR_PTR(-EINVAL); + /* First, try to open using the device node path method */ ubi = ubi_open_volume_path(name, mode); if (!IS_ERR(ubi)) -- 2.17.1