Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297265
b: refs/heads/master
c: d15cab9
h: refs/heads/master
i:
  297263: abbc3a0
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Mar 29, 2012
1 parent b07f3f8 commit 77ade68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29fd66d289f2981e11c550f8b411a6d3d38be0cf
refs/heads/master: d15cab975459fb6092eeba1be72c13621337784f
3 changes: 3 additions & 0 deletions trunk/include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ struct bio;
#define SWAP_FLAG_PRIO_SHIFT 0
#define SWAP_FLAG_DISCARD 0x10000 /* discard swap cluster after use */

#define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \
SWAP_FLAG_DISCARD)

static inline int current_is_kswapd(void)
{
return current->flags & PF_KSWAPD;
Expand Down
3 changes: 3 additions & 0 deletions trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,9 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
struct page *page = NULL;
struct inode *inode = NULL;

if (swap_flags & ~SWAP_FLAGS_VALID)
return -EINVAL;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

Expand Down

0 comments on commit 77ade68

Please sign in to comment.