On 01/21/2015 10:03 PM, Chris Leech wrote:
> I'm looking at segfaults with fipvlan, and there seem to be some serious
> issues with patches applied Dec 2 2013.
> 
> Is anyone testing fipvlan at all?  I'm worried that these got in, but
> more so that they've been undetected for so long.
> 
Hmm. Well, we used to. But apparently without that bit of code ...

> If you use the vlan create option, it will segfault in
> create_and_start_vlan() at line 647
> 
>>      } else {
>>              vlan = lookup_vlan(fcf->ifindex, fcf->vlan);
>>              if (vlan) {
>>                      FIP_LOG_DBG("VLAN %s.%d already exists as %s\n",
>>                                  real_dev->ifname, fcf->vlan, vlan->ifname);
>>                      return 0;
> 
>   if vlan already exists, this exits
>   (so we can't start fcoe on an existing vlan dev either?)
> 
>>              }
>>              snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
>>                       real_dev->ifname, fcf->vlan, config.suffix);
>>              rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
>>              if (rc < 0) {
>>                      printf("Failed to create VLAN device %s\n\t%s\n",
>>                             vlan_name, strerror(-rc));
>>                      return rc;
>>              }
>>              printf("Created VLAN device %s\n", vlan_name);
> 
>   created, but vlan variable still NULL
> 
>>      }
>>      if (!config.start)
>>              return rc;
>>
>>      if (!vlan->running) {
> 
>   segfault on NULL dereference 
> 
Ah. The older version had this function inlined, and was just doing
a 'continue' after the printf.

If so, this patch should fix it:

diff --git a/fipvlan.c b/fipvlan.c
index cc71412..34725bf 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -634,12 +634,12 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn)
                snprintf(vlan_name, IFNAMSIZ, "%s.%d%s",
                         real_dev->ifname, fcf->vlan, config.suffix);
                rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name);
-               if (rc < 0) {
+               if (rc < 0)
                        printf("Failed to create VLAN device
%s\n\t%s\n",
                               vlan_name, strerror(-rc));
-                       return rc;
-               }
-               printf("Created VLAN device %s\n", vlan_name);
+               else
+                       printf("Created VLAN device %s\n", vlan_name);
+               return rc;
        }
        if (!config.start)
                return rc;


(minus linebreaks, of course)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                            zSeries & Storage
[email protected]                                   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
_______________________________________________
fcoe-devel mailing list
[email protected]
http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel

Reply via email to