RE: [PATCH 4.4 041/241] cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()

From: Pavel Shilovskiy
Date: Mon Jun 10 2019 - 15:17:53 EST



-----Original Message-----
From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Sent: Sunday, June 9, 2019 9:40 AM
To: linux-kernel@xxxxxxxxxxxxxxx
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; stable@xxxxxxxxxxxxxxx; Christoph Probst <kernel@xxxxxxxxx>; Pavel Shilovskiy <pshilov@xxxxxxxxxxxxx>; Steven French <Steven.French@xxxxxxxxxxxxx>
Subject: [PATCH 4.4 041/241] cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()

From: Christoph Probst <kernel@xxxxxxxxx>

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@xxxxxxxxx>
Reviewed-by: Pavel Shilovsky <pshilov@xxxxxxxxxxxxx>
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
CC: Stable <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
--------------------------------

Hi Greg,

This patch has been queued for 4.4.y and has already been merged into 5.1.y (5.1.5). Are you going to apply it to other stable kernels: 4.9, 4.14, 4.19?

Best regards,
Pavel Shilovsky