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>
This commit is contained in:
parent
087239d3de
commit
dd5635cc18
1 changed files with 2 additions and 2 deletions
|
@ -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
|
* 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
|
* 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];
|
mempool = &diag_mempools[index];
|
||||||
spin_lock_irqsave(&mempool->lock, flags);
|
spin_lock_irqsave(&mempool->lock, flags);
|
||||||
if (mempool->count == 0) {
|
if (mempool->count == 0 && mempool->pool != NULL) {
|
||||||
mempool_destroy(mempool->pool);
|
mempool_destroy(mempool->pool);
|
||||||
mempool->pool = NULL;
|
mempool->pool = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue