Skip to contentSkip to conversation

xfs: use kvfree for buf in xfs_ioc_getbmap

PATCH In review Christoph Hellwig 3 participants 3 messages Feb 16, 2024 – Feb 18, 2024 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: use kvfree for buf in xfs_ioc_getbmap

Without this the kernel crashes in kfree for files with a sufficiently large number of extents.

Fixes d4c75a1b40cd ("xfs: convert remaining kmem_free() to kfree()")
---
 fs/xfs/xfs_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +1 -1
index 7eeebcb6b9250b..7c35d764409720 100644
@@ -1506,7 +1506,7 @@ xfs_ioc_getbmap(
 
 	error = 0;
 out_free_buf:
-	kfree(buf);
+	kvfree(buf);
 	return error;
 }
 
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christoph Hellwig

Without this the kernel crashes in kfree for files with a sufficiently large number of extents.

Fixes d4c75a1b40cd ("xfs: convert remaining kmem_free() to kfree()")

LGTM:

Quoted 21 lines
---
 fs/xfs/xfs_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ioctl.c +1 -2
index 7eeebcb6b9250b..7c35d764409720 100644
@@ -1506,7 +1506,7 @@ xfs_ioc_getbmap(
 
 	error = 0;
 out_free_buf:
-	kfree(buf);
+	kvfree(buf);
 	return error;
 }
 
--

2.39.2

Reviewed-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig
Quoted 6 lines · Christoph Hellwig

Without this the kernel crashes in kfree for files with a sufficiently large number of extents.

Fixes d4c75a1b40cd ("xfs: convert remaining kmem_free() to kfree()")

---

Commit d4c75a1b40cd uses sed in-place replace to change kmem_free ->kfree. xfs_ioc_getbmap() allocates buffer using kvcalloc().

Looks good.

-ck