Subject: Re: [PATCH v3 net 5/6] mpls: Handle error of rtnl_register_module().

From: Kuniyuki Iwashima <[email-masked]>
Date: Mon, 7 Oct 2024 08:42:10 -0700

From: "Eric W. Biederman" <[email-masked]>
Date: Mon, 07 Oct 2024 09:56:44 -0500
> Kuniyuki Iwashima <[email-masked]> writes:
> 
> > Since introduced, mpls_init() has been ignoring the returned
> > value of rtnl_register_module(), which could fail.
> 
> As I recall that was deliberate.  The module continues to work if the
> rtnetlink handlers don't operate, just some functionality is lost.

It's ok if it wasn't a module.  rtnl_register() logs an error message
in syslog, but rtnl_register_module() doesn't.  That's why this series
only changes some rtnl_register_module() calls.

> 
> I don't strongly care either way, but I want to point out that bailing
> out due to a memory allocation failure actually makes the module
> initialization more brittle.
> 
> > Let's handle the errors by rtnl_register_many().
> 
> Can you describe what the benefit is from completely giving up in the
> face of a memory allocation failure versus having as much of the module
> function as possible?

What if the memory pressure happend to be relaxed soon after the module
was loaded incompletely ?

Silent failure is much worse to me.

rtnl_get_link() will return NULL and users will see -EOPNOTSUPP even
though the module was loaded "successfully".