Loading drivers/char/diag/diagchar_core.c +27 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -376,6 +376,8 @@ static int diagchar_open(struct inode *inode, struct file *file) if (driver->ref_count == 0) diag_mempool_init(); driver->ref_count++; DIAG_LOG(DIAG_DEBUG_USERSPACE, "diag: open successful for client pid: %d\n", current->tgid); mutex_unlock(&driver->diagchar_mutex); return 0; } Loading Loading @@ -3794,6 +3796,9 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, if (driver->data_ready[index] & MSG_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: msg masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & MSG_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading @@ -3815,11 +3820,19 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= MSG_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: msg masks update complete for client pid: %d\n", current->tgid); goto exit; } if (driver->data_ready[index] & EVENT_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: event masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & EVENT_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading Loading @@ -3852,11 +3865,19 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= EVENT_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: %s: event masks update complete for client pid: %d\n", current->tgid); goto exit; } if (driver->data_ready[index] & LOG_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: log masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & LOG_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading @@ -3878,6 +3899,11 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= LOG_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: log masks update complete for client pid: %d\n", current->tgid); goto exit; } Loading Loading
drivers/char/diag/diagchar_core.c +27 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved. */ #include <linux/slab.h> Loading Loading @@ -376,6 +376,8 @@ static int diagchar_open(struct inode *inode, struct file *file) if (driver->ref_count == 0) diag_mempool_init(); driver->ref_count++; DIAG_LOG(DIAG_DEBUG_USERSPACE, "diag: open successful for client pid: %d\n", current->tgid); mutex_unlock(&driver->diagchar_mutex); return 0; } Loading Loading @@ -3794,6 +3796,9 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, if (driver->data_ready[index] & MSG_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: msg masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & MSG_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading @@ -3815,11 +3820,19 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= MSG_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: msg masks update complete for client pid: %d\n", current->tgid); goto exit; } if (driver->data_ready[index] & EVENT_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: event masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & EVENT_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading Loading @@ -3852,11 +3865,19 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= EVENT_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: %s: event masks update complete for client pid: %d\n", current->tgid); goto exit; } if (driver->data_ready[index] & LOG_MASKS_TYPE) { /*Copy the type of data being passed*/ DIAG_LOG(DIAG_DEBUG_MASKS, "diag: log masks update to client pid: %d\n", current->tgid); data_type = driver->data_ready[index] & LOG_MASKS_TYPE; mutex_unlock(&driver->diagchar_mutex); mutex_lock(&driver->md_session_lock); Loading @@ -3878,6 +3899,11 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count, mutex_lock(&driver->diagchar_mutex); driver->data_ready[index] ^= LOG_MASKS_TYPE; atomic_dec(&driver->data_ready_notif[index]); DIAG_LOG(DIAG_DEBUG_MASKS, "diag: log masks update complete for client pid: %d\n", current->tgid); goto exit; } Loading