Message ID | 20200803121850.325340290@linuxfoundation.org |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=5b7Y=BN=vger.kernel.org=stable-owner@kernel.org> 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=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 1B6B2C433DF for <stable@archiver.kernel.org>; Mon, 3 Aug 2020 12:37:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5DD72054F for <stable@archiver.kernel.org>; Mon, 3 Aug 2020 12:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596458221; bh=pj9Zf2gXN7/jLCNdK9KZMHeeAQyLHHaWLBIS4TQzfGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yE2/rywG5L58cQbB36t2w96EpHnzVNJVO68glCfeQyfNl96C0VeCocbgEUS+vb2zC mU5XewZPg86NCNxTabLqjEkVOui5klCfaKqXWURwTPjXZ0aRPAqR34j/BnNmjEFCgi IwE4WBnw1+7z2AgyQQPdsKWEQ/nTZLzumZ7z4yys= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729110AbgHCMgr (ORCPT <rfc822;stable@archiver.kernel.org>); Mon, 3 Aug 2020 08:36:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729652AbgHCMf0 (ORCPT <rfc822;stable@vger.kernel.org>); Mon, 3 Aug 2020 08:35:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 760312054F; Mon, 3 Aug 2020 12:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596458124; bh=pj9Zf2gXN7/jLCNdK9KZMHeeAQyLHHaWLBIS4TQzfGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUpT0BJBFNaEATOqju1lXkb1ke0yqDQdE9tmUKFR1HovWLVjUiuqTU4GVhfFLKw/k eqXENmxuzKnWR762/OkQVuiw4CbHKUAV8wdwfz9o9rgqZ4/SegwGS696B4nyD1gSq6 a/8l0okJV+4Zu+WutGVyWWMZhfJzSXjNYGaVNhkg= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Gong Chen <gongchen4@huawei.com>, Sheng Yong <shengyong1@huawei.com>, Chao Yu <yuchao0@huawei.com>, Jaegeuk Kim <jaegeuk@kernel.org>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 4.14 17/51] f2fs: check if file namelen exceeds max value Date: Mon, 3 Aug 2020 14:20:02 +0200 Message-Id: <20200803121850.325340290@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200803121849.488233135@linuxfoundation.org> References: <20200803121849.488233135@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 7a177b8f227d2..ff519f7a87847 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -819,7 +819,8 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, /* check memory boundary before moving forward */ bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); - if (unlikely(bit_pos > d->max)) { + if (unlikely(bit_pos > d->max || + le16_to_cpu(de->name_len) > F2FS_NAME_LEN)) { f2fs_msg(F2FS_I_SB(d->inode)->sb, KERN_WARNING, "%s: corrupted namelen=%d, run fsck to fix.", __func__, le16_to_cpu(de->name_len));