Skip to content

Commit a093803

Browse files
sreedeviintelgregkh
authored andcommitted
idpf: Fix RSS LUT NULL ptr issue after soft reset
[ Upstream commit ebecca5 ] During soft reset, the RSS LUT is freed and not restored unless the interface is up. If an ethtool command that accesses the rss lut is attempted immediately after reset, it will result in NULL ptr dereference. Also, there is no need to reset the rss lut if the soft reset does not involve queue count change. After soft reset, set the RSS LUT to default values based on the updated queue count only if the reset was a result of a queue count change and the LUT was not configured by the user. In all other cases, don't touch the LUT. Steps to reproduce: ** Bring the interface down (if up) ifconfig eth1 down ** update the queue count (eg., 27->20) ethtool -L eth1 combined 20 ** display the RSS LUT ethtool -x eth1 [82375.558338] BUG: kernel NULL pointer dereference, address: 0000000000000000 [82375.558373] #PF: supervisor read access in kernel mode [82375.558391] #PF: error_code(0x0000) - not-present page [82375.558408] PGD 0 P4D 0 [82375.558421] Oops: Oops: 0000 [#1] SMP NOPTI <snip> [82375.558516] RIP: 0010:idpf_get_rxfh+0x108/0x150 [idpf] [82375.558786] Call Trace: [82375.558793] <TASK> [82375.558804] rss_prepare.isra.0+0x187/0x2a0 [82375.558827] rss_prepare_data+0x3a/0x50 [82375.558845] ethnl_default_doit+0x13d/0x3e0 [82375.558863] genl_family_rcv_msg_doit+0x11f/0x180 [82375.558886] genl_rcv_msg+0x1ad/0x2b0 [82375.558902] ? __pfx_ethnl_default_doit+0x10/0x10 [82375.558920] ? __pfx_genl_rcv_msg+0x10/0x10 [82375.558937] netlink_rcv_skb+0x58/0x100 [82375.558957] genl_rcv+0x2c/0x50 [82375.558971] netlink_unicast+0x289/0x3e0 [82375.558988] netlink_sendmsg+0x215/0x440 [82375.559005] __sys_sendto+0x234/0x240 [82375.559555] __x64_sys_sendto+0x28/0x30 [82375.560068] x64_sys_call+0x1909/0x1da0 [82375.560576] do_syscall_64+0x7a/0xfa0 [82375.561076] ? clear_bhb_loop+0x60/0xb0 [82375.561567] entry_SYSCALL_64_after_hwframe+0x76/0x7e <snip> Fixes: 02cbfba ("idpf: add ethtool callbacks") Signed-off-by: Sreedevi Joshi <sreedevi.joshi@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com> Reviewed-by: Emil Tantilov <emil.s.tantilov@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Tested-by: Samuel Salin <Samuel.salin@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit ebecca5) [Harshit: backport to 6.12.y, conflicts due to missing commit: 8dd72eb - idpf: convert vport state to bitmap andbd74a86bc75d - idpf: link NAPIs to queues which changes idpf_vport_open/stop() APIs also take rtnl argument) Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent df2790b commit a093803

3 files changed

Lines changed: 6 additions & 17 deletions

File tree

drivers/net/ethernet/intel/idpf/idpf_lib.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,6 @@ static int idpf_vport_open(struct idpf_vport *vport)
14051405
{
14061406
struct idpf_netdev_priv *np = netdev_priv(vport->netdev);
14071407
struct idpf_adapter *adapter = vport->adapter;
1408-
struct idpf_vport_config *vport_config;
1409-
struct idpf_rss_data *rss_data;
14101408
int err;
14111409

14121410
if (np->state != __IDPF_VPORT_DOWN)
@@ -1488,19 +1486,6 @@ static int idpf_vport_open(struct idpf_vport *vport)
14881486

14891487
idpf_restore_features(vport);
14901488

1491-
vport_config = adapter->vport_config[vport->idx];
1492-
rss_data = &vport_config->user_config.rss_data;
1493-
1494-
if (!rss_data->rss_lut) {
1495-
err = idpf_init_rss_lut(vport);
1496-
if (err) {
1497-
dev_err(&adapter->pdev->dev,
1498-
"Failed to initialize RSS LUT for vport %u: %d\n",
1499-
vport->vport_id, err);
1500-
goto disable_vport;
1501-
}
1502-
}
1503-
15041489
err = idpf_config_rss(vport);
15051490
if (err) {
15061491
dev_err(&adapter->pdev->dev, "Failed to configure RSS for vport %u: %d\n",
@@ -1953,7 +1938,6 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19531938
idpf_vport_stop(vport);
19541939
}
19551940

1956-
idpf_deinit_rss_lut(vport);
19571941
/* We're passing in vport here because we need its wait_queue
19581942
* to send a message and it should be getting all the vport
19591943
* config data out of the adapter but we need to be careful not
@@ -1979,6 +1963,10 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
19791963
if (err)
19801964
goto err_open;
19811965

1966+
if (reset_cause == IDPF_SR_Q_CHANGE &&
1967+
!netif_is_rxfh_configured(vport->netdev))
1968+
idpf_fill_dflt_rss_lut(vport);
1969+
19821970
if (current_state == __IDPF_VPORT_UP)
19831971
err = idpf_vport_open(vport);
19841972

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4059,7 +4059,7 @@ int idpf_config_rss(struct idpf_vport *vport)
40594059
* idpf_fill_dflt_rss_lut - Fill the indirection table with the default values
40604060
* @vport: virtual port structure
40614061
*/
4062-
static void idpf_fill_dflt_rss_lut(struct idpf_vport *vport)
4062+
void idpf_fill_dflt_rss_lut(struct idpf_vport *vport)
40634063
{
40644064
struct idpf_adapter *adapter = vport->adapter;
40654065
u16 num_active_rxq = vport->num_rxq;

drivers/net/ethernet/intel/idpf/idpf_txrx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector);
10171017
void idpf_vport_intr_deinit(struct idpf_vport *vport);
10181018
int idpf_vport_intr_init(struct idpf_vport *vport);
10191019
void idpf_vport_intr_ena(struct idpf_vport *vport);
1020+
void idpf_fill_dflt_rss_lut(struct idpf_vport *vport);
10201021
int idpf_config_rss(struct idpf_vport *vport);
10211022
int idpf_init_rss_lut(struct idpf_vport *vport);
10221023
void idpf_deinit_rss_lut(struct idpf_vport *vport);

0 commit comments

Comments
 (0)