diff options
| author | Mohit Aggarwal <maggarwa@codeaurora.org> | 2017-03-06 10:46:20 +0530 |
|---|---|---|
| committer | Mohit Aggarwal <maggarwa@codeaurora.org> | 2017-03-06 11:52:50 +0530 |
| commit | b8cd1fca023280e30ff69eeab0e249abbd4c5405 (patch) | |
| tree | 8157d76bb7ee6bd1db6d9729c154f95d6374143b | |
| parent | 796d604a032ac3051e7879fcbf317c2edba7ba4e (diff) | |
diag: Add NULL pointer checks in mask updates
Currently, NULL pointer checks are missing in mask
update functions which might lead to NULL pointer
dereference issues. This patch fixes the issue by
adding appropriate checks.
CRs-Fixed: 2015104
Change-Id: I9df99208e283c8d90921c6e20a6a80f88c18a327
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
| -rw-r--r-- | drivers/char/diag/diag_masks.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/char/diag/diag_masks.c b/drivers/char/diag/diag_masks.c index a1721a3b80cc..44e71a704e6a 100644 --- a/drivers/char/diag/diag_masks.c +++ b/drivers/char/diag/diag_masks.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2008-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -112,10 +112,12 @@ static void diag_send_log_mask_update(uint8_t peripheral, int equip_id) else mask_info = &log_mask; - if (!mask_info) + if (!mask_info || !mask_info->ptr || !mask_info->update_buf) return; mask = (struct diag_log_mask_t *)mask_info->ptr; + if (!mask->ptr) + return; buf = mask_info->update_buf; switch (mask_info->status) { @@ -224,7 +226,7 @@ static void diag_send_event_mask_update(uint8_t peripheral) else mask_info = &event_mask; - if (!mask_info) + if (!mask_info || !mask_info->ptr || !mask_info->update_buf) return; buf = mask_info->update_buf; @@ -305,10 +307,12 @@ static void diag_send_msg_mask_update(uint8_t peripheral, int first, int last) else mask_info = &msg_mask; - if (!mask_info) + if (!mask_info || !mask_info->ptr || !mask_info->update_buf) return; mask = (struct diag_msg_mask_t *)mask_info->ptr; + if (!mask->ptr) + return; buf = mask_info->update_buf; mutex_lock(&mask_info->lock); switch (mask_info->status) { |
