[PATCH v3 3/3] ceph: fix possible kunmaping random vaddr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
 fs/ceph/inode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 1c775a365b5e..83f18b058d8c 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2253,7 +2253,7 @@ static int fill_fscrypt_truncate(struct inode *inode,
 	loff_t pos, orig_pos = round_down(attr->ia_size, CEPH_FSCRYPT_BLOCK_SIZE);
 	u64 block = orig_pos >> CEPH_FSCRYPT_BLOCK_SHIFT;
 	struct ceph_pagelist *pagelist = NULL;
-	struct kvec iov;
+	struct kvec iov = {0};
 	struct iov_iter iter;
 	struct page *page = NULL;
 	struct ceph_fscrypt_truncate_size_header header;
@@ -2364,7 +2364,8 @@ static int fill_fscrypt_truncate(struct inode *inode,
 	dout("%s %p size dropping cap refs on %s\n", __func__,
 	     inode, ceph_cap_string(got));
 	ceph_put_cap_refs(ci, got);
-	kunmap_local(iov.iov_base);
+	if (iov.iov_base)
+		kunmap_local(iov.iov_base);
 	if (page)
 		__free_pages(page, 0);
 	if (ret && pagelist)
-- 
2.36.0.rc1




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux