summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorChris Lew <clew@codeaurora.org>2015-12-11 16:39:40 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:16:39 -0700
commit5c2eccfd173b60e759df766ab1549e28261bf143 (patch)
tree5ba64ec780cdfd13925f44c9d22f9c0fb1c8754b /drivers/char
parentbed86158567f590c46a980d6baf0732c489fa860 (diff)
diag: Change dci packet header validation for data from user space
DCI packet header validation fails when there are multiple masks enabled in the packet type. Change the validation from comparing each individual mask to the bitwise OR of all packet types. Change-Id: Ie0131646f49a93ec85bd1ae5e02b89639f0cfc2c Signed-off-by: Chris Lew <clew@codeaurora.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/diag/diagchar_core.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c
index 22529d2d9b98..476d05562e7c 100644
--- a/drivers/char/diag/diagchar_core.c
+++ b/drivers/char/diag/diagchar_core.c
@@ -2387,12 +2387,8 @@ static int diag_user_process_dci_apps_data(const char __user *buf, int len,
return -EBADMSG;
}
- switch (pkt_type) {
- case DCI_PKT_TYPE:
- case DATA_TYPE_DCI_LOG:
- case DATA_TYPE_DCI_EVENT:
- break;
- default:
+ pkt_type &= (DCI_PKT_TYPE | DATA_TYPE_DCI_LOG | DATA_TYPE_DCI_EVENT);
+ if (!pkt_type) {
pr_err_ratelimited("diag: In %s, invalid pkt_type: %d\n",
__func__, pkt_type);
return -EBADMSG;