[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] storage_backend_fs: avoid NULL dereference on opendir failure



Daniel P. Berrange wrote:
> On Wed, Sep 02, 2009 at 10:05:03AM +0200, Jim Meyering wrote:
>> >From 7f453c68bc709d542e4c40a388c92c7969ad0a3a Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering redhat com>
>> Date: Wed, 2 Sep 2009 09:58:50 +0200
>> Subject: [PATCH 3/4] lxc: avoid NULL dereference when we find no mount point
>>
>> * src/lxc_container.c (lxcContainerUnmountOldFS): Don't pass
>> a NULL pointer to qsort.
>> ---
>>  src/lxc_container.c |    5 +++--
>>  1 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/lxc_container.c b/src/lxc_container.c
>> index 950dd50..2073864 100644
>> --- a/src/lxc_container.c
>> +++ b/src/lxc_container.c
>> @@ -546,8 +546,9 @@ static int lxcContainerUnmountOldFS(void)
>>      }
>>      endmntent(procmnt);
>>
>> -    qsort(mounts, nmounts, sizeof(mounts[0]),
>> -          lxcContainerChildMountSort);
>> +    if (mounts)
>> +        qsort(mounts, nmounts, sizeof(mounts[0]),
>> +              lxcContainerChildMountSort);
>>
>>      for (i = 0 ; i < nmounts ; i++) {
>>          VIR_DEBUG("Umount %s", mounts[i]);
>
> This would is impossible to hit, since you must at least have a /proc
> filesystem if we've got this far, but doesn't hurt to check anyway :-)

It can be triggered when the first getmntent call fails.
I'll revise the log to mention that.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]