Skip to contentSkip to conversation

vfs: fix check for fallocate on active swapfile

PATCH In review Eric Biggers 2 participants 2 messages Jun 25, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: fix check for fallocate on active swapfile

Fix the broken check for calling sys_fallocate() on an active swapfile, introduced by commit 0790b31b69374ddadefe ("fs: disallow all fallocate operation on active swapfile").

---
 fs/open.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/open.c +2 -3
index 36662d0..d6fd3ac 100644
@@ -263,11 +263,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EPERM;
 
 	/*
-	 * We can not allow to do any fallocate operation on an active
-	 * swapfile
+	 * We cannot allow any fallocate operation on an active swapfile
 	 */
 	if (IS_SWAPFILE(inode))
-		ret = -ETXTBSY;
+		return -ETXTBSY;
 
 	/*
 	 * Revalidate the write permissions, in case security policy has
Signature · 1 line
2.0.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Biggers

Date: Tue, 24 Jun 2014 23:45:08 -0500
From: Eric Biggers <[email protected]>
To: [email protected]
Cc: [email protected], Eric Biggers <[email protected]>
Subject: [PATCH] vfs: fix check for fallocate on active swapfile

Fix the broken check for calling sys_fallocate() on an active swapfile, introduced by commit 0790b31b69374ddadefe ("fs: disallow all fallocate operation on active swapfile").

Oops, good catch, Thanks!

Quoted 25 lines
---
 fs/open.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/open.c +2 -3
index 36662d0..d6fd3ac 100644
@@ -263,11 +263,10 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EPERM;
 
 	/*
-	 * We can not allow to do any fallocate operation on an active
-	 * swapfile
+	 * We cannot allow any fallocate operation on an active swapfile
 	 */
 	if (IS_SWAPFILE(inode))
-		ret = -ETXTBSY;
+		return -ETXTBSY;
 
 	/*
 	 * Revalidate the write permissions, in case security policy has