From: Simon Horman <horms@kernel.org>
To: Shivani Gupta <shivani07g@gmail.com>
Cc: intel-wired-lan@lists.osuosl.org,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
Alessio Igor Bogani <alessio.bogani@elettra.eu>
Subject: Re: [PATCH iwl-net] igb: Reject hwtstamp requests when PTP is unavailable
Date: Tue, 18 Aug 2026 14:07:38 +0100 [thread overview]
Message-ID: <20260818130738.GF265046@horms.kernel.org> (raw)
In-Reply-To: <20260815010815.91898-1-shivani07g@gmail.com>
On Sat, Aug 15, 2026 at 01:08:15AM +0000, Shivani Gupta wrote:
...
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
...
> @@ -1378,6 +1384,25 @@ void igb_ptp_init(struct igb_adapter *adapter)
> return;
> }
>
> + /* Initialize all state used by the PHC and timestamping paths before
> + * registering either interface. INIT_WORK() only initializes the work
> + * item; no work is queued until timestamping is enabled.
> + */
> + spin_lock_init(&adapter->tmreg_lock);
> + INIT_WORK(&adapter->ptp_tx_work, igb_ptp_tx_work);
> +
> + if (adapter->ptp_flags & IGB_PTP_OVERFLOW_CHECK)
> + INIT_DELAYED_WORK(&adapter->ptp_overflow_work,
> + igb_ptp_overflow_check);
> +
> + adapter->tstamp_config.rx_filter = HWTSTAMP_FILTER_NONE;
> + adapter->tstamp_config.tx_type = HWTSTAMP_TX_OFF;
> +
> + /* Initialize the hardware clock before ptp_clock_register() makes its
> + * callbacks visible. The overflow work is started after registration.
> + */
> + igb_ptp_reset(adapter);
> +
> adapter->ptp_clock = ptp_clock_register(&adapter->ptp_caps,
> &adapter->pdev->dev);
> if (IS_ERR(adapter->ptp_clock)) {
Hi Shivani,
There is an AI-generated review of this patch available at
https://sashiko.dev/#/patchset/20260815010815.91898-1-shivani07g%40gmail.com
Of that review the following item stands out to me.
I would appreciate it if you could look over it in particular.
Does this code leave the hardware interrupt unmasked if ptp_clock_register()
fails?
The call to igb_ptp_reset() unconditionally unmasks the Time Sync hardware
interrupt. If ptp_clock_register() fails, adapter->ptp_clock is set to NULL,
but the hardware state is not reverted.
If a hardware interrupt occurs, igb_tsync_interrupt() is called:
igb_tsync_interrupt()
if (adapter->ptp_caps.pps)
ptp_clock_event(adapter->ptp_clock, &event);
Will this result in a NULL pointer dereference when adapter->ptp_clock is
passed to ptp_clock_event()?
...
prev parent reply other threads:[~2026-08-18 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 1:08 [PATCH iwl-net] igb: Reject hwtstamp requests when PTP is unavailable Shivani Gupta
2026-08-18 10:24 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-08-18 13:07 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260818130738.GF265046@horms.kernel.org \
--to=horms@kernel.org \
--cc=alessio.bogani@elettra.eu \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=shivani07g@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox