Unverified Commit 8daaebaa authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14707 CVE-2024-56746

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/FMBP4X35IKK7HMTVUX3BKMW54XHZ7QCD/ 
Thomas Zimmermann (1):
  fbdev/sh7760fb: Alloc DMA memory from hardware device

Zhen Lei (1):
  fbdev: sh7760fb: Fix a possible memory leak in sh7760fb_alloc_mem()


-- 
2.34.1
 
https://gitee.com/src-openeuler/kernel/issues/IBEGG7 
 
Link:https://gitee.com/openeuler/kernel/pulls/14707

 

Reviewed-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parents 45f5b758 52671c08
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -362,7 +362,7 @@ static void sh7760fb_free_mem(struct fb_info *info)
	if (!info->screen_base)
		return;

	dma_free_coherent(info->dev, info->screen_size,
	dma_free_coherent(info->device, info->screen_size,
			  info->screen_base, par->fbdma);

	par->fbdma = 0;
@@ -411,14 +411,13 @@ static int sh7760fb_alloc_mem(struct fb_info *info)
	if (vram < PAGE_SIZE)
		vram = PAGE_SIZE;

	fbmem = dma_alloc_coherent(info->dev, vram, &par->fbdma, GFP_KERNEL);

	fbmem = dma_alloc_coherent(info->device, vram, &par->fbdma, GFP_KERNEL);
	if (!fbmem)
		return -ENOMEM;

	if ((par->fbdma & SH7760FB_DMA_MASK) != SH7760FB_DMA_MASK) {
		sh7760fb_free_mem(info);
		dev_err(info->dev, "kernel gave me memory at 0x%08lx, which is"
		dma_free_coherent(info->device, vram, fbmem, par->fbdma);
		dev_err(info->device, "kernel gave me memory at 0x%08lx, which is"
			"unusable for the LCDC\n", (unsigned long)par->fbdma);
		return -ENOMEM;
	}
@@ -489,7 +488,7 @@ static int sh7760fb_probe(struct platform_device *pdev)

	ret = sh7760fb_alloc_mem(info);
	if (ret) {
		dev_dbg(info->dev, "framebuffer memory allocation failed!\n");
		dev_dbg(info->device, "framebuffer memory allocation failed!\n");
		goto out_unmap;
	}