[PATCH] gma/gma500: fix a memory disclosure bug due to uninitialized bytes

2019-10-17 Thread Kangjie Lu
`best_clock` is an object that may be sent out. Object `clock` contains uninitialized bytes that are copied to `best_clock`, which leads to memory disclosure and information leak. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 ++ 1 file changed, 2 insertions

[PATCH] drm/gma500: fix memory disclosures due to uninitialized bytes

2019-10-17 Thread Kangjie Lu
"clock" may be copied to "best_clock". Initializing best_clock is not sufficient. The fix initializes clock as well to avoid memory disclosures and informaiton leaks. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 ++ 1 file changed, 2 inserti

[PATCH v2] gpu: radeon: fix a potential NULL-pointer dereference

2019-03-26 Thread Kangjie Lu
In case alloc_workqueue fails, the fix frees memory and returns -ENOMEM to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- v2: use radeon_crtc_destroy to properly clean up resources as suggested by Michel Dänzer --- drivers/gpu/drm/radeon/radeon_display.c | 15

[PATCH] gpu: v3d: fix a missing check of pm_runtime_get_sync

2019-03-25 Thread Kangjie Lu
pm_runtime_get_sync could fail and thus deserves a check. The patch adds such a check and return its error code upstream if it indeed failed. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/v3d/v3d_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b

[PATCH v2] drm: vkms: check status of alloc_ordered_workqueue

2019-03-24 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. The fix cleans up drm plans and returns ENOMEM when it fails to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- V2: clean up resources --- drivers/gpu/drm/vkms/vkms_crtc.c | 11 +++ 1 file changed, 11 insertions

[PATCH] gpu: radeon: fix a potential NULL-pointer dereference

2019-03-24 Thread Kangjie Lu
In case alloc_workqueue fails, the fix frees memory and returns to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/radeon/radeon_display.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm

Re: [PATCH] drm: vkms: check status of alloc_ordered_workqueue

2019-03-24 Thread Kangjie Lu
> On Mar 8, 2019, at 10:36 PM, Kangjie Lu wrote: > > alloc_ordered_workqueue may fail and return NULL. > The fix returns ENOMEM when it fails to avoid potential NULL > pointer dereference. > > Signed-off-by: Kangjie Lu > --- > drivers/gpu/drm/vkms/vkms_crtc.c

Re: [PATCH] gpu: amdkfd: fix a missing check of kmemdup

2019-03-24 Thread Kangjie Lu
> On Mar 8, 2019, at 10:19 PM, Kangjie Lu wrote: > > kmemdup could fail and return NULL. To avoid null pointer > dereference, the fix checkes its return value and returns > ENOMEM upon failures. This is a NULL-pointer dereference issue. Can someone review this patch? Thanks.

[PATCH] video: fbdev: fix potential NULL pointer dereferences

2019-03-14 Thread Kangjie Lu
In case ioremap fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu --- drivers/video/fbdev/imsttfb.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index

[PATCH] video: hgafb: fix a NULL pointer dereference

2019-03-14 Thread Kangjie Lu
When ioremap fails, hga_vram should not be dereferenced. The fix check the failure to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/video/fbdev/hgafb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c index

[PATCH] drm: check if alloc_workqueue fails

2019-03-09 Thread Kangjie Lu
alloc_workqueue may fail. The fix checks its status. We probably need to add a return value for radeon_crtc_init, so that we can pass an error code upstream. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/radeon/radeon_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu

[PATCH] gpu: i915: fix a missing check of get_free_page

2019-03-09 Thread Kangjie Lu
If the allocation fails, return false to avoid potential NULL pointer dereference Signed-off-by: Kangjie Lu --- drivers/gpu/drm/i915/i915_gpu_error.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915

[PATCH] gpu: amdkfd: fix a missing check of kmemdup

2019-03-09 Thread Kangjie Lu
kmemdup could fail and return NULL. To avoid null pointer dereference, the fix checkes its return value and returns ENOMEM upon failures. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd

[PATCH] drm: vkms: check status of alloc_ordered_workqueue

2019-03-09 Thread Kangjie Lu
alloc_ordered_workqueue may fail and return NULL. The fix returns ENOMEM when it fails to avoid potential NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/vkms/vkms_crtc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu

[PATCH] backlight: (adp8870) fix a missing check for adp8870_write

2018-12-26 Thread Kangjie Lu
adp8870_write() may fail. This fix checks if adp8870_write fails, and if so, returns its error code. Signed-off-by: Kangjie Lu --- drivers/video/backlight/adp8870_bl.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers

[PATCH] gpu: drm: fix an improper check of amdgpu_bo_create_kernel

2018-12-26 Thread Kangjie Lu
adev->firmware.fw_buf being not NULL may not indicate kernel buffer is created successful. A better way is to check the status (return value) of it. The fix does so. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 18 -- 1 file changed, 12 inserti

Re: [PATCH v2] gpu: anx7808: fix a missing check in anx78xx_poweron

2018-12-26 Thread Kangjie Lu
Please ignore this email. I've sent another one. On Mon, Dec 24, 2018 at 11:02 PM Kangjie Lu wrote: > Both anx78xx_set_bits() and anx78xx_clear_bits() in the poweron process > may fail. The fix inserts checks for their return values. > > Signed-off-by: Kangjie Lu > --

[PATCH v2] gpu: anx7808: fix a missing check in anx78xx_poweron

2018-12-26 Thread Kangjie Lu
Both anx78xx_set_bits() and anx78xx_clear_bits() in the poweron process may fail. The fix inserts checks for their return values. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/bridge/analogix-anx78xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c

[PATCH v2] gpu: anx7808: fix a missing check in anx78xx_poweron

2018-12-26 Thread Kangjie Lu
Both anx78xx_set_bits() and anx78xx_clear_bits() in the poweron process may fail. The fix inserts checks for their return values. Signed-off-by: Kangjie Lu --- drivers/gpu/drm/bridge/analogix-anx78xx.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a

Re: [PATCH] gpu: anx7808: fix a missing check of return value

2018-12-23 Thread Kangjie Lu
Thanks for the tip! Will submit patch V2 soon. On Thu, Dec 20, 2018 at 11:07 PM Laurent Pinchart < laurent.pinch...@ideasonboard.com> wrote: > Hi Kangjie, > > Thank you for the patch. > > On Thursday, 20 December 2018 09:41:16 EET Kangjie Lu wrote: > >

[PATCH] gpu: anx7808: fix a missing check of return value

2018-12-20 Thread Kangjie Lu
Both anx78xx_set_bits() and anx78xx_clear_bits() in the poweron process may fail. The fix inserts checks for their return values. If the poweron process fails, it calls anx78xx_poweroff(). Signed-off-by: Kangjie Lu --- drivers/gpu/drm/bridge/analogix-anx78xx.c | 26 --- 1