diff options
Diffstat (limited to 'drivers/tee')
-rw-r--r-- | drivers/tee/tee_shm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c index 511eb298949b..6f36da9ee412 100644 --- a/drivers/tee/tee_shm.c +++ b/drivers/tee/tee_shm.c @@ -335,9 +335,11 @@ err: idr_remove(&teedev->idr, shm->id); mutex_unlock(&teedev->mutex); } - for (n = 0; n < shm->num_pages; n++) - put_page(shm->pages[n]); - kfree(shm->pages); + if (shm->pages) { + for (n = 0; n < shm->num_pages; n++) + put_page(shm->pages[n]); + kfree(shm->pages); + } } kfree(shm); teedev_ctx_put(ctx); |