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)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 16 Aug 2022 16:04:37 +0000 (09:04 -0700)
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>
drivers/net/ethernet/intel/ice/ice_ethtool.c

index a6fff8ebaf9d9ebcc5248ddcf63e13861659cbe2..bbf6a300078e5fb464af6b3b8aaf90b0d9ed4d27 100644 (file)
@@ -2826,6 +2826,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--)