• zhenwei pi's avatar
    virtio-crypto: use private buffer for control request · 0756ad15
    zhenwei pi authored
    Originally, all of the control requests share a single buffer(
    ctrl & input & ctrl_status fields in struct virtio_crypto), this
    allows queue depth 1 only, the performance of control queue gets
    limited by this design.
    
    In this patch, each request allocates request buffer dynamically, and
    free buffer after request, so the scope protected by ctrl_lock also
    get optimized here.
    It's possible to optimize control queue depth in the next step.
    
    A necessary comment is already in code, still describe it again:
    /*
     * Note: there are padding fields in request, clear them to zero before
     * sending to host to avoid to divulge any information.
     * Ex, virtio_crypto_ctrl_request::ctrl::u::destroy_session::padding[48]
     */
    So use kzalloc to allocate buffer of struct virtio_crypto_ctrl_request.
    
    Potentially dereferencing uninitialized variables:
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Jason Wang <jasowang@redhat.com>
    Cc: Gonglei <arei.gonglei@huawei.com>
    Reviewed-by: default avatarGonglei <arei.gonglei@huawei.com>
    Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
    Message-Id: <20220506131627.180784-3-pizhenwei@bytedance.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    0756ad15
virtio_crypto_skcipher_algs.c 17.9 KB