public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Linus Walleij <linusw@kernel.org>, Andrew Lunn <andrew@lunn.ch>
Cc: 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>,
	Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	<netdev@vger.kernel.org>
Subject: Re: [PATCH net v2] net: ethernet: xscale: Check for PTP support properly
Date: Thu, 12 Feb 2026 15:06:54 -0800	[thread overview]
Message-ID: <e458c560-099c-4c7e-be33-8471e8979347@intel.com> (raw)
In-Reply-To: <CAD++jLmaYU_r+Z+t=6a9GZuVNGOHLGUfp7SDpDH8jnRqD1TLhQ@mail.gmail.com>



On 2/11/2026 1:03 PM, Linus Walleij wrote:
> On Wed, Feb 11, 2026 at 4:43 PM Andrew Lunn <andrew@lunn.ch> wrote:
>> On Wed, Feb 11, 2026 at 01:58:21PM +0100, Linus Walleij wrote:
>>> In ixp4xx_get_ts_info() ixp46x_ptp_find() is called
>>> unconditionally despite this feature only existing on
>>> ixp46x, leading to the following splat from tcpdump:
>>>
>>> root@OpenWrt:~# tcpdump -vv -X -i eth0
>>> (...)
>>> Unable to handle kernel NULL pointer dereference at virtual address
>>>    00000238 when read
>>> (...)
>>> Call trace:
>>>   ptp_clock_index from ixp46x_ptp_find+0x1c/0x38
>>>   ixp46x_ptp_find from ixp4xx_get_ts_info+0x4c/0x64
>>>   ixp4xx_get_ts_info from __ethtool_get_ts_info+0x90/0x108
>>>   __ethtool_get_ts_info from __dev_ethtool+0xa00/0x2648
>>>   __dev_ethtool from dev_ethtool+0x160/0x234
>>>   dev_ethtool from dev_ioctl+0x2cc/0x460
>>>   dev_ioctl from sock_ioctl+0x1ec/0x524
>>>   sock_ioctl from sys_ioctl+0x51c/0xa94
>>>   sys_ioctl from ret_fast_syscall+0x0/0x44
>>>   (...)
>>> Segmentation fault
>>>
>>> Check for ixp46x in ixp46x_ptp_find() before trying to set up
>>> PTP to avoid this.
>>
>>>        ret = ixp46x_ptp_find(&port->timesync_regs, &port->phc_index);
>>>        if (ret)
>>> -             return ret;
>>> +             return -EOPNOTSUPP;
>>
>> Changing the error code is unusual. Maybe add to the commit message
>> why this is needed, or somebody might ask :-)
> 
> Tricky one, but if you look close changing the error code is what I
> try not to do! :D
> 
> Before this patch ixp4xx_hwtstamp_set() returned -EOPNOTSUPP:
> 
> -       if (!cpu_is_ixp46x())
> -               return -EOPNOTSUPP;
> 
> After moving the check into ixp46x_ptp_find() as requested in the
> review of v1 I have to return some error code from that new check,
> but it is now called from more places, so it returns
> 
> int ixp46x_ptp_find(struct ixp46x_ts_regs *__iomem *regs, int *phc_index)
>   {
> +       if (!cpu_is_ixp46x())
> +               return -ENODEV;
> 
> So this:
> 
>       ret = ixp46x_ptp_find(&port->timesync_regs, &port->phc_index);
>          if (ret)
> -               return ret;
> +               return -EOPNOTSUPP;
> 
> Is put into ixp4xx_hwtstamp_set() so it will return the same error
> code as before if PTP was not found.
> 
> (I can copyedit this reasoning into the commit message if you want.)
> 
> Yours,
> Linus Walleij
> 

That would be helpful to have in the commit message, since it is not 
immediately obvious.


      reply	other threads:[~2026-02-12 23:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 12:58 [PATCH net v2] net: ethernet: xscale: Check for PTP support properly Linus Walleij
2026-02-11 15:43 ` Andrew Lunn
2026-02-11 21:03   ` Linus Walleij
2026-02-12 23:06     ` Jacob Keller [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=e458c560-099c-4c7e-be33-8471e8979347@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vladimir.oltean@nxp.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