netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: af_mpls: fix undefined reference to ip6_route_output
@ 2015-08-04  7:44 Dan Carpenter
  2015-08-04 13:39 ` roopa
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-08-04  7:44 UTC (permalink / raw)
  To: roopa; +Cc: Eric W. Biederman, netdev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: af_mpls: fix undefined reference to ip6_route_output
  2015-08-04  7:44 af_mpls: fix undefined reference to ip6_route_output Dan Carpenter
@ 2015-08-04 13:39 ` roopa
  0 siblings, 0 replies; 2+ messages in thread
From: roopa @ 2015-08-04 13:39 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Eric W. Biederman, netdev

On 8/4/15, 12:44 AM, Dan Carpenter wrote:
> 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          }
>
>
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-04 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04  7:44 af_mpls: fix undefined reference to ip6_route_output Dan Carpenter
2015-08-04 13:39 ` roopa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).