Skip to content

Commit

Permalink
msm: vidc: Set file private data to NULL on close
Browse files Browse the repository at this point in the history
Set file private data to NULL on closing instance
to avoid invalid access after close.

Change-Id: I447791463d9dbe32e25237256589bb07be2c3a32
Signed-off-by: Surajit Podder <spodder@codeaurora.org>
  • Loading branch information
Surajit Podder authored and Gerrit - the friendly Code Review server committed Jan 27, 2018
1 parent 0043153 commit 4602395
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/platform/msm/vidc/msm_v4l2_vidc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
Expand Down Expand Up @@ -39,6 +39,8 @@ struct msm_vidc_drv *vidc_driver;

static inline struct msm_vidc_inst *get_vidc_inst(struct file *filp, void *fh)
{
if (!filp->private_data)
return NULL;
return container_of(filp->private_data,
struct msm_vidc_inst, event_handler);
}
Expand Down Expand Up @@ -74,6 +76,7 @@ static int msm_v4l2_close(struct file *filp)
vidc_inst = get_vidc_inst(filp, NULL);

rc = msm_vidc_close(vidc_inst);
filp->private_data = NULL;
trace_msm_v4l2_vidc_close_end("msm_v4l2_close end");
return rc;
}
Expand Down

0 comments on commit 4602395

Please sign in to comment.