Re: [PATCH] ksmbd: fix null-ptr-deref in smb2_get_info_filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2023-05-02 17:30 GMT+09:00, 張智諺 <cc85nod@xxxxxxxxx>:
> Sorry, I missed to add the curly brackets, I will resend new commit.
This issue was reported and it's already been fixed.

Thanks.
>
> Pumpkin <cc85nod@xxxxxxxxx> 於 2023年5月2日 週二 下午4:03寫道:
>
>> We do not assign path for those shares which have KSMBD_SHARE_FLAG_PIPE
>> flag, so we need to check if path is NULL before use it.
>>
>> [    8.067958]
>> ==================================================================
>> [    8.068413] BUG: KASAN: null-ptr-deref in strlen+0xa/0x40
>> [    8.068747] Read of size 1 at addr 0000000000000000 by task
>> kworker/0:2/45
>> ...
>> [    8.070638] Call Trace:
>> [    8.070797]  <TASK>
>> [    8.070931]  dump_stack_lvl+0x33/0x50
>> [    8.071351]  kasan_report+0xae/0xe0
>> [    8.071766]  strlen+0xa/0x40
>> [    8.071948]  getname_kernel+0x10/0x1a0
>> [    8.072182]  kern_path+0x10/0x40
>> [    8.072385]  smb2_get_info_filesystem+0xf9/0xc70
>> [    8.076519]  smb2_query_info+0x36b/0x1fd0
>> [    8.079913]  handle_ksmbd_work+0x274/0x810
>> [    8.080165]  process_one_work+0x419/0x760
>> [    8.080421]  worker_thread+0x2a2/0x6f0
>> [    8.080916]  kthread+0x160/0x190
>> [    8.081423]  ret_from_fork+0x1f/0x30
>> [    8.081648]  </TASK>
>>
>> Signed-off-by: Pumpkin <cc85nod@xxxxxxxxx>
>> ---
>>  fs/ksmbd/smb2pdu.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
>> index aa823b13d..798b193cf 100644
>> --- a/fs/ksmbd/smb2pdu.c
>> +++ b/fs/ksmbd/smb2pdu.c
>> @@ -4906,6 +4906,9 @@ static int smb2_get_info_filesystem(struct
>> ksmbd_work *work,
>>         int rc = 0, len;
>>         int fs_infoclass_size = 0;
>>
>> +       if (share->path == NULL)
>> +               return -EIO;
>> +
>>         rc = kern_path(share->path, LOOKUP_NO_SYMLINKS, &path);
>>         if (rc) {
>>                 pr_err("cannot create vfs path\n");
>> --
>> 2.39.2 (Apple Git-143)
>>
>>
>




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux