Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp681654pxb; Tue, 5 Apr 2022 18:34:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaYo2LeVi4wG07lwIoKcyEBaFm+Up9FB2+0q82Xyy67BH0ypCb1KaDz2V3PwnghBv/nbsf X-Received: by 2002:a63:4642:0:b0:398:b6b9:5f45 with SMTP id v2-20020a634642000000b00398b6b95f45mr5215889pgk.518.1649208852506; Tue, 05 Apr 2022 18:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208852; cv=none; d=google.com; s=arc-20160816; b=EI5IqNHYzwW9xymJA6uJKOlk3qSsc1AKR2B0171o2XPcEloMTrl/uGMNeqxJLcWO40 Ix3HOrANY9FdutonADuLZ9F+XJwKcJk52sneZB4CtLt+wYOyt1MSsaIe8z6y1Rcad4Qw 3F18QF4/gXGbfOGxxCLz3mu/ObRcIzlZjJFllgF9dazXlUv5AhtEc0zQkWuTxxFSlszP dX0TlhiKwmGifReXJm3BAY9xgaLLQvpu3AK6A/Wt3uRZfwuVBcSSqdoeFdqzypn5ef+r 61Hwd75fpURIHwAtDYYudbo8f8LLoGvfMAwgCbd54jTaWP7zJ5V7LU494wyWC1QDsAos 8wnQ== 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=WXKVM0PvdTSIljquPl3qSJG1tGxsAb41zH8EuP0VWr8=; b=HFkH9eHdzDga0+Ye8/3u4eOzKhBp0vO7XpksGjPlkBHT99LxpzFxXk8Wcz7Hfok5hY /DjzVWefAWuqyA4uAxzhU7w8q18CBasdVKQOCGo21TkZ1wZaDZj4PG7Pkv5p9Q9Kpolf 3d9X+aZjLIUO9A3DykqHL7877f2hacK9hchSuYIx9H/lojjhCk2TZiT3j0l3fGj92A3N ihETj4Q//PyjLgVH52WU8IS52yS1URdaiPuUmKMj3BRfhw0dcL7Kx/xGsgEHsCQC8bLA U9skb7TTZY9Wjz5GeOyVE7gJvrCki1M516P56n4dvjfVWPVgiC5m0fWblB1mDW/Uii54 ZzeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SiSLLWRA; 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 13-20020a630a0d000000b003816043eec7si7118240pgk.188.2022.04.05.18.33.58; Tue, 05 Apr 2022 18:34:12 -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=SiSLLWRA; 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 S1389057AbiDENdU (ORCPT + 99 others); Tue, 5 Apr 2022 09:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346242AbiDEJXk (ORCPT ); Tue, 5 Apr 2022 05:23:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3F8CA0C9; Tue, 5 Apr 2022 02:13:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 14EFBB818F3; Tue, 5 Apr 2022 09:13:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78807C385A0; Tue, 5 Apr 2022 09:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149989; bh=dXFWPeFlgT6CyzZ310/ga2U0bPPCNAqe3eAdLbGPkzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SiSLLWRAHs2Hhp+R0vaIhQbBQgLKKJq4ICEVTF3Tno8bl7/xdkLQtyS2q64rFtQ0d wRQ8uFpAFSxWoT506/S06QvM+nBtTwgg3fGOLXnkIMIG/tKIORBOoKzNk2Cr0SDjRb lO9J/WlORmvl9jAa39LXdpoFi22XyZ9afio/w2iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Richard Weinberger Subject: [PATCH 5.16 0913/1017] ubifs: setflags: Make dirtied_ino_d 8 bytes aligned Date: Tue, 5 Apr 2022 09:30:26 +0200 Message-Id: <20220405070421.322870162@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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 @@ -108,7 +108,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)