diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2017-07-25 18:20:49 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-07-27 03:24:36 -0400 |
commit | 1b5035132b8f28cb05a21eca4d2f7a4771e59914 (patch) | |
tree | 4600af8dc895a4e30f92b6d18e3e339a57f16177 /drivers/gpu/nvgpu | |
parent | 542a75a949186fa02880b606f606effa5bd04bd8 (diff) |
gpu: nvgpu: check for null priv in channel_release
gk20a_channel_release can still get called even if the open_channel call failed
(e.g., if we ran out of hw chids), in which case priv is null. Check for this
case and return if null.
Bug 1964531
Change-Id: I48bc88e4dbd88a1c30fc399de629d8f8b344cfd9
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1526544
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 2242e19e..ab02dc42 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -281,11 +281,20 @@ struct channel_gk20a *gk20a_get_channel_from_file(int fd) | |||
281 | int gk20a_channel_release(struct inode *inode, struct file *filp) | 281 | int gk20a_channel_release(struct inode *inode, struct file *filp) |
282 | { | 282 | { |
283 | struct channel_priv *priv = filp->private_data; | 283 | struct channel_priv *priv = filp->private_data; |
284 | struct channel_gk20a *ch = priv->c; | 284 | struct channel_gk20a *ch; |
285 | struct gk20a *g = priv->g; | 285 | struct gk20a *g; |
286 | 286 | ||
287 | int err; | 287 | int err; |
288 | 288 | ||
289 | /* We could still end up here even if the channel_open failed, e.g. | ||
290 | * if we ran out of hw channel IDs. | ||
291 | */ | ||
292 | if (!priv) | ||
293 | return 0; | ||
294 | |||
295 | ch = priv->c; | ||
296 | g = priv->g; | ||
297 | |||
289 | err = gk20a_busy(g); | 298 | err = gk20a_busy(g); |
290 | if (err) { | 299 | if (err) { |
291 | nvgpu_err(g, "failed to release a channel!"); | 300 | nvgpu_err(g, "failed to release a channel!"); |