]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ice: set tx_tstamps when creating new Tx rings via ethtool
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 27 Jul 2022 23:15:57 +0000 (16:15 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 24 Nov 2022 13:24:53 +0000 (14:24 +0100)
BugLink: https://bugs.launchpad.net/bugs/1996825
[ Upstream commit b3b173745c8cab1e24d6821488b60abed3acb24d ]

When the user changes the number of queues via ethtool, the driver
allocates new rings. This allocation did not initialize tx_tstamps. This
results in the tx_tstamps field being zero (due to kcalloc allocation), and
would result in a NULL pointer dereference when attempting a transmit
timestamp on the new ring.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/intel/ice/ice_ethtool.c

index 9b9c2b8854866052bb89dbba9e7cd2cc7db93bc4..f10d9c377c74413ff0c445736024819519a562c1 100644 (file)
@@ -2788,6 +2788,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
                tx_rings[i].count = new_tx_cnt;
                tx_rings[i].desc = NULL;
                tx_rings[i].tx_buf = NULL;
+               tx_rings[i].tx_tstamps = &pf->ptp.port.tx;
                err = ice_setup_tx_ring(&tx_rings[i]);
                if (err) {
                        while (i--)