Skip to contentSkip to conversation

af_mpls: fix undefined reference to ip6_route_output

DISCUSSION Dan Carpenter 2 participants 2 messages Aug 4, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Roopa,

I have a concern about patch bf21563acc1d: "af_mpls: fix undefined reference to ip6_route_output" from Jul 30, 2015.

net/mpls/af_mpls.c
450
451 dev = find_outdev(net, cfg);
452 if (IS_ERR(dev)) {

find_outdev() used to return NULL pointers but now it only returns NULL if cfg->rc_via_table == NEIGH_LINK_TABLE or dev_get_by_index() fails. I think it could lead to a NULL dereference and we don't check for that here.

Returning a mix of error pointers and NULL is bad style, it needs a big comment at the top of the function if it's deliberate.

   453                  err = PTR_ERR(dev);
   454                  dev = NULL;
   455                  goto errout;

456 }

regards,
dan carpenter

#1 lore raw
Quoted 15 lines · Dan Carpenter

Hello Roopa,

I have a concern about patch bf21563acc1d: "af_mpls: fix undefined reference to ip6_route_output" from Jul 30, 2015.

net/mpls/af_mpls.c

    450
    451          dev = find_outdev(net, cfg);
    452          if (IS_ERR(dev)) {

find_outdev() used to return NULL pointers but now it only returns NULL if cfg->rc_via_table == NEIGH_LINK_TABLE or dev_get_by_index() fails. I think it could lead to a NULL dereference and we don't check for that here.

Quoted 9 lines

Returning a mix of error pointers and NULL is bad style, it needs a big comment at the top of the function if it's deliberate.

    453                  err = PTR_ERR(dev);
    454                  dev = NULL;
    455                  goto errout;
    456          }

You are right. The cfg->rc_via_table == NEIGH_LINK_TABLE or dev_get_by_index() case, needs a ERR_PTR(-ENODEV). I will get a patch out shortly.

thanks. I just submitted a patch.