diff options
author | David Howells <dhowells@redhat.com> | 2018-04-09 22:12:31 +0200 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-04-09 22:12:31 +0200 |
commit | 17814aef57fc0b80ac2a4a7a639db358b75cb6b9 (patch) | |
tree | 9d9a28e5811304439cc3cc9911c124801e8b27a8 /fs/afs/proc.c | |
parent | afs: Fix checker warnings (diff) | |
download | linux-17814aef57fc0b80ac2a4a7a639db358b75cb6b9.tar.xz linux-17814aef57fc0b80ac2a4a7a639db358b75cb6b9.zip |
afs: Don't over-increment the cell usage count when pinning it
AFS cells that are added or set as the workstation cell through /proc are
pinned against removal by setting the AFS_CELL_FL_NO_GC flag on them and
taking a ref. The ref should be only taken if the flag wasn't already set.
Fix this by making it conditional.
Without this an assertion failure will occur during module removal
indicating that the refcount is too elevated.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r-- | fs/afs/proc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 1c95756335b7..2f04d37eeef0 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c @@ -284,7 +284,8 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf, goto done; } - set_bit(AFS_CELL_FL_NO_GC, &cell->flags); + if (test_and_set_bit(AFS_CELL_FL_NO_GC, &cell->flags)) + afs_put_cell(net, cell); printk("kAFS: Added new cell '%s'\n", name); } else { goto inval; |