Package: linux / 6.1.153-1

Metadata

Package Version Patches format
linux 6.1.153-1 3.0 (quilt)

Patch series

view the series file
Patch File delta Description
features/all/ethernet microsoft/0041 net mana Fix oversized sge0 for GSO packets.patch | (download)

drivers/net/ethernet/microsoft/mana/mana_en.c | 191 135 + 56 - 0 !
include/net/mana/mana.h | 5 3 + 2 - 0 !
2 files changed, 138 insertions(+), 58 deletions(-)

 [patch 41/44] net: mana: fix oversized sge0 for gso packets

Handle the case when GSO SKB linear length is too large.

MANA NIC requires GSO packets to put only the header part to SGE0,
otherwise the TX queue may stop at the HW level.

So, use 2 SGEs for the skb linear part which contains more than the
packet header.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
features/all/ethernet microsoft/0042 net mana Avoid open coded arithmetic.patch | (download)

drivers/net/ethernet/microsoft/mana/mana_en.c | 14 6 + 8 - 0 !
1 file changed, 6 insertions(+), 8 deletions(-)

 [patch 42/44] net: mana: avoid open coded arithmetic

This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1][2].

As the "req" variable is a pointer to "struct mana_cfg_rx_steer_req_v2"
and this structure ends in a flexible array:

struct mana_cfg_rx_steer_req_v2 {
        [...]
        mana_handle_t indir_tab[] __counted_by(num_indir_entries);
};

the preferred way in the kernel is to use the struct_size() helper to
do the arithmetic instead of the calculation "size + size * count" in
the kzalloc() function.

Moreover, use the "offsetof" helper to get the indirect table offset
instead of the "sizeof" operator and avoid the open-coded arithmetic in
pointers using the new flex member. This new structure member also allow
us to remove the "req_indir_tab" variable since it is no longer needed.

Now, it is also possible to use the "flex_array_size" helper to compute
the size of these trailing elements in the "memcpy" function.

This way, the code is more readable and safer.

This code was detected with the help of Coccinelle, and audited and
modified manually.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
Link: https://github.com/KSPP/linux/issues/160 [2]
Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237A21355C86EC0DCC0D83B8B022@AS8PR02MB7237.eurprd02.prod.outlook.com
features/all/ethernet microsoft/0043 net mana Add flex array to struct mana_cfg_rx_steer_.patch | (download)

include/net/mana/mana.h | 1 1 + 0 - 0 !
1 file changed, 1 insertion(+)

 [patch 43/44] net: mana: add flex array to struct
 mana_cfg_rx_steer_req_v2

The "struct mana_cfg_rx_steer_req_v2" uses a dynamically sized set of
trailing elements. Specifically, it uses a "mana_handle_t" array. So,
use the preferred way in the kernel declaring a flexible array [1].

At the same time, prepare for the coming implementation by GCC and Clang
of the __counted_by attribute. Flexible array members annotated with
__counted_by can have their accesses bounds-checked at run-time via
CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for
strcpy/memcpy-family functions).

This is a previous step to refactor the two consumers of this structure.

 drivers/infiniband/hw/mana/qp.c
 drivers/net/ethernet/microsoft/mana/mana_en.c

The ultimate goal is to avoid the open-coded arithmetic in the memory
allocator functions [2] using the "struct_size" macro.

Link: https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays [1]
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2]
Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237E2900247571C9CB84C678B022@AS8PR02MB7237.eurprd02.prod.outlook.com
features/all/ethernet microsoft/0044 net mana Allow variable size indirection table.patch | (download)

drivers/net/ethernet/microsoft/mana/mana_en.c | 85 72 + 13 - 0 !
drivers/net/ethernet/microsoft/mana/mana_ethtool.c | 27 19 + 8 - 0 !
include/net/mana/gdma.h | 4 3 + 1 - 0 !
include/net/mana/mana.h | 9 5 + 4 - 0 !
4 files changed, 99 insertions(+), 26 deletions(-)

 [patch 44/44] net: mana: allow variable size indirection table

Allow variable size indirection table allocation in MANA instead
of using a constant value MANA_INDIRECT_TABLE_SIZE.
The size is now derived from the MANA_QUERY_VPORT_CONFIG and the
indirection table is allocated dynamically.

Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Link: https://lore.kernel.org/r/1718015319-9609-1-git-send-email-shradhagupta@linux.microsoft.com