Lines Matching +full:entry +full:- +full:method

1 // SPDX-License-Identifier: GPL-2.0-or-later
27 unsigned int method; member
35 xa_for_each(&sess->ksmbd_chann_list, index, chann) { in free_channel_list()
36 xa_erase(&sess->ksmbd_chann_list, index); in free_channel_list()
40 xa_destroy(&sess->ksmbd_chann_list); in free_channel_list()
44 struct ksmbd_session_rpc *entry) in __session_rpc_close() argument
48 resp = ksmbd_rpc_close(sess, entry->id); in __session_rpc_close()
50 pr_err("Unable to close RPC pipe %d\n", entry->id); in __session_rpc_close()
53 ksmbd_rpc_id_free(entry->id); in __session_rpc_close()
54 kfree(entry); in __session_rpc_close()
59 struct ksmbd_session_rpc *entry; in ksmbd_session_rpc_clear_list() local
62 xa_for_each(&sess->rpc_handle_list, index, entry) { in ksmbd_session_rpc_clear_list()
63 xa_erase(&sess->rpc_handle_list, index); in ksmbd_session_rpc_clear_list()
64 __session_rpc_close(sess, entry); in ksmbd_session_rpc_clear_list()
67 xa_destroy(&sess->rpc_handle_list); in ksmbd_session_rpc_clear_list()
93 struct ksmbd_session_rpc *entry, *old; in ksmbd_session_rpc_open() local
95 int method; in ksmbd_session_rpc_open() local
97 method = __rpc_method(rpc_name); in ksmbd_session_rpc_open()
98 if (!method) in ksmbd_session_rpc_open()
99 return -EINVAL; in ksmbd_session_rpc_open()
101 entry = kzalloc(sizeof(struct ksmbd_session_rpc), GFP_KERNEL); in ksmbd_session_rpc_open()
102 if (!entry) in ksmbd_session_rpc_open()
103 return -ENOMEM; in ksmbd_session_rpc_open()
105 entry->method = method; in ksmbd_session_rpc_open()
106 entry->id = ksmbd_ipc_id_alloc(); in ksmbd_session_rpc_open()
107 if (entry->id < 0) in ksmbd_session_rpc_open()
109 old = xa_store(&sess->rpc_handle_list, entry->id, entry, GFP_KERNEL); in ksmbd_session_rpc_open()
113 resp = ksmbd_rpc_open(sess, entry->id); in ksmbd_session_rpc_open()
118 return entry->id; in ksmbd_session_rpc_open()
120 xa_erase(&sess->rpc_handle_list, entry->id); in ksmbd_session_rpc_open()
122 ksmbd_rpc_id_free(entry->id); in ksmbd_session_rpc_open()
124 kfree(entry); in ksmbd_session_rpc_open()
125 return -EINVAL; in ksmbd_session_rpc_open()
130 struct ksmbd_session_rpc *entry; in ksmbd_session_rpc_close() local
132 entry = xa_erase(&sess->rpc_handle_list, id); in ksmbd_session_rpc_close()
133 if (entry) in ksmbd_session_rpc_close()
134 __session_rpc_close(sess, entry); in ksmbd_session_rpc_close()
139 struct ksmbd_session_rpc *entry; in ksmbd_session_rpc_method() local
141 entry = xa_load(&sess->rpc_handle_list, id); in ksmbd_session_rpc_method()
142 return entry ? entry->method : 0; in ksmbd_session_rpc_method()
150 if (sess->user) in ksmbd_session_destroy()
151 ksmbd_free_user(sess->user); in ksmbd_session_destroy()
154 ksmbd_destroy_file_table(&sess->file_table); in ksmbd_session_destroy()
158 kfree(sess->Preauth_HashValue); in ksmbd_session_destroy()
159 ksmbd_release_id(&session_ida, sess->id); in ksmbd_session_destroy()
168 if (id == sess->id) { in __session_lookup()
169 sess->last_active = jiffies; in __session_lookup()
182 down_write(&conn->session_lock); in ksmbd_expire_session()
183 xa_for_each(&conn->sessions, id, sess) { in ksmbd_expire_session()
184 if (atomic_read(&sess->refcnt) == 0 && in ksmbd_expire_session()
185 (sess->state != SMB2_SESSION_VALID || in ksmbd_expire_session()
187 sess->last_active + SMB2_SESSION_TIMEOUT))) { in ksmbd_expire_session()
188 xa_erase(&conn->sessions, sess->id); in ksmbd_expire_session()
189 hash_del(&sess->hlist); in ksmbd_expire_session()
194 up_write(&conn->session_lock); in ksmbd_expire_session()
201 sess->dialect = conn->dialect; in ksmbd_session_register()
202 memcpy(sess->ClientGUID, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE); in ksmbd_session_register()
204 return xa_err(xa_store(&conn->sessions, sess->id, sess, GFP_KERNEL)); in ksmbd_session_register()
211 chann = xa_erase(&sess->ksmbd_chann_list, (long)conn); in ksmbd_chann_del()
213 return -ENOENT; in ksmbd_chann_del()
225 if (conn->binding) { in ksmbd_sessions_deregister()
231 xa_empty(&sess->ksmbd_chann_list)) { in ksmbd_sessions_deregister()
232 hash_del(&sess->hlist); in ksmbd_sessions_deregister()
238 down_write(&conn->session_lock); in ksmbd_sessions_deregister()
239 xa_for_each(&conn->sessions, id, sess) { in ksmbd_sessions_deregister()
243 xa_for_each(&sess->ksmbd_chann_list, chann_id, chann) { in ksmbd_sessions_deregister()
244 if (chann->conn != conn) in ksmbd_sessions_deregister()
245 ksmbd_conn_set_exiting(chann->conn); in ksmbd_sessions_deregister()
249 if (xa_empty(&sess->ksmbd_chann_list)) { in ksmbd_sessions_deregister()
250 xa_erase(&conn->sessions, sess->id); in ksmbd_sessions_deregister()
251 hash_del(&sess->hlist); in ksmbd_sessions_deregister()
255 up_write(&conn->session_lock); in ksmbd_sessions_deregister()
264 down_read(&conn->session_lock); in ksmbd_session_lookup()
265 sess = xa_load(&conn->sessions, id); in ksmbd_session_lookup()
267 sess->last_active = jiffies; in ksmbd_session_lookup()
268 up_read(&conn->session_lock); in ksmbd_session_lookup()
289 if (!sess && conn->binding) in ksmbd_session_lookup_all()
291 if (sess && sess->state != SMB2_SESSION_VALID) in ksmbd_session_lookup_all()
298 atomic_inc(&sess->refcnt); in ksmbd_user_session_get()
306 if (atomic_read(&sess->refcnt) <= 0) in ksmbd_user_session_put()
309 atomic_dec(&sess->refcnt); in ksmbd_user_session_put()
321 sess->id = sess_id; in ksmbd_preauth_session_alloc()
322 memcpy(sess->Preauth_HashValue, conn->preauth_info->Preauth_HashValue, in ksmbd_preauth_session_alloc()
324 list_add(&sess->preauth_entry, &conn->preauth_sess_table); in ksmbd_preauth_session_alloc()
337 down_write(&conn->session_lock); in destroy_previous_session()
339 if (!prev_sess || prev_sess->state == SMB2_SESSION_EXPIRED) in destroy_previous_session()
342 prev_user = prev_sess->user; in destroy_previous_session()
344 strcmp(user->name, prev_user->name) || in destroy_previous_session()
345 user->passkey_sz != prev_user->passkey_sz || in destroy_previous_session()
346 memcmp(user->passkey, prev_user->passkey, user->passkey_sz)) in destroy_previous_session()
356 ksmbd_destroy_file_table(&prev_sess->file_table); in destroy_previous_session()
357 prev_sess->state = SMB2_SESSION_EXPIRED; in destroy_previous_session()
361 up_write(&conn->session_lock); in destroy_previous_session()
368 return sess->id == id; in ksmbd_preauth_session_id_match()
376 list_for_each_entry(sess, &conn->preauth_sess_table, preauth_entry) { in ksmbd_preauth_session_lookup()
388 return -EINVAL; in __init_smb2_session()
389 sess->id = id; in __init_smb2_session()
405 if (ksmbd_init_file_table(&sess->file_table)) in __session_create()
408 sess->last_active = jiffies; in __session_create()
409 sess->state = SMB2_SESSION_IN_PROGRESS; in __session_create()
411 xa_init(&sess->tree_conns); in __session_create()
412 xa_init(&sess->ksmbd_chann_list); in __session_create()
413 xa_init(&sess->rpc_handle_list); in __session_create()
414 sess->sequence_number = 1; in __session_create()
415 rwlock_init(&sess->tree_conns_lock); in __session_create()
416 atomic_set(&sess->refcnt, 1); in __session_create()
422 ida_init(&sess->tree_conn_ida); in __session_create()
425 hash_add(sessions_table, &sess->hlist, sess->id); in __session_create()
442 int id = -EINVAL; in ksmbd_acquire_tree_conn_id()
445 id = ksmbd_acquire_smb2_tid(&sess->tree_conn_ida); in ksmbd_acquire_tree_conn_id()
453 ksmbd_release_id(&sess->tree_conn_ida, id); in ksmbd_release_tree_conn_id()