Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Radu Nicolae Pirea (OSS)" <radu-nicolae.pirea@oss.nxp.com>,
	stable@vger.kernel.org, andrew@lunn.ch, vivien.didelot@gmail.com,
	f.fainelli@gmail.com
Subject: Re: [PATCH] net: dsa: sja1105: fix new_retagging table size
Date: Tue, 6 Dec 2022 18:44:09 +0200	[thread overview]
Message-ID: <20221206164409.upvgo4fjefsefhs6@skbuf> (raw)
In-Reply-To: <Y49o8Zei2aYsy/hr@kroah.com>

On Tue, Dec 06, 2022 at 05:08:17PM +0100, Greg KH wrote:
> > Should be applied on top of 5.10.157.
> > It is not relevant for newer LTS kernels.
> 
> Why not?
> 
> Please describe in HUGE detail why that is the case, what commit changed
> the tree to prevent this, and why only this one tree needs this specific
> change.  We almost never want to take patches that are not in Linus's
> tree so the justification to do so is a much much higher level.
> 
> And properly get the needed network maintainers ack as well.

Here I suppose that you would like the commit description to state that
VLAN retagging was a mechanism used by the sja1105 driver between kernels
5.9 and 5.15 solely to multiplex VLAN information with source port information
to the CPU. It was limited in that it could only multiplex up to 32 VLANs,
and it was replaced with the bridge TX forwarding offload feature once
that became available. As a result, kernels 5.15 and newer have all
support for VLAN retagging removed.

However, there is a bug in the delta commit procedure sja1105_build_vlan_table()
used by the VLAN retagging code, where the driver allocates less memory
than it needs. It intends to allocate a maximum sized (SJA1105_MAX_RETAGGING_COUNT = 32)
array of retagging table elements, but instead it allocates that number
of elements of a different size (the table->ops->unpacked_entry_size of
BLK_IDX_RETAGGING is sizeof(struct sja1105_retagging_entry) aka 56,
whereas the table->ops->unpacked_entry_size of BLK_IDX_VLAN_LOOKUP is
sizeof(struct sja1105_vlan_lookup_entry), aka 48).

32 elements of 48 bytes will only fit 27 elements of 56 bytes. So when
the VLAN Retagging table contains 28 elements or more, the last few will
be stored in memory that is out of the array that was pre-allocated.

This change fixes the typo that led to that.

Something like that?

      reply	other threads:[~2022-12-06 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 13:51 [PATCH] net: dsa: sja1105: fix new_retagging table size Radu Nicolae Pirea (OSS)
2022-12-06 14:03 ` Vladimir Oltean
2022-12-06 16:08 ` Greg KH
2022-12-06 16:44   ` Vladimir Oltean [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=20221206164409.upvgo4fjefsefhs6@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=radu-nicolae.pirea@oss.nxp.com \
    --cc=stable@vger.kernel.org \
    --cc=vivien.didelot@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