lkml.org 
[lkml]   [2024]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH virt] virt: fix uninit-value in vhost_vsock_dev_open
    Date
    Change vhost_vsock_dev_open() to use kvzalloc() instead of kvmalloc()
    to avoid uninit state.

    Reported-by: syzbot+6c21aeb59d0e82eb2782@syzkaller.appspotmail.com
    Fixes: dcda9b04713c ("mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic")
    Signed-off-by: Jeongjun Park <aha310510@gmail.com>
    ---
    drivers/vhost/vsock.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
    index ec20ecff85c7..652ef97a444b 100644
    --- a/drivers/vhost/vsock.c
    +++ b/drivers/vhost/vsock.c
    @@ -656,7 +656,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
    /* This struct is large and allocation could fail, fall back to vmalloc
    * if there is no other way.
    */
    - vsock = kvmalloc(sizeof(*vsock), GFP_KERNEL | __GFP_RETRY_MAYFAIL);
    + vsock = kvzalloc(sizeof(*vsock), GFP_KERNEL | __GFP_RETRY_MAYFAIL);
    if (!vsock)
    return -ENOMEM;

    --
    2.34.1
    \
     
     \ /
      Last update: 2024-04-20 10:58    [W:2.578 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site