mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
fuse: fix pipe_buf_operations
Having this struct in module memory could Oops when if the module is unloaded while the buffer still persists in a pipe. Since sock_pipe_buf_ops is essentially the same as fuse_dev_pipe_buf_steal merge them into nosteal_pipe_buf_ops (this is the same as default_pipe_buf_ops except stealing the page from the buffer is not allowed). Reported-by: Al Viro <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> Cc: [email protected]
This commit is contained in:
parent
d8ec26d7f8
commit
28a625cbc2
4 changed files with 26 additions and 48 deletions
18
fs/splice.c
18
fs/splice.c
|
|
@ -555,6 +555,24 @@ static const struct pipe_buf_operations default_pipe_buf_ops = {
|
|||
.get = generic_pipe_buf_get,
|
||||
};
|
||||
|
||||
static int generic_pipe_buf_nosteal(struct pipe_inode_info *pipe,
|
||||
struct pipe_buffer *buf)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Pipe buffer operations for a socket and similar. */
|
||||
const struct pipe_buf_operations nosteal_pipe_buf_ops = {
|
||||
.can_merge = 0,
|
||||
.map = generic_pipe_buf_map,
|
||||
.unmap = generic_pipe_buf_unmap,
|
||||
.confirm = generic_pipe_buf_confirm,
|
||||
.release = generic_pipe_buf_release,
|
||||
.steal = generic_pipe_buf_nosteal,
|
||||
.get = generic_pipe_buf_get,
|
||||
};
|
||||
EXPORT_SYMBOL(nosteal_pipe_buf_ops);
|
||||
|
||||
static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
|
||||
unsigned long vlen, loff_t offset)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue