From a67d081148ba0680539fbf76ae13c6484bb730de Mon Sep 17 00:00:00 2001 From: Dhairya Parmar Date: Thu, 7 Dec 2023 23:14:01 +0530 Subject: [PATCH] client: do not accept zero byte write request Fixes: https://tracker.ceph.com/issues/63734 Signed-off-by: Dhairya Parmar --- src/client/Client.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index d8b6c32090e4..58a289d1a23a 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11441,6 +11441,10 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, CWF_iofinish *cwf_iofinish = NULL; C_SaferCond *cond_iofinish = NULL; + if (size < 1) { // zero bytes write is not supported by osd + return -CEPHFS_EINVAL; + } + if ( (uint64_t)(offset+size) > mdsmap->get_max_filesize() && //exceeds config (uint64_t)(offset+size) > in->size ) { //exceeds filesize return -CEPHFS_EFBIG; -- 2.47.3