From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64628C00449 for ; Fri, 5 Oct 2018 16:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22982214C5 for ; Fri, 5 Oct 2018 16:17:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ccoSp01d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22982214C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730327AbeJEXRM (ORCPT ); Fri, 5 Oct 2018 19:17:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:55726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729612AbeJEXRM (ORCPT ); Fri, 5 Oct 2018 19:17:12 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01044214C5; Fri, 5 Oct 2018 16:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1538756268; bh=RGdOYzZVqXBS5zKRCsEkQICmVYAtKLNucsVFRa7PMF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ccoSp01doqX/2PnrrlvuHq9pae+3SEUkcdX4WsR9PAOCB39aBKioxR8THc2FjFe5P 7tMAQ9z4uFuomguUt2mrjDrJYNdmEJrx1TN+gOeTnhjQ0bTW7ZSbvfYPxlSBWXMWo5 CZuwCkx8plTrlwKU6x74WD14Jj5YubF6ikzQ8qE8= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Weinberger , Sasha Levin Subject: [PATCH AUTOSEL 4.4 11/11] ubifs: Check for name being NULL while mounting Date: Fri, 5 Oct 2018 12:17:36 -0400 Message-Id: <20181005161736.20765-11-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005161736.20765-1-sashal@kernel.org> References: <20181005161736.20765-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 0bb6de356451..7968b7a5e787 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1918,6 +1918,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