[PATCH v1 net 0/2] fix shared vcap_props reference

Colin Foster posted 2 patches 4 years, 1 month ago
drivers/net/dsa/ocelot/felix.c             |  3 +-
drivers/net/dsa/ocelot/felix.h             |  2 +-
drivers/net/dsa/ocelot/felix_vsc9959.c     |  2 +-
drivers/net/dsa/ocelot/seville_vsc9953.c   |  2 +-
drivers/net/ethernet/mscc/ocelot_flower.c  |  4 +-
drivers/net/ethernet/mscc/ocelot_vcap.c    | 54 +++++++++++-----------
drivers/net/ethernet/mscc/ocelot_vsc7514.c |  5 +-
include/soc/mscc/ocelot.h                  | 34 +++++++++++++-
include/soc/mscc/ocelot_vcap.h             | 32 -------------
9 files changed, 71 insertions(+), 67 deletions(-)
[PATCH v1 net 0/2] fix shared vcap_props reference
Posted by Colin Foster 4 years, 1 month ago
Felix vcap_props get statically allocated at the file scope, while the
felix / ocelot instances get dynamically allocated at initialization. If
there's more than one instance, each instance will be writing over the
same vcap_props memory region, which would lead to corruption.

I don't have any hardware to confidently test the vcap portions of
Ocelot / Felix, so any testers would be appreciated.

Also, I believe the memcpy of a structure array should be
architecture-portable, but I'm not 100% confident there, so that might
be an area of extra scrutiny.


Colin Foster (2):
  net: ethernet: ocelot: rename vcap_props to clearly be an ocelot
    member
  net: mscc: ocelot: fix possible memory conflict for vcap_props

 drivers/net/dsa/ocelot/felix.c             |  3 +-
 drivers/net/dsa/ocelot/felix.h             |  2 +-
 drivers/net/dsa/ocelot/felix_vsc9959.c     |  2 +-
 drivers/net/dsa/ocelot/seville_vsc9953.c   |  2 +-
 drivers/net/ethernet/mscc/ocelot_flower.c  |  4 +-
 drivers/net/ethernet/mscc/ocelot_vcap.c    | 54 +++++++++++-----------
 drivers/net/ethernet/mscc/ocelot_vsc7514.c |  5 +-
 include/soc/mscc/ocelot.h                  | 34 +++++++++++++-
 include/soc/mscc/ocelot_vcap.h             | 32 -------------
 9 files changed, 71 insertions(+), 67 deletions(-)

-- 
2.25.1
Re: [PATCH v1 net 0/2] fix shared vcap_props reference
Posted by Vladimir Oltean 4 years, 1 month ago
On Fri, Apr 29, 2022 at 04:30:47PM -0700, Colin Foster wrote:
> I don't have any hardware to confidently test the vcap portions of
> Ocelot / Felix, so any testers would be appreciated.

You know about tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh,
right?
Re: [PATCH v1 net 0/2] fix shared vcap_props reference
Posted by Colin Foster 4 years, 1 month ago
On Sun, May 01, 2022 at 10:52:09AM +0000, Vladimir Oltean wrote:
> On Fri, Apr 29, 2022 at 04:30:47PM -0700, Colin Foster wrote:
> > I don't have any hardware to confidently test the vcap portions of
> > Ocelot / Felix, so any testers would be appreciated.
> 
> You know about tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh,
> right?

I'll add this to the (long) list of things you've taught / shown me.
Thanks! And thanks for testing.