• Zhou Qingyang's avatar
    octeontx2-af: Fix a memleak bug in rvu_mbox_init() · e07a097b
    Zhou Qingyang authored
    In rvu_mbox_init(), mbox_regions is not freed or passed out
    under the switch-default region, which could lead to a memory leak.
    
    Fix this bug by changing 'return err' to 'goto free_regions'.
    
    This bug was found by a static analyzer. The analysis employs
    differential checking to identify inconsistent security operations
    (e.g., checks or kfrees) between two code paths and confirms that the
    inconsistent operations are not recovered in the current function or
    the callers, so they constitute bugs.
    
    Note that, as a bug found by static analysis, it can be a false
    positive or hard to trigger. Multiple researchers have cross-reviewed
    the bug.
    
    Builds with CONFIG_OCTEONTX2_AF=y show no new warnings,
    and our static analyzer no longer warns about this code.
    
    Fixes: 98c56111 (“octeontx2-af: cn10k: Add mbox support for CN10K platform”)
    Signed-off-by: default avatarZhou Qingyang <zhou1615@umn.edu>
    Link: https://lore.kernel.org/r/20211130165039.192426-1-zhou1615@umn.eduSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    e07a097b
rvu.c 82.1 KB