1. 04 7月, 2011 4 次提交
    • E
      rpc: silence coverity warning · dd0c42ab
      Eric Blake 提交于
      Coverity noted that 4 out of 5 calls to virNetClientStreamRaiseError
      checked the return value.  This case expects a particular value, so
      warn if our expectations went wrong due to some bug elsewhere.
      
      * src/rpc/virnetclient.c (virNetClientCallDispatchStream): Warn on
        unexpected scenario.
      dd0c42ab
    • E
      qemu: silence coverity warnings · aaea56dc
      Eric Blake 提交于
      Coverity warns if the majority of callers check a function for
      errors, but a few don't; but in qemu_audit and qemu_domain, the
      choice to not check for failures was safe.  In qemu_command, the
      failure to generate a uuid can only occur on a bad pointer.
      
      * src/qemu/qemu_audit.c (qemuAuditCgroup): Ignore failure to get
        cgroup controller.
      * src/qemu/qemu_domain.c (qemuDomainObjEnterMonitor)
        (qemuDomainObjEnterMonitorWithDriver): Ignore failure to get
        timestamp.
      * src/qemu/qemu_command.c (qemuParseCommandLine): Check for error.
      aaea56dc
    • E
      rpc: avoid memory leak on error · 6e07f72e
      Eric Blake 提交于
      Detected by Coverity.  The leak is on an error path, but I'm not
      sure whether that path is likely to be triggered in practice.
      
      * src/rpc/virnetserverservice.c (virNetServerServiceAccept): Plug leak.
      6e07f72e
    • E
      rpc: fix logic bug · 2aa83b43
      Eric Blake 提交于
      Spotted by Coverity.  If we don't update tmp each time through
      the loop, then if the filter being removed was not the head of
      the list, we accidentally lose all filters prior to the one we
      wanted to remove.
      
      * src/rpc/virnetserverclient.c (virNetServerClientRemoveFilter):
          Don't lose unrelated filters.
      2aa83b43
  2. 02 7月, 2011 7 次提交
    • E
      pci: avoid memory leak on error · 95eaf7ba
      Eric Blake 提交于
      Detected by Coverity.  Some, but not all, error paths were clean;
      but they were repetitive so I refactored them.
      
      * src/util/pci.c (pciGetDevice): Plug leak.
      95eaf7ba
    • E
      interface: avoid memory leak on parse error · 9e8b7c15
      Eric Blake 提交于
      Detected by Coverity.  Unlikely to hit unless the file contents
      were corrupted.
      
      * src/util/interface.c (ifaceRestoreMacAddress): Plug leak.
      9e8b7c15
    • E
      libvirtd: avoid memory leak on OOM · e07e9a94
      Eric Blake 提交于
      Detected by Coverity; only strikes on OOM so not serious.
      
      * daemon/libvirtd.c (daemonPidFilePath): Plug leak.
      e07e9a94
    • E
      build: avoid 'make syntax-check' failure · 5d382c57
      Eric Blake 提交于
      * tests/utiltest.c (DO_TEST): Fix indentation for cppi.
      5d382c57
    • M
      tests: Add a general util test · ab0b2c19
      Matthias Bolte 提交于
      Move non-esx specific tests from esxutilstest there and add a
      test for virParseVersionString.
      ab0b2c19
    • E
      util: choose whether to require micro in version strings · 8ce1afff
      Eric Blake 提交于
      To avoid regressions, we let callers specify whether to require a
      minor and micro version.  Callers that were parsing uname() output
      benefit from defaulting to 0, whereas callers that were parsing
      version strings from other sources should not change in behavior.
      
      * src/util/util.c (virParseVersionString): Allow caller to choose
      whether to fail if minor or micro is missing.
      * src/util/util.h (virParseVersionString): Update signature.
      * src/esx/esx_driver.c (esxGetVersion): Update callers.
      * src/lxc/lxc_driver.c (lxcVersion): Likewise.
      * src/openvz/openvz_conf.c (openvzExtractVersionInfo): Likewise.
      * src/uml/uml_driver.c (umlGetVersion): Likewise.
      * src/vbox/vbox_MSCOMGlue.c (vboxLookupVersionInRegistry):
      Likewise.
      * src/vbox/vbox_tmpl.c (vboxExtractVersion): Likewise.
      * src/vmware/vmware_conf.c (vmwareExtractVersion): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiGetVersion): Likewise.
      Reported by Matthias Bolte.
      8ce1afff
    • E
      build: consistently use CFLAGS · 6ae3052c
      Eric Blake 提交于
      According to the automake manual, CPPFLAGS (aka INCLUDES, as spelled
      in automake 1.9.6) should only include -I, -D, and -U directives; more
      generic directives like -Wall belong in CFLAGS since they affect more
      phases of the build process.  Therefore, we should be sticking CFLAGS
      additions into a CFLAGS container, not a CPPFLAGS container.
      
      * src/Makefile.am (libvirt_driver_vmware_la_CFLAGS): Use AM_CFLAGS.
      (INCLUDES): Move CFLAGS items...
      (AM_CFLAGS): ...to their proper location.
      * python/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
      * tests/Makefile.am (INCLUDES, AM_CFLAGS): Likewise.
      (commandtest_CFLAGS, commandhelper_CFLAGS)
      (virnetmessagetest_CFLAGS, virnetsockettest_CFLAGS): Use AM_CFLAGS.
      6ae3052c
  3. 01 7月, 2011 27 次提交
    • D
      Explicitely invoke python for API doc generator · 8c58abea
      Daniel Veillard 提交于
      This fixes the problem of not finding python in /usr/bin
      which broke build on FreeBSD
      8c58abea
    • S
      fix virParseVersionString with linux 3.0 · d42b749a
      Scott Moser 提交于
      linux 3.0 has no micro version number, and that is causing problems
      for virParseVersionString.  The patch below should allow for:
        major
        major.minor
        major.minor.micro
      
      If major or minor are not present they just default to zero.
      We found this in Ubuntu (https://bugs.launchpad.net/bugs/802977)
      d42b749a
    • E
      build: remove dead variables · 0ac385bd
      Eric Blake 提交于
      Detected by Coverity.  No real harm in leaving these, but fixing
      them cuts down on the noise for future analysis.
      
      * src/rpc/virnetserver.c (virNetServerAddService): Delete unused
      entry.
      * src/util/sysinfo.c (virSysinfoRead): Delete dead assignment to
      base.
      0ac385bd
    • D
      Remove bogus jsondata.h file reference which does not exist · 20ce0651
      Daniel P. Berrange 提交于
      * tests/Makefile.am: Remove jsondata.h
      20ce0651
    • E
      build: simplify sanlock distribution · bf8fba1e
      Eric Blake 提交于
      EXTRA_DIST files should unconditionally be part of the tarball,
      rather than depending on the presence of sanlock-devel.
      
      Meanwhile, parallel builds could fail if we don't use mkdir -p.
      
      * src/Makefile.am (EXTRA_DIST): Always ship sanlock .aug and
      template .conf files.
      (%-sanlock.conf): Use MKDIR_P.
      bf8fba1e
    • E
      build: allow 'make syntax-check' on fresh checkout · addaa537
      Eric Blake 提交于
      For good or for bad, I did a fresh checkout, ./autogen.sh, then
      'configure', then 'make syntax-check', and was surprised that it
      failed.  Running 'make' before 'make syntax-check' cleaned up the
      issue, but this patch makes it work up front.
      
      * cfg.mk (sc_po_check): Add prerequisites.
      addaa537
    • E
      build: ignore generated file · 1e1f6531
      Eric Blake 提交于
      * .gitignore: Exempt jsontest binary.
      1e1f6531
    • D
      Add conditionals to allow build without SASL · 0e4b921a
      Daniel P. Berrange 提交于
      * daemon/libvirtd.c, daemon/remote.c: Add #if HAVE_SASL and
        suitable function stubs to allow build without SASL
      0e4b921a
    • E
      build: avoid double-close bug with pipe2 · dbf055ef
      Eric Blake 提交于
      Based on Coverity's finding on the previous patch, I audited
      gnulib's pipe2 code and found that we had the potential for
      a subtle double-close bug, unless gnulib guarantees that the
      contents of the fd array are unchanged on pipe2() failure.
      
      * .gnulib: Update to latest, for pipe2 fix.
      dbf055ef
    • E
      rpc: avoid freeing uninitialized variable · 0a8a79af
      Eric Blake 提交于
      Detected by Coverity.  Both are instances of bad things happening
      if pipe2 fails; the virNetClientNew failure could free garbage,
      and virNetSocketNewConnectCommand could close random fds.
      
      Note: POSIX doesn't guarantee the contents of fd[0] and fd[1]
      after pipe failure: http://austingroupbugs.net/view.php?id=467
      We may need to introduce a virPipe2 wrapper that guarantees
      that on pipe failure, the fds are explicitly set to -1, rather
      than our current state of assuming the fds are unchanged from
      their value prior to the failed pipe call.
      
      * src/rpc/virnetclient.c (virNetClientNew): Initialize variable.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectCommand):
      Likewise.
      0a8a79af
    • E
      virsh: avoid uninitialized variable · cdb0e0dc
      Eric Blake 提交于
      Detected by Coverity; neither vshCmddefHelp nor vshCmdOptParse
      was initializing opts_required.
      
      * tools/virsh.c (vshCmddefOptParse): Always initialize bitmaps.
      cdb0e0dc
    • E
      virsh: avoid integer overflow · 6f9432fc
      Eric Blake 提交于
      Detected by Coverity.  info.nrVirtCpu is unsigned short, but if
      cpumaplen is int, then the product of the two in vshMalloc risks
      unintended sign extension.  cmdVcpuinfo had already solved this
      by using size_t cpumaplen.
      
      * tools/virsh.c (cmdVcpuPin): Use correct type.
      6f9432fc
    • D
      Fix stream procedure number for virDomainMigratePrepareTunnel3 · 1414cc5f
      Daniel P. Berrange 提交于
      The virDomainMigratePrepareTunnel3 impl in the remote driver
      was using the procedure number for the virDomainMigratePrepareTunnel
      method. This doesn't work out so well, because it makes the server
      ignore & drop all stream packets
      
      * src/remote/remote_driver.c: Fix procedure for PrepareTunnel3
      1414cc5f
    • D
      Send back an error if we get unexpected stream control message · cfd4370a
      Daniel P. Berrange 提交于
      We ignore any stream data packets which come in for streams which
      are not registered, since these packets are async and do not have
      a reply. If we get a stream control packet though we must send back
      an actual error, otherwise a (broken) client may hang forever
      making it hard to diagnose the client bug.
      
      * src/rpc/virnetserverprogram.c: Send back error for unexpected
        stream control messages
      cfd4370a
    • D
      Fix release of virNetMessagePtr instances in streams processing · c69ba670
      Daniel P. Berrange 提交于
      If a message packet for a invalid stream is received it is just
      free'd. This is not good because it doesn't let the client RPC
      request counter decrement. If a stream is shutdown with pending
      packets the message also isn't released properly because of an
      incorrect header type
      
      * daemon/stream.c: Fix message header type
      * src/rpc/virnetserverprogram.c: Send dummy reply instead of
        free'ing ignored stream message
      c69ba670
    • D
      Add missing include of signal.h in virnetsocket.c · f1c2c0e2
      Daniel P. Berrange 提交于
      virNetSocketFree uses kill(SIGTERM) so we must include
      signal.h for the definitions
      
      * src/rpc/virnetsocket.c: Include signal.h
      f1c2c0e2
    • D
      Add test case for parsing JSON docs · 06da1805
      Daniel P. Berrange 提交于
      While investigating some memory leaks it was unclear whether the
      JSON code correctly free'd all memory during parsing. Add a test
      case which can be run under valgrind to clearly demonstrate that
      the parser is leak free.
      
      * tests/Makefile.am: Add 'jsontest'
      * tests/jsontest.c: A few simple JSON parsing tests
      06da1805
    • D
      Fix potential crash when saving guests · e44bec2e
      Daniel P. Berrange 提交于
      The qemudDomainSaveFlag method will call EndJob on the 'vm'
      object it is passed in. This can result in the 'vm' object
      being free'd if the last reference is removed. Thus no caller
      of 'qemudDomainSaveFlag' must *ever* reference 'vm' again
      upon return.
      
      Unfortunately qemudDomainSave and qemuDomainManagedSave
      both call 'virDomainObjUnlock', which can result in a
      crash. This is non-deterministic since it involves a race
      with the monitor I/O thread.
      
      Fix this by making qemudDomainSaveFlag responsible for
      calling virDomainObjUnlock instead.
      
      * src/qemu/qemu_driver.c: Fix potential use after free
        when saving guests
      e44bec2e
    • D
      Fix uninitialized value in QEMU monitor FD sending code · f870c99b
      Daniel P. Berrange 提交于
      The 'char control[CMSG_SPACE(sizeof(int))];' was not being
      wiped, so could potentially contain uninitialized bytes.
      While this was harmless in this case, it caused complaints
      from valgrind
      
      * src/qemu/qemu_monitor.c: memset 'control' variable
        in qemuMonitorIOWriteWithFD
      f870c99b
    • D
      Fix leak of JSON object for events · 5ab8746f
      Daniel P. Berrange 提交于
      The event handler functions do not free the virJSONValuePtr
      object. Every event received from a VM thus caused a memory
      leak
      
      * src/qemu/qemu_monitor_json.c: Fix leak of event object
      5ab8746f
    • D
      Remove bogus warning message in JSON code · 09a882bd
      Daniel P. Berrange 提交于
      * src/util/json.c: Remove warning message
      09a882bd
    • D
      Fix use of uninitialized memory when releasing PCI slots · 56a77b49
      Daniel P. Berrange 提交于
      The 'function' field in the PCI address was not correctly
      initialized, so it was building the wrong address address
      string and so not removing all functions from the in use
      list.
      
      * src/qemu/qemu_command.c: Fix initialization of PCI function
      56a77b49
    • D
      Fix leak of virStreamPtr object with callback added in fdstream impl · 9f40b80b
      Daniel P. Berrange 提交于
      When adding a callback to an FD stream, we take an extra reference
      on the virStreamPtr instance. We forgot to registered a free function
      with the callback, so when the callback was removed, the extra
      reference held on virStreamPtr was not released.
      
      * src/fdstream.c: Use a free callback to release reference on
        virStreamPtr when removing callback
      9f40b80b
    • D
      Fix leak of mdnsGroupName in virNetServer object · 92fa2e58
      Daniel P. Berrange 提交于
      * src/rpc/virnetserver.c: Free mdnsGroupName
      92fa2e58
    • D
      Fix release of filtered stream messages · df65adf1
      Daniel P. Berrange 提交于
      The stream code was reusing a stream message object before
      it was removed from the linked list of filtered messages.
      This caused any later queued messages to be completely lost.
      
      * daemon/stream.c: Delay reuse of stream message until
        after it is removed from the queue
      df65adf1
    • D
      Ensure RPC message is cleared before being reused · d840fe93
      Daniel P. Berrange 提交于
      To save on memory reallocation, virNetMessage instances that
      have been transmitted, may be reused for a subsequent incoming
      message. We forgot to clear out the old data of the message
      fully, which caused later confusion upon read.
      
      * src/rpc/virnetserverclient.c: memset entire message before
        reusing it
      d840fe93
    • D
      Fix hardcoded limit on client requests in RPC code · 27111b35
      Daniel P. Berrange 提交于
      The virNetServerClient object had a hardcoded limit of 10 requests
      per client. Extend constructor to allow it to be passed in as a
      configurable variable. Wire this up to the 'max_client_requests'
      config parameter in libvirtd
      
      * daemon/libvirtd.c: Pass max_client_requests into services
      * src/rpc/virnetserverservice.c, src/rpc/virnetserverservice.h: Pass
        nrequests_client_max to clients
      * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h: Allow
        configurable request limit
      27111b35
  4. 30 6月, 2011 2 次提交