CIFS: avoid using MID 0xFFFF
Subsystems (2)
PATCH 1/1 CIFS: avoid using MID 0xFFFF
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
--- fs/cifs/smb1ops.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/smb1ops.c +3 -0
@@ -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.
Signature · 1 line
2.14.5
Quoted 17 lines · Roberto Bergantinos Corpas
According to MS-CIFS specification MID
0xFFFFshould 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 serverSigned-off-by Roberto Bergantinos Corpas <[email protected]>--- fs/cifs/smb1ops.c | 3 +++ 1 file changed, 3 insertions(+)fs/cifs/smb1ops.c +0
-0
fs/cifs/smb1ops.c cifs_get_next_mid(struct TCP_Server_Info *server)
Quoted 10 lines
fs/cifs/smb1ops.c +3
-1@@ -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. --
Steve, can we get this pushed to linus soonish? It is a bad issue.
Quoted 1 line · ronnie sahlberg
Steve, can we get this pushed to linus soonish? It is a bad issue.
Probably a good idea to CC: stable
Cheers,
Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)