lkml.org 
[lkml]   [2020]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.6 30/49] cifs: protect updating server->dstaddr with a spinlock
    Date
    From: Ronnie Sahlberg <lsahlber@redhat.com>

    [ Upstream commit fada37f6f62995cc449b36ebba1220594bfe55fe ]

    We use a spinlock while we are reading and accessing the destination address for a server.
    We need to also use this spinlock to protect when we are modifying this address from
    reconn_set_ipaddr().

    Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/cifs/connect.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
    index 4804d1df8c1cf..d4a23b48e24d8 100644
    --- a/fs/cifs/connect.c
    +++ b/fs/cifs/connect.c
    @@ -375,8 +375,10 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
    return rc;
    }

    + spin_lock(&cifs_tcp_ses_lock);
    rc = cifs_convert_address((struct sockaddr *)&server->dstaddr, ipaddr,
    strlen(ipaddr));
    + spin_unlock(&cifs_tcp_ses_lock);
    kfree(ipaddr);

    return !rc ? -1 : 0;
    --
    2.20.1


    \
     
     \ /
      Last update: 2020-05-08 14:57    [W:2.745 / U:0.368 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site