lkml.org 
[lkml]   [2022]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC Patch net-next 5/6] net: dsa: microchip: Adding the ptp packet reception logic
On Tue, Oct 25, 2022 at 08:17:37AM +0200, Christian Eggers wrote:
> > +static int ksz_connect_tag_protocol(struct dsa_switch *ds,
> > + enum dsa_tag_protocol proto)
> > +{
> > + struct ksz_tagger_data *tagger_data;
> > +
> > + tagger_data = ksz_tagger_data(ds);
>
> NULL pointer dereference is here:
>
> ksz_connect() is only called for "lan937x", not for the other KSZ switches.
> If ksz_connect() shall only be called for PTP switches, the result of
> ksz_tagger_data() may be NULL.
>
> > + tagger_data->meta_tstamp_handler = ksz_tstamp_reconstruct;
> > +
> > + return 0;
> > +}
> > +

The observation is correct. All other drivers which use this API check
the protocol given as argument, and for good reason. Only "lan937x"
allocates tagger-owned storage in Arun's implementation, but the common
ksz library supports more tagging protocols.

\
 
 \ /
  Last update: 2022-10-26 22:14    [W:0.064 / U:1.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site