ethtool: fail closed if we can't get max channel used in indirection tables
authorJakub Kicinski <kuba@kernel.org>
Wed, 10 Jul 2024 17:40:42 +0000 (10:40 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 11 Jul 2024 21:41:41 +0000 (14:41 -0700)
commit2899d58462ba868287d6ff3acad3675e7adf934f
treed515db667d5280f1e8b0a5d904c0365e3d6639a7
parent7c8267275de6989a9b682a07d75e89395457ee01
ethtool: fail closed if we can't get max channel used in indirection tables

Commit 0d1b7d6c9274 ("bnxt: fix crashes when reducing ring count with
active RSS contexts") proves that allowing indirection table to contain
channels with out of bounds IDs may lead to crashes. Currently the
max channel check in the core gets skipped if driver can't fetch
the indirection table or when we can't allocate memory.

Both of those conditions should be extremely rare but if they do
happen we should try to be safe and fail the channel change.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20240710174043.754664-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/channels.c
net/ethtool/common.c
net/ethtool/common.h
net/ethtool/ioctl.c