[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221026201351.iqh5776hqnyoj56v@skbuf>
Date: Wed, 26 Oct 2022 23:13:51 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: Christian Eggers <ceggers@...i.de>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Arun Ramadoss <arun.ramadoss@...rochip.com>,
woojung.huh@...rochip.com, UNGLinuxDriver@...rochip.com,
andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, linux@...linux.org.uk, Tristram.Ha@...rochip.com
Subject: Re: [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.
Powered by blists - more mailing lists