From: Roberto Bergantinos Corpas Date: Mon, 14 Oct 2019 08:59:23 +0000 (+0200) Subject: CIFS: avoid using MID 0xFFFF X-Git-Tag: v4.19.81~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71cf88165ff0ac8c9dc570536542e409bea41281;p=platform%2Fkernel%2Flinux-rpi.git CIFS: avoid using MID 0xFFFF commit 03d9a9fe3f3aec508e485dd3dcfa1e99933b4bdb upstream. According to MS-CIFS specification MID 0xFFFF should not be used by the CIFS client, but we actually do. Besides, this has proven to cause races leading to oops between SendReceive2/cifs_demultiplex_thread. On SMB1, MID is a 2 byte value easy to reach in CurrentMid which may conflict with an oplock break notification request coming from server Signed-off-by: Roberto Bergantinos Corpas Reviewed-by: Ronnie Sahlberg Reviewed-by: Aurelien Aptel Signed-off-by: Steve French CC: Stable Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 47db8eb..c7f0c85 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -183,6 +183,9 @@ cifs_get_next_mid(struct TCP_Server_Info *server) /* we do not want to loop forever */ last_mid = cur_mid; cur_mid++; + /* avoid 0xFFFF MID */ + if (cur_mid == 0xffff) + cur_mid++; /* * This nested loop looks more expensive than it is.