All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1] rtnetlink: Return error when message too short
Date: Tue, 21 Mar 2023 10:04:01 +0000	[thread overview]
Message-ID: <m2o7omju9a.fsf@gmail.com> (raw)
In-Reply-To: <20230320201808.6cc362b2@kernel.org> (Jakub Kicinski's message of "Mon, 20 Mar 2023 20:18:08 -0700")

Jakub Kicinski <kuba@kernel.org> writes:

> On Mon, 20 Mar 2023 23:18:34 +0000 Donald Hunter wrote:
>> rtnetlink_rcv_msg currently returns 0 when the message length is too
>> short. This leads to either no response at all, or an ack response
>> if NLM_F_ACK was set in the request.
>>
>> Change rtnetlink_rcv_msg to return -EINVAL which tells af_netlink to
>> generate a proper error response.
>
> It's a touch risky to start returning an error now.
> Some application could possibly have been passing an empty netlink
> message just because.

It seemed harmless enough to me, but you make a good point.

> We should give the user a heads up (pr_warn_once() with the name+pid
> of current process). Or continue returning a 0 but add a warning via
> the extack. The latter is cleaner but will not help old / sloppy apps,
> your call.

A pr_warn_once() should be enough to help the next person and also to
give visibility of any sloppy apps.

I was considering pr_warn_once() for the nlmsghdr length check in
netlink_rcv_skb since there's nowhere to reply to when the header is
malformed. 

>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>
> We can't put a Fixes tag on it. It could break uAPI, we don't want
> it backported for sure.

      reply	other threads:[~2023-03-21 10:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 23:18 [PATCH net-next v1] rtnetlink: Return error when message too short Donald Hunter
2023-03-21  3:18 ` Jakub Kicinski
2023-03-21 10:04   ` Donald Hunter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2o7omju9a.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.