OSDN Git Service

cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()
authorChristoph Probst <kernel@probst.it>
Tue, 7 May 2019 15:16:40 +0000 (17:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:23:45 +0000 (12:23 +0200)
commitdffc9e5ffae5a7cf5cbc2cab33da452fbc9a8801
tree26cdaee690fbc632359f6a1e1117850d0c2aeb46
parentb8ab0c4effb84920da81bbc006423d9170449ab9
cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()

commit 6a54b2e002c9d00b398d35724c79f9fe0d9b38fb upstream.

Change strcat to strncpy in the "None" case to fix a buffer overflow
when cinode->oplock is reset to 0 by another thread accessing the same
cinode. It is never valid to append "None" to any other message.

Consolidate multiple writes to cinode->oplock to reduce raciness.

Signed-off-by: Christoph Probst <kernel@probst.it>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smb2ops.c