All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, "Luís Henriques" <lhenriques@suse.de>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Joel Becker" <jlbec@evilplan.org>,
	"Junxiao Bi" <junxiao.bi@oracle.com>,
	"Changwei Ge" <gechangwei@live.cn>, "Gang He" <ghe@suse.com>,
	"Jun Piao" <piaojun@huawei.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH 4.14 11/32] ocfs2: check new file size on fallocate call
Date: Mon, 19 Jun 2023 12:28:59 +0200	[thread overview]
Message-ID: <20230619102128.104595366@linuxfoundation.org> (raw)
In-Reply-To: <20230619102127.461443957@linuxfoundation.org>

From: Luís Henriques <ocfs2-devel@oss.oracle.com>

commit 26a6ffff7de5dd369cdb12e38ba11db682f1dec0 upstream.

When changing a file size with fallocate() the new size isn't being
checked.  In particular, the FSIZE ulimit isn't being checked, which makes
fstest generic/228 fail.  Simply adding a call to inode_newsize_ok() fixes
this issue.

Link: https://lkml.kernel.org/r/20230529152645.32680-1-lhenriques@suse.de
Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Mark Fasheh <mark@fasheh.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ocfs2/file.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2109,14 +2109,20 @@ static long ocfs2_fallocate(struct file
 	struct ocfs2_space_resv sr;
 	int change_size = 1;
 	int cmd = OCFS2_IOC_RESVSP64;
+	int ret = 0;
 
 	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
 		return -EOPNOTSUPP;
 	if (!ocfs2_writes_unwritten_extents(osb))
 		return -EOPNOTSUPP;
 
-	if (mode & FALLOC_FL_KEEP_SIZE)
+	if (mode & FALLOC_FL_KEEP_SIZE) {
 		change_size = 0;
+	} else {
+		ret = inode_newsize_ok(inode, offset + len);
+		if (ret)
+			return ret;
+	}
 
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		cmd = OCFS2_IOC_UNRESVSP64;



  parent reply	other threads:[~2023-06-19 10:29 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 10:28 [PATCH 4.14 00/32] 4.14.319-rc1 review Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 01/32] power: supply: ab8500: Fix external_power_changed race Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 02/32] power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() + schedule() Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 03/32] ARM: dts: vexpress: add missing cache properties Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 04/32] power: supply: Ratelimit no data debug output Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 05/32] regulator: Fix error checking for debugfs_create_dir Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 06/32] power: supply: Fix logic checking if system is running from battery Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 07/32] MIPS: Alchemy: fix dbdma2 Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 08/32] mips: Move initrd_start check after initrd address sanitisation Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 09/32] xen/blkfront: Only check REQ_FUA for writes Greg Kroah-Hartman
2023-06-19 10:28 ` [PATCH 4.14 10/32] ocfs2: fix use-after-free when unmounting read-only filesystem Greg Kroah-Hartman
2023-06-19 10:28 ` Greg Kroah-Hartman [this message]
2023-06-19 10:29 ` [PATCH 4.14 12/32] nios2: dts: Fix tse_mac "max-frame-size" property Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 13/32] nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 14/32] nilfs2: fix possible out-of-bounds segment allocation in resize ioctl Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 15/32] net: usb: qmi_wwan: add support for Compal RXM-G1 Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 16/32] Remove DECnet support from kernel Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 17/32] USB: serial: option: add Quectel EM061KGL series Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 18/32] netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 19/32] ping6: Fix send to link-local addresses with VRF Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 20/32] IB/isert: Fix dead lock in ib_isert Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 21/32] IB/isert: Fix possible list corruption in CMA handler Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 22/32] IB/isert: Fix incorrect release of isert connection Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 23/32] sctp: fix an error code in sctp_sf_eat_auth() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 24/32] igb: fix nvm.ops.read() error handling Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 25/32] drm/nouveau/dp: check for NULL nv_connector->native_mode Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 26/32] net: lapbether: only support ethernet devices Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 27/32] net: tipc: resize nlattr array to correct size Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 28/32] selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 29/32] neighbour: Remove unused inline function neigh_key_eq16() Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 30/32] neighbour: delete neigh_lookup_nodev as not used Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 31/32] powerpc: Fix defconfig choice logic when cross compiling Greg Kroah-Hartman
2023-06-19 10:29 ` [PATCH 4.14 32/32] mmc: block: ensure error propagation for non-blk Greg Kroah-Hartman
2023-06-20  9:19 ` [PATCH 4.14 00/32] 4.14.319-rc1 review Chris Paterson
2023-06-20  9:28 ` Harshit Mogalapalli
2023-06-20 10:05 ` Naresh Kamboju
2023-06-20 10:21 ` Jon Hunter
2023-06-21  0:37 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230619102128.104595366@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=gechangwei@live.cn \
    --cc=ghe@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=junxiao.bi@oracle.com \
    --cc=lhenriques@suse.de \
    --cc=mark@fasheh.com \
    --cc=patches@lists.linux.dev \
    --cc=piaojun@huawei.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.