drm: fix the usage after free
PATCH 1/1 drm: fix the usage after free
From: Mathias Tillman <[email protected]>
For readdir_r(), the next directory entry is returned in caller-allocted buffer (pointered by pent here).
https://bugs.freedesktop.org/show_bug.cgi?id=91704
--- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
xf86drm.c +3 -2
@@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int type)while (readdir_r (sysdir, pent, &ent) ==0 && ent !=NULL ) {if (strncmp (ent->d_name, name, len) ==0 ) { +snprintf (dev_name,sizeof (dev_name),DRM_DIR_NAME "/%s" , + ent->d_name); +free (pent);closedir (sysdir); -snprintf (dev_name,sizeof (dev_name),DRM_DIR_NAME "/%s" , - ent->d_name);return strdup (dev_name); } }
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Jammy Zhou
From: Mathias Tillman <[email protected]>
For
readdir_r(), the next directory entry is returned in caller-allocted buffer (pointered by pent here).https://bugs.freedesktop.org/show_bug.cgi?id=91704
Signed-off-by Jammy Zhou <[email protected]>
Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author.
Anyway the patch is clearly a nice catch and Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 13 lines
--- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)xf86drm.c +1
-0@@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int type)while (readdir_r (sysdir, pent, &ent) ==0 && ent !=NULL ) {if (strncmp (ent->d_name, name, len) ==0 ) { + snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s",
xf86drm.c static char *drmGetMinorNameForFD(int fd, int type) · line 2814
Quoted 10 lines
xf86drm.c +2
-2+ ent->d_name); +free (pent);closedir (sysdir); -snprintf (dev_name,sizeof (dev_name),DRM_DIR_NAME "/%s" , - ent->d_name);return strdup (dev_name); } }
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 1 line
Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author.
Agreed. Just was not quite sure if Mathias is working on the libdrm project directly or not based on the comments in the bugzilla "hopefully the fix can be pushed to master soon".
Regards,
Jammy
-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Monday, August 24, 2015 3:52 PM
To: Zhou, Jammy; [email protected]; [email protected]
Subject: Re: [PATCH] drm: fix the usage after free
Quoted 8 lines · Jammy Zhou
From: Mathias Tillman <[email protected]>
For
readdir_r(), the next directory entry is returned in caller-allocted buffer (pointered by pent here).https://bugs.freedesktop.org/show_bug.cgi?id=91704
Signed-off-by Jammy Zhou <[email protected]>
Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author.
Anyway the patch is clearly a nice catch and Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 23 lines
--- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)xf86drm.c +3
-2@@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int type)while (readdir_r (sysdir, pent, &ent) ==0 && ent !=NULL ) {if (strncmp (ent->d_name, name, len) ==0 ) { +snprintf (dev_name,sizeof (dev_name),DRM_DIR_NAME "/%s" , + ent->d_name); +free (pent);closedir (sysdir); -snprintf (dev_name,sizeof (dev_name),DRM_DIR_NAME "/%s" , - ent->d_name);return strdup (dev_name); }
Quoted 1 line
}
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Sorry, no I am not a developer working on libdrm, this is my first contribution to it in fact. How would I go about adding my Signed-Off?
Quoted 50 lines · Jammy
Quoted 1 line
Would be more convenient if Mathias would add his Signed-off-by as well
and send out the patch, cause he is the original author.
Agreed. Just was not quite sure if Mathias is working on the libdrm project directly or not based on the comments in the bugzilla "hopefully the fix can be pushed to master soon".
Regards,
Jammy-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Monday, August 24, 2015 3:52 PM
To: Zhou, Jammy; [email protected]; [email protected]
Subject: Re: [PATCH] drm: fix the usage after freeQuoted 8 lines · Jammy Zhou
From: Mathias Tillman <[email protected]>
For
readdir_r(), the next directory entry is returned in caller-allocted buffer (pointered by pent here).https://bugs.freedesktop.org/show_bug.cgi?id=91704
Signed-off-by Jammy Zhou <[email protected]>Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author.
Anyway the patch is clearly a nice catch and Reviewed-by: Christian König < [email protected]>
Regards,
Christian.Quoted 9 lines
--- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)xf86drm.c +0
-0xf86drm.c static char *drmGetMinorNameForFD(int fd, int · line 2807
Quoted 5 lines
xf86drm.c +1
-0@@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int type)while (readdir_r (sysdir, pent, &ent) ==0 && ent !=NULL ) {if (strncmp (ent->d_name, name, len) ==0 ) { + snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME"/%s",
Quoted 13 lines
xf86drm.c static char *drmGetMinorNameForFD(int fd, int type)
Quoted 6 lines
xf86drm.c +2
-1+ ent->d_name); +free (pent);closedir (sysdir); - snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME"/%s",
Quoted 4 lines
xf86drm.c +0
-1- ent->d_name);return strdup (dev_name); }}
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Mathias,
thanks for the good help and no problem with the Signed-off-by line. If you don't object we will just add a "Signed-off-by: Mathias Tillman <[email protected]>" line when we push this patch to the repository.
It's just for tracking who created which code and who might know why something is implemented as it is, but since it's rather obvious what's wrong here there probably won't be any more questions about his.
I honestly don't remember if I have commit access to libdrm myself, but going to check. If not Alex or somebody else need to commit this.
Regards,
Christian.
Quoted 64 lines · Mathias Tillman
Sorry, no I am not a developer working on libdrm, this is my first contribution to it in fact. How would I go about adding my Signed-Off?
Quoted 1 line · On Mon, 24 Aug 2015 at 09:59 Zhou, Jammy <[email protected]…
Would be more convenient if Mathias would add his Signed-off-by
as well and send out the patch, cause he is the original author. Agreed. Just was not quite sure if Mathias is working on the libdrm project directly or not based on the comments in the bugzilla "hopefully the fix can be pushed to master soon". Regards, Jammy -----Original Message----- From: Christian König [mailto:[email protected] <mailto:[email protected]>] Sent: Monday, August 24, 2015 3:52 PM To: Zhou, Jammy; [email protected] <mailto:[email protected]>; [email protected] <mailto:[email protected]> Subject: Re: [PATCH] drm: fix the usage after free On 24.08.2015 05:56, Jammy Zhou wrote: > From: Mathias Tillman <[email protected] <mailto:[email protected]>> > > For readdir_r(), the next directory entry is returned in > caller-allocted buffer (pointered by pent here). > > https://bugs.freedesktop.org/show_bug.cgi?id=91704 > > Signed-off-by: Jammy Zhou <[email protected] <mailto:[email protected]>> Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author. Anyway the patch is clearly a nice catch and Reviewed-by: Christian König <[email protected] <mailto:[email protected]>> Regards, Christian. > --- > xf86drm.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/xf86drm.c b/xf86drm.c > index 5e02969..a7cc643 100644 > --- a/xf86drm.c > +++ b/xf86drm.c > @@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int > type) > > while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) { > if (strncmp(ent->d_name, name, len) == 0) { > + snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME "/%s", > + ent->d_name); > + > free(pent);
Quoted 9 lines
> closedir(sysdir);
>
> - snprintf(dev_name, sizeof(dev_name),
DRM_DIR_NAME "/%s",
> - ent->d_name);
> return strdup(dev_name);
> }
> }_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Okay, that won't be a problem at all.
Quoted 18 lines · On Mon, 24 Aug 2015 at 10:20 Christian König <[email protected]> wrote:
Hi Mathias,
thanks for the good help and no problem with the Signed-off-by line. If you don't object we will just add a "Signed-off-by: Mathias Tillman <[email protected]> <[email protected]>" line when we push this patch to the repository.
It's just for tracking who created which code and who might know why something is implemented as it is, but since it's rather obvious what's wrong here there probably won't be any more questions about his.
I honestly don't remember if I have commit access to libdrm myself, but going to check. If not Alex or somebody else need to commit this.
Regards,
Christian.
Quoted 71 lines
On 24.08.2015 10:03, Mathias Tillman wrote:
Sorry, no I am not a developer working on libdrm, this is my first contribution to it in fact. How would I go about adding my Signed-Off?
Quoted 63 lines · Jammy
Quoted 1 line
Would be more convenient if Mathias would add his Signed-off-by as well
and send out the patch, cause he is the original author.
Agreed. Just was not quite sure if Mathias is working on the libdrm project directly or not based on the comments in the bugzilla "hopefully the fix can be pushed to master soon".
Regards,
Jammy-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Monday, August 24, 2015 3:52 PM
To: Zhou, Jammy; [email protected]; [email protected]
Subject: Re: [PATCH] drm: fix the usage after freeQuoted 8 lines · Jammy Zhou
From: Mathias Tillman <[email protected]>
For
readdir_r(), the next directory entry is returned in caller-allocted buffer (pointered by pent here).https://bugs.freedesktop.org/show_bug.cgi?id=91704
Signed-off-by Jammy Zhou <[email protected]>Would be more convenient if Mathias would add his Signed-off-by as well and send out the patch, cause he is the original author.
Anyway the patch is clearly a nice catch and Reviewed-by: Christian König <[email protected]>
Regards,
Christian.Quoted 9 lines
--- xf86drm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)xf86drm.c +0
-0xf86drm.c static char *drmGetMinorNameForFD(int fd, int · line 2807
Quoted 5 lines
xf86drm.c +1
-0@@ -2803,11 +2803,12 @@ static char *drmGetMinorNameForFD(int fd, int type)while (readdir_r (sysdir, pent, &ent) ==0 && ent !=NULL ) {if (strncmp (ent->d_name, name, len) ==0 ) { + snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME"/%s",
xf86drm.c static char *drmGetMinorNameForFD(int fd, int type)
Quoted 6 lines
xf86drm.c +2
-1+ ent->d_name); +free (pent);closedir (sysdir); - snprintf(dev_name, sizeof(dev_name), DRM_DIR_NAME"/%s",
Quoted 4 lines
xf86drm.c +0
-1- ent->d_name);return strdup (dev_name); }}
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi guys,
Quoted 6 lines · Christian König
Hi Mathias,
thanks for the good help and no problem with the Signed-off-by line. If you don't object we will just add a "Signed-off-by: Mathias Tillman <[email protected]>" line when we push this patch to the repository.
Quoted 7 lines
It's just for tracking who created which code and who might know why something is implemented as it is, but since it's rather obvious what's wrong here there probably won't be any more questions about his.
I honestly don't remember if I have commit access to libdrm myself, but going to check. If not Alex or somebody else need to commit this.
Seems like you do :)
Quoted 8 lines
Regards,
Christian.On 24.08.2015 10:03, Mathias Tillman wrote:
Sorry, no I am not a developer working on libdrm, this is my first contribution to it in fact. How would I go about adding my Signed-Off?
Mathias, you can pass "-s" to git commit which will add the tag for you. Here [1] can check what signed-off-by stands for.
If you have other patches in the future feel free to send them directly to the mailing list.
Thanks for fixing my goof-up :)
Emil
[1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/SubmittingPatches#n409
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel