Skip to content

Commit 1a16cdf

Browse files
committed
net: ethtool: fix compat with old RSS context API
Device driver gets access to rxfh_dev, while rxfh is just a local copy of user space params. We need to check what RSS context ID driver assigned in rxfh_dev, not rxfh. Using rxfh leads to trying to store all contexts at index 0xffffffff. From the user perspective it leads to "driver chose duplicate ID" warnings when second context is added and inability to access any contexts even tho they were successfully created - xa_load() for the actual context ID will return NULL, and syscall will return -ENOENT. Looks like a rebasing mistake, since rxfh_dev was added relatively recently by commit fb6e30a ("net: ethtool: pass a pointer to parameters to get/set_rxfh ethtool ops"). Fixes: eac9122 ("net: ethtool: record custom RSS contexts in the XArray") Reviewed-by: Edward Cree <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0b87745 commit 1a16cdf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ethtool/ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,13 +1483,13 @@ static noinline_for_stack int ethtool_set_rxfh(struct net_device *dev,
14831483
/* Update rss_ctx tracking */
14841484
if (create && !ops->create_rxfh_context) {
14851485
/* driver uses old API, it chose context ID */
1486-
if (WARN_ON(xa_load(&dev->ethtool->rss_ctx, rxfh.rss_context))) {
1486+
if (WARN_ON(xa_load(&dev->ethtool->rss_ctx, rxfh_dev.rss_context))) {
14871487
/* context ID reused, our tracking is screwed */
14881488
kfree(ctx);
14891489
goto out;
14901490
}
14911491
/* Allocate the exact ID the driver gave us */
1492-
if (xa_is_err(xa_store(&dev->ethtool->rss_ctx, rxfh.rss_context,
1492+
if (xa_is_err(xa_store(&dev->ethtool->rss_ctx, rxfh_dev.rss_context,
14931493
ctx, GFP_KERNEL))) {
14941494
kfree(ctx);
14951495
goto out;

0 commit comments

Comments
 (0)