mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Remove BKL from remote_llseek v2
- Replace remote_llseek with generic_file_llseek_unlocked (to force compilation
failures in all users)
- Change all users to either use generic_file_llseek_unlocked directly or
take the BKL around. I changed the file systems who don't use the BKL
for anything (CIFS, GFS) to call it directly. NCPFS and SMBFS and NFS
take the BKL, but explicitely in their own source now.
I moved them all over in a single patch to avoid unbisectable sections.
Open problem: 32bit kernels can corrupt fpos because its modification
is not atomic, but they can do that anyways because there's other paths who
modify it without BKL.
Do we need a special lock for the pos/f_version = 0 checks?
Trond says the NFS BKL is likely not needed, but keep it for now
until his full audit.
v2: Use generic_file_llseek_unlocked instead of remote_llseek_unlocked
and factor duplicated code (suggested by hch)
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Jonathan Corbet <[email protected]>
This commit is contained in:
parent
9c20616c38
commit
9465efc9e9
7 changed files with 42 additions and 34 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
#include "ncplib_kernel.h"
|
||||
|
|
@ -281,9 +282,18 @@ static int ncp_release(struct inode *inode, struct file *file) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static loff_t ncp_remote_llseek(struct file *file, loff_t offset, int origin)
|
||||
{
|
||||
loff_t ret;
|
||||
lock_kernel();
|
||||
ret = generic_file_llseek_unlocked(file, offset, origin);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct file_operations ncp_file_operations =
|
||||
{
|
||||
.llseek = remote_llseek,
|
||||
.llseek = ncp_remote_llseek,
|
||||
.read = ncp_file_read,
|
||||
.write = ncp_file_write,
|
||||
.ioctl = ncp_ioctl,
|
||||
|
|
|
|||
Loading…
Reference in a new issue