Commit 2c7d850
video: hyperv_fb: Fix a double free in hvfb_probe
[ Upstream commit 37df9f3 ]
Function hvfb_probe() calls hvfb_getmem(), expecting upon return that
info->apertures is either NULL or points to memory that should be freed
by framebuffer_release(). But hvfb_getmem() is freeing the memory and
leaving the pointer non-NULL, resulting in a double free if an error
occurs or later if hvfb_remove() is called.
Fix this by removing all kfree(info->apertures) calls in hvfb_getmem().
This will allow framebuffer_release() to free the memory, which follows
the pattern of other fbdev drivers.
Fixes: 3a6fb6c ("video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20210324103724.4189-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent a267a7e commit 2c7d850
1 file changed
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | | - | |
1035 | 1034 | | |
1036 | 1035 | | |
1037 | 1036 | | |
| |||
1129 | 1128 | | |
1130 | 1129 | | |
1131 | 1130 | | |
1132 | | - | |
1133 | 1131 | | |
1134 | 1132 | | |
1135 | 1133 | | |
| |||
1141 | 1139 | | |
1142 | 1140 | | |
1143 | 1141 | | |
1144 | | - | |
1145 | 1142 | | |
1146 | 1143 | | |
1147 | 1144 | | |
| |||
0 commit comments