Re: [PATCH] drm: fix cliprects leaking in drm_rmdraw()
On Fri, 2008-10-17 at 02:04 -0700, Keith Packard wrote: > On Fri, 2008-10-17 at 15:48 +0800, Zhenyu Wang wrote: > > On 2008.10.16 23:27:12 -0700, Eric Anholt wrote: > > > On Fri, 2008-10-17 at 13:16 +0800, Zhenyu Wang wrote: > > > > From 4aab96c10fca2d5a3f89e56a4d6a96c6125cf932 Mon Sep 17 00:00:00 2001 > > > > From: Zhenyu Wang <[EMAIL PROTECTED]> > > > > Date: Fri, 17 Oct 2008 11:32:32 +0800 > > > > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > > > > > > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > > > > --- > > > > drivers/gpu/drm/drm_drawable.c |7 +-- > > > > 1 files changed, 5 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/drm_drawable.c > > > > b/drivers/gpu/drm/drm_drawable.c > > > > index 70b15d1..7f8e392 100644 > > > > --- a/drivers/gpu/drm/drm_drawable.c > > > > +++ b/drivers/gpu/drm/drm_drawable.c > > > > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, > > > > struct drm_file *file_priv) > > > > { > > > > struct drm_draw *draw = data; > > > > unsigned long irqflags; > > > > + struct drm_drawable_info *info; > > > > > > > > + info = drm_get_drawable_info(dev, draw->handle); > > > > spin_lock_irqsave(&dev->drw_lock, irqflags); > > > > > > > > - drm_free(drm_get_drawable_info(dev, draw->handle), > > > > -sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > > > + drm_free(info->rects, info->num_rects * sizeof(struct > > > > drm_clip_rect), > > > > + DRM_MEM_BUFS); > > > > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > > > > > > > idr_remove(&dev->drw_idr, draw->handle); > > > > > > That get_drawable_info should be under the spinlock, right? > > > > > > > yes, right. Here's the updated one. Thanks! > > > > From 4b74a8a2213f1211e7a0054a40f3dda582bd0177 Mon Sep 17 00:00:00 2001 > > From: Zhenyu Wang <[EMAIL PROTECTED]> > > Date: Fri, 17 Oct 2008 16:05:00 +0800 > > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > > --- > > drivers/gpu/drm/drm_drawable.c |7 +-- > > 1 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c > > index 70b15d1..4a794d8 100644 > > --- a/drivers/gpu/drm/drm_drawable.c > > +++ b/drivers/gpu/drm/drm_drawable.c > > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, > > struct drm_file *file_priv) > > { > > struct drm_draw *draw = data; > > unsigned long irqflags; > > + struct drm_drawable_info *info; > > > > spin_lock_irqsave(&dev->drw_lock, irqflags); > > > > - drm_free(drm_get_drawable_info(dev, draw->handle), > > -sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > + info = drm_get_drawable_info(dev, draw->handle); > > + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), > > + DRM_MEM_BUFS); > > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > Is it safe t ocall drm_free under the spinlock? It seems like a bad idea > to me... It's safe as far as I can tell. spinlock debugging hasn't triggered, which seems pretty conclusive. Pushed. -- Eric Anholt [EMAIL PROTECTED] [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] drm: fix cliprects leaking in drm_rmdraw()
On Fri, 2008-10-17 at 15:48 +0800, Zhenyu Wang wrote: > On 2008.10.16 23:27:12 -0700, Eric Anholt wrote: > > On Fri, 2008-10-17 at 13:16 +0800, Zhenyu Wang wrote: > > > From 4aab96c10fca2d5a3f89e56a4d6a96c6125cf932 Mon Sep 17 00:00:00 2001 > > > From: Zhenyu Wang <[EMAIL PROTECTED]> > > > Date: Fri, 17 Oct 2008 11:32:32 +0800 > > > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > > > > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > > > --- > > > drivers/gpu/drm/drm_drawable.c |7 +-- > > > 1 files changed, 5 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_drawable.c > > > b/drivers/gpu/drm/drm_drawable.c > > > index 70b15d1..7f8e392 100644 > > > --- a/drivers/gpu/drm/drm_drawable.c > > > +++ b/drivers/gpu/drm/drm_drawable.c > > > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, > > > struct drm_file *file_priv) > > > { > > > struct drm_draw *draw = data; > > > unsigned long irqflags; > > > + struct drm_drawable_info *info; > > > > > > + info = drm_get_drawable_info(dev, draw->handle); > > > spin_lock_irqsave(&dev->drw_lock, irqflags); > > > > > > - drm_free(drm_get_drawable_info(dev, draw->handle), > > > - sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > > + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), > > > + DRM_MEM_BUFS); > > > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > > > > > idr_remove(&dev->drw_idr, draw->handle); > > > > That get_drawable_info should be under the spinlock, right? > > > > yes, right. Here's the updated one. Thanks! > > From 4b74a8a2213f1211e7a0054a40f3dda582bd0177 Mon Sep 17 00:00:00 2001 > From: Zhenyu Wang <[EMAIL PROTECTED]> > Date: Fri, 17 Oct 2008 16:05:00 +0800 > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > --- > drivers/gpu/drm/drm_drawable.c |7 +-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c > index 70b15d1..4a794d8 100644 > --- a/drivers/gpu/drm/drm_drawable.c > +++ b/drivers/gpu/drm/drm_drawable.c > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct > drm_file *file_priv) > { > struct drm_draw *draw = data; > unsigned long irqflags; > + struct drm_drawable_info *info; > > spin_lock_irqsave(&dev->drw_lock, irqflags); > > - drm_free(drm_get_drawable_info(dev, draw->handle), > - sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > + info = drm_get_drawable_info(dev, draw->handle); > + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), > + DRM_MEM_BUFS); > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); Is it safe t ocall drm_free under the spinlock? It seems like a bad idea to me... > > idr_remove(&dev->drw_idr, draw->handle); > > -- > 1.5.6.5 > > > - > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > -- ___ Dri-devel mailing list > Dri-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dri-devel -- [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] drm: fix cliprects leaking in drm_rmdraw()
On 2008.10.16 23:27:12 -0700, Eric Anholt wrote: > On Fri, 2008-10-17 at 13:16 +0800, Zhenyu Wang wrote: > > From 4aab96c10fca2d5a3f89e56a4d6a96c6125cf932 Mon Sep 17 00:00:00 2001 > > From: Zhenyu Wang <[EMAIL PROTECTED]> > > Date: Fri, 17 Oct 2008 11:32:32 +0800 > > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > > --- > > drivers/gpu/drm/drm_drawable.c |7 +-- > > 1 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c > > index 70b15d1..7f8e392 100644 > > --- a/drivers/gpu/drm/drm_drawable.c > > +++ b/drivers/gpu/drm/drm_drawable.c > > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, > > struct drm_file *file_priv) > > { > > struct drm_draw *draw = data; > > unsigned long irqflags; > > + struct drm_drawable_info *info; > > > > + info = drm_get_drawable_info(dev, draw->handle); > > spin_lock_irqsave(&dev->drw_lock, irqflags); > > > > - drm_free(drm_get_drawable_info(dev, draw->handle), > > -sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), > > + DRM_MEM_BUFS); > > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > > > idr_remove(&dev->drw_idr, draw->handle); > > That get_drawable_info should be under the spinlock, right? > yes, right. Here's the updated one. Thanks! From 4b74a8a2213f1211e7a0054a40f3dda582bd0177 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang <[EMAIL PROTECTED]> Date: Fri, 17 Oct 2008 16:05:00 +0800 Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> --- drivers/gpu/drm/drm_drawable.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c index 70b15d1..4a794d8 100644 --- a/drivers/gpu/drm/drm_drawable.c +++ b/drivers/gpu/drm/drm_drawable.c @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_draw *draw = data; unsigned long irqflags; + struct drm_drawable_info *info; spin_lock_irqsave(&dev->drw_lock, irqflags); - drm_free(drm_get_drawable_info(dev, draw->handle), -sizeof(struct drm_drawable_info), DRM_MEM_BUFS); + info = drm_get_drawable_info(dev, draw->handle); + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), + DRM_MEM_BUFS); + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); idr_remove(&dev->drw_idr, draw->handle); -- 1.5.6.5 -- Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 signature.asc Description: Digital signature - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] drm: fix cliprects leaking in drm_rmdraw()
On Fri, 2008-10-17 at 13:16 +0800, Zhenyu Wang wrote: > From 4aab96c10fca2d5a3f89e56a4d6a96c6125cf932 Mon Sep 17 00:00:00 2001 > From: Zhenyu Wang <[EMAIL PROTECTED]> > Date: Fri, 17 Oct 2008 11:32:32 +0800 > Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() > > Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> > --- > drivers/gpu/drm/drm_drawable.c |7 +-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c > index 70b15d1..7f8e392 100644 > --- a/drivers/gpu/drm/drm_drawable.c > +++ b/drivers/gpu/drm/drm_drawable.c > @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct > drm_file *file_priv) > { > struct drm_draw *draw = data; > unsigned long irqflags; > + struct drm_drawable_info *info; > > + info = drm_get_drawable_info(dev, draw->handle); > spin_lock_irqsave(&dev->drw_lock, irqflags); > > - drm_free(drm_get_drawable_info(dev, draw->handle), > - sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), > + DRM_MEM_BUFS); > + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); > > idr_remove(&dev->drw_idr, draw->handle); That get_drawable_info should be under the spinlock, right? -- Eric Anholt [EMAIL PROTECTED] [EMAIL PROTECTED] signature.asc Description: This is a digitally signed message part - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
[PATCH] drm: fix cliprects leaking in drm_rmdraw()
From 4aab96c10fca2d5a3f89e56a4d6a96c6125cf932 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang <[EMAIL PROTECTED]> Date: Fri, 17 Oct 2008 11:32:32 +0800 Subject: [PATCH] drm: fix cliprects leaking in drm_rmdraw() Signed-off-by: Zhenyu Wang <[EMAIL PROTECTED]> --- drivers/gpu/drm/drm_drawable.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_drawable.c b/drivers/gpu/drm/drm_drawable.c index 70b15d1..7f8e392 100644 --- a/drivers/gpu/drm/drm_drawable.c +++ b/drivers/gpu/drm/drm_drawable.c @@ -76,11 +76,14 @@ int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_draw *draw = data; unsigned long irqflags; + struct drm_drawable_info *info; + info = drm_get_drawable_info(dev, draw->handle); spin_lock_irqsave(&dev->drw_lock, irqflags); - drm_free(drm_get_drawable_info(dev, draw->handle), -sizeof(struct drm_drawable_info), DRM_MEM_BUFS); + drm_free(info->rects, info->num_rects * sizeof(struct drm_clip_rect), + DRM_MEM_BUFS); + drm_free(info, sizeof(struct drm_drawable_info), DRM_MEM_BUFS); idr_remove(&dev->drw_idr, draw->handle); -- 1.5.6.5 -- Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 signature.asc Description: Digital signature - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/-- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel