]> git.baikalelectronics.ru Git - kernel.git/commit
qede: avoid uninitialized entries in coal_entry array
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 24 Feb 2023 00:41:45 +0000 (01:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:33 +0000 (09:34 +0100)
commitfd36f35c3654c02095233c92b1ebc5e7a10025aa
tree59d88124ac9d91206f04e35ff2c5f83b280691e8
parentddbb3a19ea4751fc14451963d3cbee17ef50ade3
qede: avoid uninitialized entries in coal_entry array

commit fc83465afdea830a540ad8b57d0f96f0389fd5d0 upstream.

Even after commit 6619a08d4a6f ("qede: fix interrupt coalescing
configuration"), some entries of the coal_entry array may theoretically
be used uninitialized:

 1. qede_alloc_fp_array() allocates QEDE_MAX_RSS_CNT entries for
    coal_entry. The initial allocation uses kcalloc, so everything is
    initialized.
 2. The user sets a small number of queues (ethtool -L).
    coal_entry is reallocated for the actual small number of queues.
 3. The user sets a bigger number of queues.
    coal_entry is reallocated bigger. The added entries are not
    necessarily initialized.

In practice, the reallocations will actually keep using the originally
allocated region of memory, but we should not rely on it.

The reallocation is unnecessary. coal_entry can always have
QEDE_MAX_RSS_CNT entries.

Fixes: 6619a08d4a6f ("qede: fix interrupt coalescing configuration")
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Nacked-by: Manish Chopra <manishc@marvell.com>
Acked-by: Manish Chopra <manishc@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/qlogic/qede/qede_main.c