* [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails
@ 2012-06-23 0:41 Subash Patel
2012-06-23 0:47 ` Olof Johansson
0 siblings, 1 reply; 4+ messages in thread
From: Subash Patel @ 2012-06-23 0:41 UTC (permalink / raw)
To: dri-devel
Cc: linaro-mm-sig, Subash Patel, inki.dae, subash.ramaswamy, airlied,
olofj
From: Subash Patel <subash.rp@samsung.com>
exynos_pages_to_sg() internally calls sg_kmalloc() which can return
no pages when the system is under high memory crunch. One such instance
is chromeos-install in the chromeos. This patch adds check for the return
value of the function in subject to return NULL on failure.
BUG=chrome-os-partner:9481
TEST=built, ran on snow and tried chromeos-install without a crash
Change-Id: I0abda74beaedae002a17de9962d7a462a2a7c2fb
Signed-off-by: Subash Patel <subash.rp@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 97325c1..c908a29 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -87,6 +87,10 @@ static struct sg_table *
npages = buf->size / buf->page_size;
sgt = exynos_pages_to_sg(buf->pages, npages, buf->page_size);
+ if (!sgt) {
+ DRM_DEBUG_PRIME("exynos_pages_to_sg returned NULL!\n");
+ goto err_unlock;
+ }
nents = dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir);
DRM_DEBUG_PRIME("npages = %d buffer size = 0x%lx page_size = 0x%lx\n",
@@ -241,7 +245,7 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
- if (IS_ERR(sgt)) {
+ if (IS_ERR_OR_NULL(sgt)) {
ret = PTR_ERR(sgt);
goto err_buf_detach;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails
2012-06-23 0:41 [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails Subash Patel
@ 2012-06-23 0:47 ` Olof Johansson
2012-06-23 0:54 ` "Subash Patel (ಸುಭಾಷ್)"
0 siblings, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2012-06-23 0:47 UTC (permalink / raw)
To: Subash Patel
Cc: linaro-mm-sig, Subash Patel, dri-devel, inki.dae,
subash.ramaswamy, airlied
[-- Attachment #1.1: Type: text/plain, Size: 759 bytes --]
Hi,
On Fri, Jun 22, 2012 at 5:41 PM, Subash Patel <subashrp@gmail.com> wrote:
> From: Subash Patel <subash.rp@samsung.com>
>
> exynos_pages_to_sg() internally calls sg_kmalloc() which can return
> no pages when the system is under high memory crunch. One such instance
> is chromeos-install in the chromeos. This patch adds check for the return
> value of the function in subject to return NULL on failure.
>
> BUG=chrome-os-partner:9481
> TEST=built, ran on snow and tried chromeos-install without a crash
>
> Change-Id: I0abda74beaedae002a17de9962d7a462a2a7c2fb
> Signed-off-by: Subash Patel <subash.rp@samsung.com>
>
No BUG/TEST/Change-Id on a public patch, please. Also, I didn't see this
posted on neither samsung-soc, nor the dri-devel list?
-Olof
[-- Attachment #1.2: Type: text/html, Size: 1301 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails
2012-06-23 0:47 ` Olof Johansson
@ 2012-06-23 0:54 ` "Subash Patel (ಸುಭಾಷ್)"
0 siblings, 0 replies; 4+ messages in thread
From: "Subash Patel (ಸುಭಾಷ್)" @ 2012-06-23 0:54 UTC (permalink / raw)
To: Olof Johansson
Cc: linaro-mm-sig, Subash Patel, dri-devel, inki.dae,
subash.ramaswamy, airlied
Hi Olof,
I will then rework this patch commit message and send it. I will copy
Samsung-soc list (dri-devel is already in copy)
Regards,
Subash
On 06/22/2012 05:47 PM, Olof Johansson wrote:
> Hi,
>
> On Fri, Jun 22, 2012 at 5:41 PM, Subash Patel <subashrp@gmail.com
> <mailto:subashrp@gmail.com>> wrote:
>
> From: Subash Patel <subash.rp@samsung.com
> <mailto:subash.rp@samsung.com>>
>
> exynos_pages_to_sg() internally calls sg_kmalloc() which can return
> no pages when the system is under high memory crunch. One such instance
> is chromeos-install in the chromeos. This patch adds check for the
> return
> value of the function in subject to return NULL on failure.
>
> BUG=chrome-os-partner:9481
> TEST=built, ran on snow and tried chromeos-install without a crash
>
> Change-Id: I0abda74beaedae002a17de9962d7a462a2a7c2fb
> Signed-off-by: Subash Patel <subash.rp@samsung.com
> <mailto:subash.rp@samsung.com>>
>
>
> No BUG/TEST/Change-Id on a public patch, please. Also, I didn't see this
> posted on neither samsung-soc, nor the dri-devel list?
>
>
> -Olof
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails
@ 2012-06-23 1:12 Subash Patel
0 siblings, 0 replies; 4+ messages in thread
From: Subash Patel @ 2012-06-23 1:12 UTC (permalink / raw)
To: dri-devel, linux-samsung-soc, linaro-mm-sig
Cc: olofj, inki.dae, airlied, Subash Patel, Subash Patel
From: Subash Patel <subash.rp@samsung.com>
exynos_pages_to_sg() internally calls sg_kmalloc() which can return
no pages when the system is under high memory crunch. One such instance
is chromeos-install in the chromeos. This patch adds check for the return
value of the function in subject to return NULL on failure.
Signed-off-by: Subash Patel <subash.ramaswamy@linaro.org>
CC: dri-devel@lists.freedesktop.org
CC: linux-samsung-soc@vger.kernel.org
CC: linaro-mm-sig@lists.linaro.org
CC: inki.dae@samsung.com
CC: airlied@redhat.com
CC: olofj@chromium.org
---
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 97325c1..c908a29 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -87,6 +87,10 @@ static struct sg_table *
npages = buf->size / buf->page_size;
sgt = exynos_pages_to_sg(buf->pages, npages, buf->page_size);
+ if (!sgt) {
+ DRM_DEBUG_PRIME("exynos_pages_to_sg returned NULL!\n");
+ goto err_unlock;
+ }
nents = dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir);
DRM_DEBUG_PRIME("npages = %d buffer size = 0x%lx page_size = 0x%lx\n",
@@ -241,7 +245,7 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
- if (IS_ERR(sgt)) {
+ if (IS_ERR_OR_NULL(sgt)) {
ret = PTR_ERR(sgt);
goto err_buf_detach;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-23 1:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-23 0:41 [PATCH] DRM: exynos: return NULL if exynos_pages_to_sg fails Subash Patel
2012-06-23 0:47 ` Olof Johansson
2012-06-23 0:54 ` "Subash Patel (ಸುಭಾಷ್)"
-- strict thread matches above, loose matches on Subject: below --
2012-06-23 1:12 Subash Patel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.