]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: aquantia: fixed instack structure overflow
authorIgor Russkikh <Igor.Russkikh@aquantia.com>
Wed, 27 Feb 2019 12:10:09 +0000 (12:10 +0000)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 8006e3730b6e900319411e35cee85b4513d298df ]

This is a real stack undercorruption found by kasan build.

The issue did no harm normally because it only overflowed
2 bytes after `bitary` array which on most architectures
were mapped into `err` local.

Fixes: bab6de8fd180 ("net: ethernet: aquantia: Atlantic A0 and B0 specific functions.")
Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c

index 8cc6abadc03b90e88fb58b09a53e7da3702710e5..70faa09d2ea9efd24405d619eec2eaba30c33fab 100644 (file)
@@ -205,8 +205,8 @@ static int hw_atl_a0_hw_rss_set(struct aq_hw_s *self,
        u32 i = 0U;
        u32 num_rss_queues = max(1U, self->aq_nic_cfg->num_rss_queues);
        int err = 0;
-       u16 bitary[(HW_ATL_A0_RSS_REDIRECTION_MAX *
-                                       HW_ATL_A0_RSS_REDIRECTION_BITS / 16U)];
+       u16 bitary[1 + (HW_ATL_A0_RSS_REDIRECTION_MAX *
+                  HW_ATL_A0_RSS_REDIRECTION_BITS / 16U)];
 
        memset(bitary, 0, sizeof(bitary));
 
index c29345f605cec6c938a3c66027918a6d17aa9306..687c68895d740259cf9d179a56cef678823a2841 100644 (file)
@@ -190,8 +190,8 @@ static int hw_atl_b0_hw_rss_set(struct aq_hw_s *self,
        u32 i = 0U;
        u32 num_rss_queues = max(1U, self->aq_nic_cfg->num_rss_queues);
        int err = 0;
-       u16 bitary[(HW_ATL_B0_RSS_REDIRECTION_MAX *
-                                       HW_ATL_B0_RSS_REDIRECTION_BITS / 16U)];
+       u16 bitary[1 + (HW_ATL_B0_RSS_REDIRECTION_MAX *
+                  HW_ATL_B0_RSS_REDIRECTION_BITS / 16U)];
 
        memset(bitary, 0, sizeof(bitary));