VirtualBox

Ignore:
Timestamp:
Mar 25, 2010 11:54:23 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59292
Message:

Solaris/VBoxNetFlt: fix panic in failure exit path. (public #6412)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r26710 r27696  
    18271827    pszEnd++;
    18281828
    1829     int rc;
    1830     long PPA;
     1829    int rc = VERR_GENERAL_FAILURE;
     1830    long PPA = -1;
    18311831    if (   pszEnd
    18321832        && ddi_strtol(pszEnd, NULL, 10, &PPA) == 0)
     
    18531853
    18541854            ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred);
     1855            pThis->u.s.hIface = NULL;
    18551856            LogRel((DEVICE_NAME ":vboxNetFltSolarisOpenStyle2 dl_attach failed. rc=%d szDev=%s PPA=%d rc=%d\n", rc, szDev, PPA));
    18561857        }
     
    19521953
    19531954    ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred);
     1955    pThis->u.s.hIface = NULL;
    19541956
    19551957    return VERR_INTNET_FLT_IF_FAILED;
     
    19661968    LogFlowFunc((DEVICE_NAME ":vboxNetFltSolarisCloseStream pThis=%p\n"));
    19671969
    1968     ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred);
     1970    if (pThis->u.s.hIface)
     1971    {
     1972        ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred);
     1973        pThis->u.s.hIface = NULL;
     1974    }
    19691975}
    19701976
     
    24842490    LogFlowFunc((DEVICE_NAME ":vboxNetFltSolarisSetupIp6Polling pThis=%p\n", pThis));
    24852491
    2486     int rc = VINF_SUCCESS;
     2492    int rc = VERR_GENERAL_FAILURE;
    24872493    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
    24882494    if (RT_LIKELY(pPromiscStream))
     
    24982504                LogRel((DEVICE_NAME ":vboxNetFltSolarisSetupIp6Polling: Invalid polling interval %d. Expected between 1 and 120 secs.\n",
    24992505                                    Interval));
    2500                 return VINF_SUCCESS;
     2506                return VERR_INVALID_PARAMETER;
    25012507            }
    25022508
     
    25152521        }
    25162522        else
     2523        {
    25172524            LogRel((DEVICE_NAME ":vboxNetFltSolarisSetupIp6Polling: Polling already started.\n"));
     2525            rc = VINF_SUCCESS;
     2526        }
    25182527    }
    25192528    return rc;
     
    25722581        if (RT_SUCCESS(rc))
    25732582        {
     2583            /*
     2584             * Ipv6 attaching is optional and can fail. We don't bother to bring down the whole
     2585             * attach process just if Ipv6 interface is unavailable.
     2586             */
    25742587            int rc2 = vboxNetFltSolarisAttachIp6(pThis, true /* fAttach */);
     2588
    25752589#ifdef VBOXNETFLT_SOLARIS_IPV6_POLLING
     2590            /*
     2591             * If Ip6 interface is not plumbed and an Ip6 polling interval is specified, we need
     2592             * to begin polling to attach on the Ip6 interface whenver it comes up.
     2593             */
    25762594            if (   rc2 == VERR_INTNET_FLT_IF_NOT_FOUND
    25772595                && g_VBoxNetFltSolarisPollInterval != -1)
    25782596            {
    2579                 rc = vboxNetFltSolarisSetupIp6Polling(pThis);
    2580                 if (RT_FAILURE(rc))
     2597                int rc3 = vboxNetFltSolarisSetupIp6Polling(pThis);
     2598                if (RT_FAILURE(rc3))
    25812599                {
    2582                     ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.pvIp6Stream, NULL);
    2583                     vboxNetFltSolarisDetachFromInterface(pThis);
     2600                    /*
     2601                     * If we failed to setup Ip6 polling, warn in the release log and continue.
     2602                     */
     2603                    LogRel((DEVICE_NAME ":vboxNetFltSolarisAttachToInterface IPv6 polling inactive. rc=%Rrc\n", rc3));
    25842604                }
    25852605            }
    2586             else
    25872606#endif
    2588                 ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, false);
    2589         }
    2590         else
    2591             vboxNetFltSolarisCloseStream(pThis);
     2607
     2608            /*
     2609             * Ipv4 is successful, and maybe Ipv6, we're ready for transfers.
     2610             */
     2611            ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, false);
     2612            return VINF_SUCCESS;
     2613        }
     2614
     2615        vboxNetFltSolarisCloseStream(pThis);
    25922616    }
    25932617    else
     
    35493573     * Init. the solaris specific data.
    35503574     */
     3575    pThis->u.s.hIface = NULL;
    35513576    pThis->u.s.pvIp4Stream = NULL;
    35523577    pThis->u.s.pvIp6Stream = NULL;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette