<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/ksmbd/connection.c, branch linux-6.3.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.3.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.3.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-06-21T14:02:05Z</updated>
<entry>
<title>ksmbd: validate smb request protocol id</title>
<updated>2023-06-21T14:02:05Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-05-31T08:59:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=75e7d81679ef7995422adc84ef597fded99c24a6'/>
<id>urn:sha1:75e7d81679ef7995422adc84ef597fded99c24a6</id>
<content type='text'>
[ Upstream commit 1c1bcf2d3ea061613119b534f57507c377df20f9 ]

This patch add the validation for smb request protocol id.
If it is not one of the four ids(SMB1_PROTO_NUMBER, SMB2_PROTO_NUMBER,
SMB2_TRANSFORM_PROTO_NUM, SMB2_COMPRESSION_TRANSFORM_ID), don't allow
processing the request. And this will fix the following KASAN warning
also.

[   13.905265] BUG: KASAN: slab-out-of-bounds in init_smb2_rsp_hdr+0x1b9/0x1f0
[   13.905900] Read of size 16 at addr ffff888005fd2f34 by task kworker/0:2/44
...
[   13.908553] Call Trace:
[   13.908793]  &lt;TASK&gt;
[   13.908995]  dump_stack_lvl+0x33/0x50
[   13.909369]  print_report+0xcc/0x620
[   13.910870]  kasan_report+0xae/0xe0
[   13.911519]  kasan_check_range+0x35/0x1b0
[   13.911796]  init_smb2_rsp_hdr+0x1b9/0x1f0
[   13.912492]  handle_ksmbd_work+0xe5/0x820

Cc: stable@vger.kernel.org
Reported-by: Chih-Yen Chang &lt;cc85nod@gmail.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ksmbd: check the validation of pdu_size in ksmbd_conn_handler_loop</title>
<updated>2023-06-14T09:17:04Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-05-30T14:10:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9cb7be2fcbaee9e808b729e92948d38d52e5add'/>
<id>urn:sha1:e9cb7be2fcbaee9e808b729e92948d38d52e5add</id>
<content type='text'>
commit 368ba06881c395f1c9a7ba22203cf8d78b4addc0 upstream.

The length field of netbios header must be greater than the SMB header
sizes(smb1 or smb2 header), otherwise the packet is an invalid SMB packet.

If `pdu_size` is 0, ksmbd allocates a 4 bytes chunk to `conn-&gt;request_buf`.
In the function `get_smb2_cmd_val` ksmbd will read cmd from
`rcv_hdr-&gt;Command`, which is `conn-&gt;request_buf + 12`, causing the KASAN
detector to print the following error message:

[    7.205018] BUG: KASAN: slab-out-of-bounds in get_smb2_cmd_val+0x45/0x60
[    7.205423] Read of size 2 at addr ffff8880062d8b50 by task ksmbd:42632/248
...
[    7.207125]  &lt;TASK&gt;
[    7.209191]  get_smb2_cmd_val+0x45/0x60
[    7.209426]  ksmbd_conn_enqueue_request+0x3a/0x100
[    7.209712]  ksmbd_server_process_request+0x72/0x160
[    7.210295]  ksmbd_conn_handler_loop+0x30c/0x550
[    7.212280]  kthread+0x160/0x190
[    7.212762]  ret_from_fork+0x1f/0x30
[    7.212981]  &lt;/TASK&gt;

Cc: stable@vger.kernel.org
Reported-by: Chih-Yen Chang &lt;cc85nod@gmail.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ksmbd: allocate one more byte for implied bcc[0]</title>
<updated>2023-05-24T16:30:21Z</updated>
<author>
<name>Chih-Yen Chang</name>
</author>
<published>2023-05-05T15:03:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=778aae5a513ea09aa5addfa352bd70a5b71dda85'/>
<id>urn:sha1:778aae5a513ea09aa5addfa352bd70a5b71dda85</id>
<content type='text'>
commit 443d61d1fa9faa60ef925513d83742902390100f upstream.

ksmbd_smb2_check_message allows client to return one byte more, so we
need to allocate additional memory in ksmbd_conn_handler_loop to avoid
out-of-bound access.

Cc: stable@vger.kernel.org
Signed-off-by: Chih-Yen Chang &lt;cc85nod@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ksmbd: fix racy issue from smb2 close and logoff with multichannel</title>
<updated>2023-05-11T14:16:52Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-05-03T05:03:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=920d5dd2d041484bf001c9713c2e3bcc6de79726'/>
<id>urn:sha1:920d5dd2d041484bf001c9713c2e3bcc6de79726</id>
<content type='text'>
commit abcc506a9a71976a8b4c9bf3ee6efd13229c1e19 upstream.

When smb client send concurrent smb2 close and logoff request
with multichannel connection, It can cause racy issue. logoff request
free tcon and can cause UAF issues in smb2 close. When receiving logoff
request with multichannel, ksmbd should wait until all remaning requests
complete as well as ones in the current connection, and then make
session expired.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20796 ZDI-CAN-20595
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ksmbd: fix racy issue from session setup and logoff</title>
<updated>2023-05-11T14:16:52Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-05-03T07:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02f41d88f15d6b7d523e52cc3f87488f57e9265b'/>
<id>urn:sha1:02f41d88f15d6b7d523e52cc3f87488f57e9265b</id>
<content type='text'>
commit f5c779b7ddbda30866cf2a27c63e34158f858c73 upstream.

This racy issue is triggered by sending concurrent session setup and
logoff requests. This patch does not set connection status as
KSMBD_SESS_GOOD if state is KSMBD_SESS_NEED_RECONNECT in session setup.
And relookup session to validate if session is deleted in logoff.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20481, ZDI-CAN-20590, ZDI-CAN-20596
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ksmbd: delete asynchronous work from list</title>
<updated>2023-04-03T04:08:52Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-03-30T23:42:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3a9b557f44ea8f216aab515a7db20e23f0eb51b9'/>
<id>urn:sha1:3a9b557f44ea8f216aab515a7db20e23f0eb51b9</id>
<content type='text'>
When smb2_lock request is canceled by smb2_cancel or smb2_close(),
ksmbd is missing deleting async_request_entry async_requests list.
Because calling init_smb2_rsp_hdr() in smb2_lock() mark -&gt;synchronous
as true and then it will not be deleted in
ksmbd_conn_try_dequeue_request(). This patch add release_async_work() to
release the ones allocated for async work.

Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ksmbd: do not call kvmalloc() with __GFP_NORETRY | __GFP_NO_WARN</title>
<updated>2023-03-25T19:54:06Z</updated>
<author>
<name>Marios Makassikis</name>
</author>
<published>2023-03-16T13:40:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e416ea62a9166e6075a07a970cc5bf79255d2700'/>
<id>urn:sha1:e416ea62a9166e6075a07a970cc5bf79255d2700</id>
<content type='text'>
Commit 83dcedd5540d ("ksmbd: fix infinite loop in ksmbd_conn_handler_loop()"),
changes GFP modifiers passed to kvmalloc(). This cause xfstests generic/551
test to fail. We limit pdu length size according to connection status and
maximum number of connections. In the rest, memory allocation of request
is limited by credit management. so these flags are no longer needed.

Fixes: 83dcedd5540d ("ksmbd: fix infinite loop in ksmbd_conn_handler_loop()")
Cc: stable@vger.kernel.org
Signed-off-by: Marios Makassikis &lt;mmakassikis@freebox.fr&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ksmbd: return unsupported error on smb1 mount</title>
<updated>2023-03-24T05:23:13Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-03-23T12:15:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=39b291b86b5988bf8753c3874d5c773399d09b96'/>
<id>urn:sha1:39b291b86b5988bf8753c3874d5c773399d09b96</id>
<content type='text'>
ksmbd disconnect connection when mounting with vers=smb1.
ksmbd should send smb1 negotiate response to client for correct
unsupported error return. This patch add needed SMB1 macros and fill
NegProt part of the response for smb1 negotiate response.

Cc: stable@vger.kernel.org
Reported-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ksmbd: don't terminate inactive sessions after a few seconds</title>
<updated>2023-03-22T21:38:33Z</updated>
<author>
<name>Namjae Jeon</name>
</author>
<published>2023-03-21T06:25:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=be6f42fad5f5fd1fea9d562df82c38ad6ed3bfe9'/>
<id>urn:sha1:be6f42fad5f5fd1fea9d562df82c38ad6ed3bfe9</id>
<content type='text'>
Steve reported that inactive sessions are terminated after a few
seconds. ksmbd terminate when receiving -EAGAIN error from
kernel_recvmsg(). -EAGAIN means there is no data available in timeout.
So ksmbd should keep connection with unlimited retries instead of
terminating inactive sessions.

Cc: stable@vger.kernel.org
Reported-by: Steve French &lt;stfrench@microsoft.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>ksmbd: Fix spelling mistake "excceed" -&gt; "exceeded"</title>
<updated>2023-01-31T02:49:30Z</updated>
<author>
<name>Colin Ian King</name>
</author>
<published>2023-01-30T09:23:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a17c61ee3b2683c40090179c273f4701fca9677'/>
<id>urn:sha1:7a17c61ee3b2683c40090179c273f4701fca9677</id>
<content type='text'>
There is a spelling mistake in an error message. Fix it.

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Acked-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
</feed>
