Skip to contentSkip to conversation

pr-manager: Fix invalid g_free() crash bug

PATCH Applied Markus Armbruster 4 participants 4 messages Aug 22, 2019 – Sep 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pr-manager: Fix invalid g_free() crash bug

pr_manager_worker() passes its @opaque argument to g_free(). Wrong; it points to pr_manager_worker()'s automatic @data. Broken when commit 2f3a7ab39be converted @data from heap- to stack-allocated. Fix by deleting the g_free().

Fixes 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e
---
 scsi/pr-manager.c | 1 -
 1 file changed, 1 deletion(-)
scsi/pr-manager.c +0 -1
index ee43663576..0c866e8698 100644
@@ -39,7 +39,6 @@ static int pr_manager_worker(void *opaque)
     int fd = data->fd;
     int r;
 
-    g_free(data);
     trace_pr_manager_run(fd, hdr->cmdp[0], hdr->cmdp[1]);
 
     /* The reference was taken in pr_manager_execute.  */
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Markus Armbruster

pr_manager_worker() passes its @opaque argument to g_free(). Wrong; it points to pr_manager_worker()'s automatic @data. Broken when commit 2f3a7ab39be converted @data from heap- to stack-allocated. Fix by deleting the g_free().

Fixes 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e
---
 scsi/pr-manager.c | 1 -
 1 file changed, 1 deletion(-)
scsi/pr-manager.c +0 -0
index ee43663576..0c866e8698 100644

scsi/pr-manager.c static int pr_manager_worker(void *opaque) · line 44

Quoted 7 lines
scsi/pr-manager.c +0 -1
@@ -39,7 +39,6 @@ static int pr_manager_worker(void *opaque)
     int fd = data->fd;
     int r;
 
-    g_free(data);
     trace_pr_manager_run(fd, hdr->cmdp[0], hdr->cmdp[1]);
 
     /* The reference was taken in pr_manager_execute.  */
Acked-by on v1 1/1
#2 lore raw
In reply to Markus Armbruster
Quoted 18 lines · Markus Armbruster

pr_manager_worker() passes its @opaque argument to g_free(). Wrong; it points to pr_manager_worker()'s automatic @data. Broken when commit 2f3a7ab39be converted @data from heap- to stack-allocated. Fix by deleting the g_free().

Fixes 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e
---
 scsi/pr-manager.c | 1 -
 1 file changed, 1 deletion(-)
scsi/pr-manager.c +0 -0
index ee43663576..0c866e8698 100644

scsi/pr-manager.c static int pr_manager_worker(void *opaque) · line 44

Quoted 7 lines
scsi/pr-manager.c +0 -1
@@ -39,7 +39,6 @@ static int pr_manager_worker(void *opaque)
     int fd = data->fd;
     int r;
 
-    g_free(data);
     trace_pr_manager_run(fd, hdr->cmdp[0], hdr->cmdp[1]);
 
     /* The reference was taken in pr_manager_execute.  */

Since I am disappearing soon, I wouldn't mind if the block layer people picked this up.

Paolo

Applied
#3 lore raw
In reply to Markus Armbruster

Am 22.08.2019 um 15:38 hat Markus Armbruster geschrieben:

Quoted 8 lines

pr_manager_worker() passes its @opaque argument to g_free(). Wrong; it points to pr_manager_worker()'s automatic @data. Broken when commit 2f3a7ab39be converted @data from heap- to stack-allocated. Fix by deleting the g_free().

Fixes 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e

Thanks, applied to the block branch.

Kevin