|
| 1 | +idpf: check error for register_netdev() on init |
| 2 | + |
| 3 | +jira LE-3467 |
| 4 | +cve CVE-2025-22116 |
| 5 | +Rebuild_History Non-Buildable kernel-4.18.0-553.58.1.el8_10 |
| 6 | +commit-author Emil Tantilov <emil.s.tantilov@intel.com> |
| 7 | +commit 680811c67906191b237bbafe7dabbbad64649b39 |
| 8 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 9 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 10 | +ciq/ciq_backports/kernel-4.18.0-553.58.1.el8_10/680811c6.failed |
| 11 | + |
| 12 | +Current init logic ignores the error code from register_netdev(), |
| 13 | +which will cause WARN_ON() on attempt to unregister it, if there was one, |
| 14 | +and there is no info for the user that the creation of the netdev failed. |
| 15 | + |
| 16 | +WARNING: CPU: 89 PID: 6902 at net/core/dev.c:11512 unregister_netdevice_many_notify+0x211/0x1a10 |
| 17 | +... |
| 18 | +[ 3707.563641] unregister_netdev+0x1c/0x30 |
| 19 | +[ 3707.563656] idpf_vport_dealloc+0x5cf/0xce0 [idpf] |
| 20 | +[ 3707.563684] idpf_deinit_task+0xef/0x160 [idpf] |
| 21 | +[ 3707.563712] idpf_vc_core_deinit+0x84/0x320 [idpf] |
| 22 | +[ 3707.563739] idpf_remove+0xbf/0x780 [idpf] |
| 23 | +[ 3707.563769] pci_device_remove+0xab/0x1e0 |
| 24 | +[ 3707.563786] device_release_driver_internal+0x371/0x530 |
| 25 | +[ 3707.563803] driver_detach+0xbf/0x180 |
| 26 | +[ 3707.563816] bus_remove_driver+0x11b/0x2a0 |
| 27 | +[ 3707.563829] pci_unregister_driver+0x2a/0x250 |
| 28 | + |
| 29 | +Introduce an error check and log the vport number and error code. |
| 30 | +On removal make sure to check VPORT_REG_NETDEV flag prior to calling |
| 31 | +unregister and free on the netdev. |
| 32 | + |
| 33 | +Add local variables for idx, vport_config and netdev for readability. |
| 34 | + |
| 35 | +Fixes: 0fe45467a104 ("idpf: add create vport and netdev configuration") |
| 36 | + Suggested-by: Tony Nguyen <anthony.l.nguyen@intel.com> |
| 37 | + Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> |
| 38 | + Reviewed-by: Simon Horman <horms@kernel.org> |
| 39 | + Tested-by: Samuel Salin <Samuel.salin@intel.com> |
| 40 | + Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> |
| 41 | +(cherry picked from commit 680811c67906191b237bbafe7dabbbad64649b39) |
| 42 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 43 | + |
| 44 | +# Conflicts: |
| 45 | +# drivers/net/ethernet/intel/idpf/idpf_lib.c |
| 46 | +diff --cc drivers/net/ethernet/intel/idpf/idpf_lib.c |
| 47 | +index aea4da7e54a8,a055a47449f1..000000000000 |
| 48 | +--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c |
| 49 | ++++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c |
| 50 | +@@@ -928,12 -927,19 +928,24 @@@ static int idpf_stop(struct net_device |
| 51 | + static void idpf_decfg_netdev(struct idpf_vport *vport) |
| 52 | + { |
| 53 | + struct idpf_adapter *adapter = vport->adapter; |
| 54 | ++ u16 idx = vport->idx; |
| 55 | + |
| 56 | +++<<<<<<< HEAD |
| 57 | + + unregister_netdev(vport->netdev); |
| 58 | + + free_netdev(vport->netdev); |
| 59 | +++======= |
| 60 | ++ kfree(vport->rx_ptype_lkup); |
| 61 | ++ vport->rx_ptype_lkup = NULL; |
| 62 | ++ |
| 63 | ++ if (test_and_clear_bit(IDPF_VPORT_REG_NETDEV, |
| 64 | ++ adapter->vport_config[idx]->flags)) { |
| 65 | ++ unregister_netdev(vport->netdev); |
| 66 | ++ free_netdev(vport->netdev); |
| 67 | ++ } |
| 68 | +++>>>>>>> 680811c67906 (idpf: check error for register_netdev() on init) |
| 69 | + vport->netdev = NULL; |
| 70 | + |
| 71 | +- adapter->netdevs[vport->idx] = NULL; |
| 72 | ++ adapter->netdevs[idx] = NULL; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | +* Unmerged path drivers/net/ethernet/intel/idpf/idpf_lib.c |
0 commit comments