[libvirt] [PATCH] Avoid calling virStorageFileIsSharedFS with NULL

From: Laine Stump <laine@redhat.com> This code was just recently added (by me) and didn't account for the fact that stdin_path is sometimes NULL. If it's NULL, and SetSecurityAllLabel fails, a segfault would result. --- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2a277a5..e8c5c35 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3429,7 +3429,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, if (driver->securityDriver && driver->securityDriver->domainSetSecurityAllLabel && driver->securityDriver->domainSetSecurityAllLabel(vm, stdin_path) < 0) { - if (virStorageFileIsSharedFS(stdin_path) != 1) + if (stdin_path && virStorageFileIsSharedFS(stdin_path) != 1) goto cleanup; } -- 1.7.1

On 06/28/2010 11:54 PM, Laine Stump wrote:
From: Laine Stump<laine@redhat.com>
This code was just recently added (by me) and didn't account for the fact that stdin_path is sometimes NULL. If it's NULL, and SetSecurityAllLabel fails, a segfault would result. --- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2a277a5..e8c5c35 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3429,7 +3429,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, if (driver->securityDriver&& driver->securityDriver->domainSetSecurityAllLabel&& driver->securityDriver->domainSetSecurityAllLabel(vm, stdin_path)< 0) { - if (virStorageFileIsSharedFS(stdin_path) != 1) + if (stdin_path&& virStorageFileIsSharedFS(stdin_path) != 1) goto cleanup; }
Because this is a trivial and obvious fix, and I didn't want anyone else to hit the segfault, I just pushed it.

On Mon, Jun 28, 2010 at 11:58:43PM -0400, Laine Stump wrote:
On 06/28/2010 11:54 PM, Laine Stump wrote:
From: Laine Stump<laine@redhat.com>
This code was just recently added (by me) and didn't account for the fact that stdin_path is sometimes NULL. If it's NULL, and SetSecurityAllLabel fails, a segfault would result. --- src/qemu/qemu_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2a277a5..e8c5c35 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3429,7 +3429,7 @@ static int qemudStartVMDaemon(virConnectPtr conn, if (driver->securityDriver&& driver->securityDriver->domainSetSecurityAllLabel&& driver->securityDriver->domainSetSecurityAllLabel(vm, stdin_path)< 0) { - if (virStorageFileIsSharedFS(stdin_path) != 1) + if (stdin_path&& virStorageFileIsSharedFS(stdin_path) != 1) goto cleanup; }
Because this is a trivial and obvious fix, and I didn't want anyone else to hit the segfault, I just pushed it.
ACK anyway :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 06/29/2010 02:41 AM, Daniel Veillard wrote:
On Mon, Jun 28, 2010 at 11:58:43PM -0400, Laine Stump wrote:
On 06/28/2010 11:54 PM, Laine Stump wrote:
From: Laine Stump<laine@redhat.com>
This code was just recently added (by me) and didn't account for the fact that stdin_path is sometimes NULL. If it's NULL, and SetSecurityAllLabel fails, a segfault would result.
driver->securityDriver->domainSetSecurityAllLabel(vm, stdin_path)< 0) { - if (virStorageFileIsSharedFS(stdin_path) != 1) + if (stdin_path&& virStorageFileIsSharedFS(stdin_path) != 1)
ACK anyway :-)
Meanwhile, why is virStorageFileIsSharedFS not marked with ATTRIBUTE_NONNULL(1) in stoarge_file.h? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Laine Stump