Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3064053pxb; Mon, 18 Apr 2022 14:57:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDLzRDquiZF43uAT3N7mVqFOso2ex1c8/9tz0/RYPub5m9r3ge33a+9vbpu2YvsrNXwmS1 X-Received: by 2002:aa7:9472:0:b0:508:44db:be37 with SMTP id t18-20020aa79472000000b0050844dbbe37mr14566303pfq.25.1650319022643; Mon, 18 Apr 2022 14:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650319022; cv=none; d=google.com; s=arc-20160816; b=Gfpckf+f/T/qfc1tLnFanD4aCalJbafAchXSqhcmihkN9edFp/1CWz0yJhJFhy1Jl3 1+VDTWaV1YdDlrKsnJZRswzpkyzpisCE0ypIwUgtzSplNgva54y3dL5L70W5/he7bhj3 kTlFa4LUE/vS5Gr4l//h7m7unGCZl/ul+UUp3pQLvz/YUvX8R5OTdvd0a7v8H8YH5Ker ZH5rt6UrK1RM/uvcem2TdW+4I7Z2YYQiyPHzKACVbCVKcZiZAm6sciU75hWr464rDNNA 2nyn67cCSRSw9dTB5AgmF0peOL/i7hK6YGKnY6u4FQ7OOU2ZAY1TO3+ojYoekrm8nVwZ ysRw== 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=QgjdEaiAtMPxVNID9MZue/whApyIQuAvCRC1IEX+fgU=; b=TvF7OqBWEaIwhyhLG92WXx4Nc3gxHAe7JwKoP62zBxrIfX7rdPJKT3PZDIr0HBoP0Y pJavOpmKGnztqGh2F2p5Wg4DT/yZQhMrkhwZG1QWSosrSiXhNRLMhcCq6ZmRRaYoDP6k r9esqY19jXzGOxPrDzvG+2o+j2ZkXTRnIhbULmrXt7zbSnap4YcUxHwpMssIt5WlPb3O 7WQUaPSiGzYHXtnGjkKmAaTgEhc6j5irRccmYijXs3hLcMc8IcPBPovL56nmHuHIL1S/ HVVVdY9LTWPc5+cYpFGyjEXw3bWm8+WT+/Gz9mvvy9nZQgedXZVq0EuMbk8P8utIJuUz osyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j3DwvvqA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020a637a10000000b0039d6a62c9afsi10815425pgc.289.2022.04.18.14.56.47; Mon, 18 Apr 2022 14:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j3DwvvqA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S242879AbiDRNyl (ORCPT + 99 others); Mon, 18 Apr 2022 09:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244867AbiDRNa7 (ORCPT ); Mon, 18 Apr 2022 09:30:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 785631EEEF; Mon, 18 Apr 2022 05:56:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2BB26115A; Mon, 18 Apr 2022 12:56:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F1FC385A1; Mon, 18 Apr 2022 12:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286601; bh=A/6IH/eVbD7pC1jgqsxa90n8fT6Oo4kz+pG3eQZ/lBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3DwvvqAY606eE03kTZfhXxflHiuxEycdenqQ7yRIUKltuceK5KB6bnNpFnOhauyN 0jree+UZLLqjJpyIU+wsEVQoNg2SiFDkxqdubEgsf7kGnEldQospE94nuNf+HSqxEF JDgbJX/NfJ0NLpyXo6n4bSKGi/mT1iGSEkmREdhs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Richard Weinberger Subject: [PATCH 4.14 187/284] ubifs: setflags: Make dirtied_ino_d 8 bytes aligned Date: Mon, 18 Apr 2022 14:12:48 +0200 Message-Id: <20220418121217.054752068@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhihao Cheng commit 1b83ec057db16b4d0697dc21ef7a9743b6041f72 upstream. Make 'ui->data_len' aligned with 8 bytes before it is assigned to dirtied_ino_d. Since 8871d84c8f8b0c6b("ubifs: convert to fileattr") applied, 'setflags()' only affects regular files and directories, only xattr inode, symlink inode and special inode(pipe/char_dev/block_dev) have none- zero 'ui->data_len' field, so assertion '!(req->dirtied_ino_d & 7)' cannot fail in ubifs_budget_space(). To avoid assertion fails in future evolution(eg. setflags can operate special inodes), it's better to make dirtied_ino_d 8 bytes aligned, after all aligned size is still zero for regular files. Fixes: 1e51764a3c2ac05a ("UBIFS: add new flash file system") Signed-off-by: Zhihao Cheng Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c @@ -110,7 +110,7 @@ static int setflags(struct inode *inode, struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_info *c = inode->i_sb->s_fs_info; struct ubifs_budget_req req = { .dirtied_ino = 1, - .dirtied_ino_d = ui->data_len }; + .dirtied_ino_d = ALIGN(ui->data_len, 8) }; err = ubifs_budget_space(c, &req); if (err)