• M
    IB/uverbs: Safely extend existing attributes · c66db311
    Matan Barak 提交于
    Previously, we've used UVERBS_ATTR_SPEC_F_MIN_SZ for extending existing
    attributes. The behavior of this flag was the kernel accepts anything
    bigger than the minimum size it specified. This is unsafe, since in
    order to safely extend an attribute, we need to make sure unknown size
    is zeroed. Replacing UVERBS_ATTR_SPEC_F_MIN_SZ with
    UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO, which essentially checks that the
    unknown size is zero. In addition, attributes are now decorated with
    UVERBS_ATTR_TYPE and UVERBS_ATTR_STRUCT, so we can provide the minimum
    and known length.
    
    Users of this flag needs to use copy_from_or_zero functions/macros.
    Reviewed-by: NYishai Hadas <yishaih@mellanox.com>
    Signed-off-by: NMatan Barak <matanb@mellanox.com>
    Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
    c66db311
uverbs_ioctl.h 16.5 KB