kernel: we should take ownership over fd

This commit is contained in:
weishu
2024-03-21 14:15:11 +08:00
parent b3a15e2b6b
commit e38a5e52d2

View File

@@ -388,11 +388,13 @@ int ksu_handle_vfs_read(struct file **file_ptr, char __user **buf_ptr,
int ksu_handle_sys_read(unsigned int fd, char __user **buf_ptr, size_t *count_ptr) int ksu_handle_sys_read(unsigned int fd, char __user **buf_ptr, size_t *count_ptr)
{ {
struct file *file = fget_raw(fd); struct file *file = fget(fd);
if (!file) { if (!file) {
return 0; return 0;
} }
return ksu_handle_vfs_read(&file, buf_ptr, count_ptr, NULL); int result = ksu_handle_vfs_read(&file, buf_ptr, count_ptr, NULL);
fput(file);
return result;
} }
static unsigned int volumedown_pressed_count = 0; static unsigned int volumedown_pressed_count = 0;