]> git.baikalelectronics.ru Git - kernel.git/commit
net: don't allow user space to lift the device limits
authorJakub Kicinski <kuba@kernel.org>
Fri, 6 May 2022 02:51:32 +0000 (19:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 May 2022 11:07:56 +0000 (12:07 +0100)
commit1916b9d36c845cf7a99b14060220c91c067fa7a8
tree63d32ba9fafbc94c643b44fb8dca44f98d2ce27a
parentddd4b128cf1d87125ac96bd79998b46335109f30
net: don't allow user space to lift the device limits

Up until commit b60d324269f8 ("rtnetlink: allow GSO maximums to
be set on device creation") the gso_max_segs and gso_max_size
of a device were not controlled from user space.

The quoted commit added the ability to control them because of
the following setup:

 netns A  |  netns B
     veth<->veth   eth0

If eth0 has TSO limitations and user wants to efficiently forward
traffic between eth0 and the veths they should copy the TSO
limitations of eth0 onto the veths. This would happen automatically
for macvlans or ipvlan but veth users are not so lucky (given the
loose coupling).

Unfortunately the commit in question allowed users to also override
the limits on real HW devices.

It may be useful to control the max GSO size and someone may be using
that ability (not that I know of any user), so create a separate set
of knobs to reliably record the TSO limitations. Validate the user
requests.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c
net/core/rtnetlink.c