diff options
| author | Manoj Prabhu B <bmanoj@codeaurora.org> | 2016-02-24 09:52:09 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-25 16:02:27 -0700 |
| commit | dd5635cc18eb9b54f95abb7b3fffb413db48b063 (patch) | |
| tree | b798d0b27ec4c7d4619f8d661cba313167f69b55 | |
| parent | 087239d3de29741c0b1b2ed386f1c3245b63afb1 (diff) | |
diag: Fix possible null pointer dereference
This patch checks for Null Pointer dereference before destroying the
diag mempools.
CRs-Fixed: 980428
Change-Id: I0e8fc8aa82ad26263bd9d47cbdd22de212efe489
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
| -rw-r--r-- | drivers/char/diag/diagmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/diag/diagmem.c b/drivers/char/diag/diagmem.c index f8a650b3fa6a..3d9fceddb893 100644 --- a/drivers/char/diag/diagmem.c +++ b/drivers/char/diag/diagmem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2008-2014, 2016, 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 @@ -282,7 +282,7 @@ void diagmem_exit(struct diagchar_dev *driver, int index) mempool = &diag_mempools[index]; spin_lock_irqsave(&mempool->lock, flags); - if (mempool->count == 0) { + if (mempool->count == 0 && mempool->pool != NULL) { mempool_destroy(mempool->pool); mempool->pool = NULL; } else { |
