• Alex Elder's avatar
    net: ipa: validate IPA table memory earlier · cf139196
    Alex Elder authored
    Add checks in ipa_table_init() to ensure the memory regions defined
    for IPA filter and routing tables are valid.
    
    For routing tables, the checks ensure:
      - The non-hashed IPv4 and IPv6 routing tables are defined
      - The non-hashed IPv4 and IPv6 routing tables are the same size
      - The number entries in the non-hashed IPv4 routing table is enough
        to hold the number entries available to the modem, plus at least
        one usable by the AP.
    
    For filter tables, the checks ensure:
      - The non-hashed IPv4 and IPv6 filter tables are defined
      - The non-hashed IPv4 and IPv6 filter tables are the same size
      - The number entries in the non-hashed IPv4 filter table is enough
        to hold the endpoint bitmap, plus an entry for each defined
        endpoint that supports filtering.
    
    In addition, for both routing and filter tables:
      - If hashing isn't supported (IPA v4.2), hashed tables are zero size
      - If hashing *is* supported, all hashed tables are the same size as
        their non-hashed counterparts.
    
    When validating the size of routing tables, require the AP to have
    at least one entry (in addition to those used by the modem).
    Signed-off-by: default avatarAlex Elder <elder@linaro.org>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    cf139196
ipa_table.c 24 KB