diff options
author | Deepak Goyal <dgoyal@nvidia.com> | 2018-02-01 00:30:27 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-02-06 13:01:48 -0500 |
commit | 9402f4165b7a5568363f793e47bb893719639ca2 (patch) | |
tree | 7f09cac7392366c77e5da83e3b4daabb6f023b83 /drivers/gpu/nvgpu/gm20b | |
parent | 0c0d6ba4880f841e26183c26637e54d7a7a9a4dc (diff) |
gpu: nvgpu: fix out of bounds access
lsf_ucode_desc_v1 has more size than signature bin.
In memcpy(dest, src, size_to_copy) usage, "size_to_copy"
is more than "size of the src" which is causing out of bounds
access.
Bug 2051856
NVGPU-507
Change-Id: I0aad34df39f95f7e95ccb10539e1fae9f65361a8
Signed-off-by: Deepak Goyal <dgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1650140
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index 62d3a8fa..c57fba45 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -138,7 +138,8 @@ static int pmu_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
138 | err = -ENOMEM; | 138 | err = -ENOMEM; |
139 | goto release_sig; | 139 | goto release_sig; |
140 | } | 140 | } |
141 | memcpy(lsf_desc, (void *)pmu_sig->data, sizeof(struct lsf_ucode_desc)); | 141 | memcpy(lsf_desc, (void *)pmu_sig->data, |
142 | min_t(size_t, sizeof(*lsf_desc), pmu_sig->size)); | ||
142 | lsf_desc->falcon_id = LSF_FALCON_ID_PMU; | 143 | lsf_desc->falcon_id = LSF_FALCON_ID_PMU; |
143 | 144 | ||
144 | p_img->desc = pmu->desc; | 145 | p_img->desc = pmu->desc; |
@@ -177,7 +178,8 @@ static int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
177 | err = -ENOMEM; | 178 | err = -ENOMEM; |
178 | goto rel_sig; | 179 | goto rel_sig; |
179 | } | 180 | } |
180 | memcpy(lsf_desc, (void *)fecs_sig->data, sizeof(struct lsf_ucode_desc)); | 181 | memcpy(lsf_desc, (void *)fecs_sig->data, |
182 | min_t(size_t, sizeof(*lsf_desc), fecs_sig->size)); | ||
181 | lsf_desc->falcon_id = LSF_FALCON_ID_FECS; | 183 | lsf_desc->falcon_id = LSF_FALCON_ID_FECS; |
182 | 184 | ||
183 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); | 185 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); |
@@ -248,7 +250,7 @@ static int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img *p_img) | |||
248 | goto rel_sig; | 250 | goto rel_sig; |
249 | } | 251 | } |
250 | memcpy(lsf_desc, (void *)gpccs_sig->data, | 252 | memcpy(lsf_desc, (void *)gpccs_sig->data, |
251 | sizeof(struct lsf_ucode_desc)); | 253 | min_t(size_t, sizeof(*lsf_desc), gpccs_sig->size)); |
252 | lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS; | 254 | lsf_desc->falcon_id = LSF_FALCON_ID_GPCCS; |
253 | 255 | ||
254 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); | 256 | p_img->desc = nvgpu_kzalloc(g, sizeof(struct pmu_ucode_desc)); |