Loading drivers/char/diag/diag_masks.c +7 −8 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2008-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved. */ */ #include <linux/slab.h> #include <linux/slab.h> Loading Loading @@ -1367,7 +1367,7 @@ static int diag_cmd_set_all_msg_mask(unsigned char *src_buf, int src_len, info = diag_md_session_get_peripheral(DIAG_LOCAL_PROC, info = diag_md_session_get_peripheral(DIAG_LOCAL_PROC, APPS_DATA); APPS_DATA); ret_val = diag_save_user_msg_mask(info); ret_val = diag_save_user_msg_mask(info); if (ret_val) if (ret_val < 0) pr_err("diag: unable to save msg mask to update userspace clients err:%d\n", pr_err("diag: unable to save msg mask to update userspace clients err:%d\n", ret_val); ret_val); mutex_unlock(&driver->md_session_lock); mutex_unlock(&driver->md_session_lock); Loading Loading @@ -2520,8 +2520,7 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len, return -ENOMEM; return -ENOMEM; } } kmemleak_not_leak(mask_info->update_buf); kmemleak_not_leak(mask_info->update_buf); mask_info->update_buf_client = kzalloc(MAX_USERSPACE_BUF_SIZ, mask_info->update_buf_client = vzalloc(MAX_USERSPACE_BUF_SIZ); GFP_KERNEL); if (!mask_info->update_buf_client) { if (!mask_info->update_buf_client) { kfree(mask_info->update_buf); kfree(mask_info->update_buf); mask_info->update_buf = NULL; mask_info->update_buf = NULL; Loading @@ -2529,7 +2528,6 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len, mask_info->ptr = NULL; mask_info->ptr = NULL; return -ENOMEM; return -ENOMEM; } } kmemleak_not_leak(mask_info->update_buf_client); mask_info->update_buf_client_len = 0; mask_info->update_buf_client_len = 0; } } return 0; return 0; Loading @@ -2545,7 +2543,7 @@ static void __diag_mask_exit(struct diag_mask_info *mask_info) mask_info->ptr = NULL; mask_info->ptr = NULL; kfree(mask_info->update_buf); kfree(mask_info->update_buf); mask_info->update_buf = NULL; mask_info->update_buf = NULL; kfree(mask_info->update_buf_client); vfree(mask_info->update_buf_client); mask_info->update_buf_client = NULL; mask_info->update_buf_client = NULL; mutex_unlock(&mask_info->lock); mutex_unlock(&mask_info->lock); } } Loading Loading @@ -2895,7 +2893,7 @@ static void diag_msg_mask_exit(void) ms_ptr = ms_ptr->next; ms_ptr = ms_ptr->next; } } msg_mask.ms_ptr = NULL; msg_mask.ms_ptr = NULL; kfree(msg_mask.update_buf_client); vfree(msg_mask.update_buf_client); msg_mask.update_buf_client = NULL; msg_mask.update_buf_client = NULL; mutex_unlock(&driver->msg_mask_lock); mutex_unlock(&driver->msg_mask_lock); } } Loading Loading @@ -2991,7 +2989,7 @@ static void diag_log_mask_exit(void) ms_ptr = ms_ptr->next; ms_ptr = ms_ptr->next; } } log_mask.ms_ptr = NULL; log_mask.ms_ptr = NULL; kfree(log_mask.update_buf_client); vfree(log_mask.update_buf_client); log_mask.update_buf_client = NULL; log_mask.update_buf_client = NULL; } } Loading Loading @@ -3088,6 +3086,7 @@ static void diag_event_mask_exit(void) kfree(event_mask.ptr); kfree(event_mask.ptr); kfree(event_mask.update_buf); kfree(event_mask.update_buf); vfree(event_mask.update_buf_client); ms_ptr = (struct diag_multisim_masks *)(event_mask.ms_ptr); ms_ptr = (struct diag_multisim_masks *)(event_mask.ms_ptr); while (ms_ptr) { while (ms_ptr) { kfree(ms_ptr->sub_ptr); kfree(ms_ptr->sub_ptr); Loading Loading
drivers/char/diag/diag_masks.c +7 −8 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2008-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved. */ */ #include <linux/slab.h> #include <linux/slab.h> Loading Loading @@ -1367,7 +1367,7 @@ static int diag_cmd_set_all_msg_mask(unsigned char *src_buf, int src_len, info = diag_md_session_get_peripheral(DIAG_LOCAL_PROC, info = diag_md_session_get_peripheral(DIAG_LOCAL_PROC, APPS_DATA); APPS_DATA); ret_val = diag_save_user_msg_mask(info); ret_val = diag_save_user_msg_mask(info); if (ret_val) if (ret_val < 0) pr_err("diag: unable to save msg mask to update userspace clients err:%d\n", pr_err("diag: unable to save msg mask to update userspace clients err:%d\n", ret_val); ret_val); mutex_unlock(&driver->md_session_lock); mutex_unlock(&driver->md_session_lock); Loading Loading @@ -2520,8 +2520,7 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len, return -ENOMEM; return -ENOMEM; } } kmemleak_not_leak(mask_info->update_buf); kmemleak_not_leak(mask_info->update_buf); mask_info->update_buf_client = kzalloc(MAX_USERSPACE_BUF_SIZ, mask_info->update_buf_client = vzalloc(MAX_USERSPACE_BUF_SIZ); GFP_KERNEL); if (!mask_info->update_buf_client) { if (!mask_info->update_buf_client) { kfree(mask_info->update_buf); kfree(mask_info->update_buf); mask_info->update_buf = NULL; mask_info->update_buf = NULL; Loading @@ -2529,7 +2528,6 @@ static int __diag_mask_init(struct diag_mask_info *mask_info, int mask_len, mask_info->ptr = NULL; mask_info->ptr = NULL; return -ENOMEM; return -ENOMEM; } } kmemleak_not_leak(mask_info->update_buf_client); mask_info->update_buf_client_len = 0; mask_info->update_buf_client_len = 0; } } return 0; return 0; Loading @@ -2545,7 +2543,7 @@ static void __diag_mask_exit(struct diag_mask_info *mask_info) mask_info->ptr = NULL; mask_info->ptr = NULL; kfree(mask_info->update_buf); kfree(mask_info->update_buf); mask_info->update_buf = NULL; mask_info->update_buf = NULL; kfree(mask_info->update_buf_client); vfree(mask_info->update_buf_client); mask_info->update_buf_client = NULL; mask_info->update_buf_client = NULL; mutex_unlock(&mask_info->lock); mutex_unlock(&mask_info->lock); } } Loading Loading @@ -2895,7 +2893,7 @@ static void diag_msg_mask_exit(void) ms_ptr = ms_ptr->next; ms_ptr = ms_ptr->next; } } msg_mask.ms_ptr = NULL; msg_mask.ms_ptr = NULL; kfree(msg_mask.update_buf_client); vfree(msg_mask.update_buf_client); msg_mask.update_buf_client = NULL; msg_mask.update_buf_client = NULL; mutex_unlock(&driver->msg_mask_lock); mutex_unlock(&driver->msg_mask_lock); } } Loading Loading @@ -2991,7 +2989,7 @@ static void diag_log_mask_exit(void) ms_ptr = ms_ptr->next; ms_ptr = ms_ptr->next; } } log_mask.ms_ptr = NULL; log_mask.ms_ptr = NULL; kfree(log_mask.update_buf_client); vfree(log_mask.update_buf_client); log_mask.update_buf_client = NULL; log_mask.update_buf_client = NULL; } } Loading Loading @@ -3088,6 +3086,7 @@ static void diag_event_mask_exit(void) kfree(event_mask.ptr); kfree(event_mask.ptr); kfree(event_mask.update_buf); kfree(event_mask.update_buf); vfree(event_mask.update_buf_client); ms_ptr = (struct diag_multisim_masks *)(event_mask.ms_ptr); ms_ptr = (struct diag_multisim_masks *)(event_mask.ms_ptr); while (ms_ptr) { while (ms_ptr) { kfree(ms_ptr->sub_ptr); kfree(ms_ptr->sub_ptr); Loading