mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 08:19:28 +00:00
netdevsim: fix sa_idx out of bounds check
Currently if sa_idx is equal to NSIM_IPSEC_MAX_SA_COUNT then
an out-of-bounds read on ipsec->sa will occur. Fix the
incorrect bounds check by using >= rather than >.
Detected by CoverityScan, CID#1470226 ("Out-of-bounds-read")
Fixes: 7699353da8
("netdevsim: add ipsec offload testing")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
97680ade43
commit
c02462d8a3
1 changed files with 1 additions and 1 deletions
|
@ -249,7 +249,7 @@ bool nsim_ipsec_tx(struct netdevsim *ns, struct sk_buff *skb)
|
|||
}
|
||||
|
||||
sa_idx = xs->xso.offload_handle & ~NSIM_IPSEC_VALID;
|
||||
if (unlikely(sa_idx > NSIM_IPSEC_MAX_SA_COUNT)) {
|
||||
if (unlikely(sa_idx >= NSIM_IPSEC_MAX_SA_COUNT)) {
|
||||
netdev_err(ns->netdev, "bad sa_idx=%d max=%d\n",
|
||||
sa_idx, NSIM_IPSEC_MAX_SA_COUNT);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue