Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '6.17-RC4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

- Fix two potential NULL pointer references

- Two debugging improvements (to help debug recent issues) a new
tracepoint, and minor improvement to DebugData

- Trivial comment cleanup

* tag '6.17-RC4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: prevent NULL pointer dereference in UTF16 conversion
smb: client: show negotiated cipher in DebugData
smb: client: add new tracepoint to trace lease break notification
smb: client: fix spellings in comments
smb: client: Fix NULL pointer dereference in cifs_debug_dirs_proc_show()

+96 -19
+24 -7
fs/smb/client/cifs_debug.c
··· 304 304 list_for_each(tmp1, &ses->tcon_list) { 305 305 tcon = list_entry(tmp1, struct cifs_tcon, tcon_list); 306 306 cfids = tcon->cfids; 307 + if (!cfids) 308 + continue; 307 309 spin_lock(&cfids->cfid_list_lock); /* check lock ordering */ 308 310 seq_printf(m, "Num entries: %d\n", cfids->num_entries); 309 311 list_for_each_entry(cfid, &cfids->entries, entry) { ··· 321 319 seq_printf(m, "\n"); 322 320 } 323 321 spin_unlock(&cfids->cfid_list_lock); 324 - 325 - 326 322 } 327 323 } 328 324 } ··· 344 344 return "Pattern_V1"; 345 345 default: 346 346 return "invalid"; 347 + } 348 + } 349 + 350 + static __always_inline const char *cipher_alg_str(__le16 cipher) 351 + { 352 + switch (cipher) { 353 + case SMB2_ENCRYPTION_AES128_CCM: 354 + return "AES128-CCM"; 355 + case SMB2_ENCRYPTION_AES128_GCM: 356 + return "AES128-GCM"; 357 + case SMB2_ENCRYPTION_AES256_CCM: 358 + return "AES256-CCM"; 359 + case SMB2_ENCRYPTION_AES256_GCM: 360 + return "AES256-GCM"; 361 + default: 362 + return "UNKNOWN"; 347 363 } 348 364 } 349 365 ··· 555 539 else 556 540 seq_puts(m, "disabled (not supported by this server)"); 557 541 542 + /* Show negotiated encryption cipher, even if not required */ 543 + seq_puts(m, "\nEncryption: "); 544 + if (server->cipher_type) 545 + seq_printf(m, "Negotiated cipher (%s)", cipher_alg_str(server->cipher_type)); 546 + 558 547 seq_printf(m, "\n\n\tSessions: "); 559 548 i = 0; 560 549 list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { ··· 597 576 598 577 /* dump session id helpful for use with network trace */ 599 578 seq_printf(m, " SessionId: 0x%llx", ses->Suid); 600 - if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) { 579 + if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) 601 580 seq_puts(m, " encrypted"); 602 - /* can help in debugging to show encryption type */ 603 - if (server->cipher_type == SMB2_ENCRYPTION_AES256_GCM) 604 - seq_puts(m, "(gcm256)"); 605 - } 606 581 if (ses->sign) 607 582 seq_puts(m, " signed"); 608 583
+3
fs/smb/client/cifs_unicode.c
··· 629 629 int len; 630 630 __le16 *dst; 631 631 632 + if (!src) 633 + return NULL; 634 + 632 635 len = cifs_local_to_utf16_bytes(src, maxlen, cp); 633 636 len += 2; /* NULL */ 634 637 dst = kmalloc(len, GFP_KERNEL);
+1 -1
fs/smb/client/reparse.c
··· 278 278 } 279 279 280 280 /* 281 - * For absolute symlinks it is not possible to determinate 281 + * For absolute symlinks it is not possible to determine 282 282 * if it should point to directory or file. 283 283 */ 284 284 if (symname[0] == '/') {
+2 -2
fs/smb/client/smb1ops.c
··· 1005 1005 rc = -EOPNOTSUPP; 1006 1006 } 1007 1007 1008 - /* Fallback to SMB_COM_SETATTR command when absolutelty needed. */ 1008 + /* Fallback to SMB_COM_SETATTR command when absolutely needed. */ 1009 1009 if (rc == -EOPNOTSUPP) { 1010 1010 cifs_dbg(FYI, "calling SetInformation since SetPathInfo for attrs/times not supported by this server\n"); 1011 1011 rc = SMBSetInformation(xid, tcon, full_path, ··· 1039 1039 cifsFileInfo_put(open_file); 1040 1040 1041 1041 /* 1042 - * Setting the read-only bit is not honered on non-NT servers when done 1042 + * Setting the read-only bit is not honored on non-NT servers when done 1043 1043 * via open-semantics. So for setting it, use SMB_COM_SETATTR command. 1044 1044 * This command works only after the file is closed, so use it only when 1045 1045 * operation was called without the filehandle.
+15 -4
fs/smb/client/smb2misc.c
··· 614 614 struct cifs_tcon *tcon; 615 615 struct cifs_pending_open *open; 616 616 617 + /* Trace receipt of lease break request from server */ 618 + trace_smb3_lease_break_enter(le32_to_cpu(rsp->CurrentLeaseState), 619 + le32_to_cpu(rsp->Flags), 620 + le16_to_cpu(rsp->Epoch), 621 + le32_to_cpu(rsp->hdr.Id.SyncId.TreeId), 622 + le64_to_cpu(rsp->hdr.SessionId), 623 + *((u64 *)rsp->LeaseKey), 624 + *((u64 *)&rsp->LeaseKey[8])); 625 + 617 626 cifs_dbg(FYI, "Checking for lease break\n"); 618 627 619 628 /* If server is a channel, select the primary channel */ ··· 669 660 spin_unlock(&cifs_tcp_ses_lock); 670 661 cifs_dbg(FYI, "Can not process lease break - no lease matched\n"); 671 662 trace_smb3_lease_not_found(le32_to_cpu(rsp->CurrentLeaseState), 672 - le32_to_cpu(rsp->hdr.Id.SyncId.TreeId), 673 - le64_to_cpu(rsp->hdr.SessionId), 674 - *((u64 *)rsp->LeaseKey), 675 - *((u64 *)&rsp->LeaseKey[8])); 663 + le32_to_cpu(rsp->Flags), 664 + le16_to_cpu(rsp->Epoch), 665 + le32_to_cpu(rsp->hdr.Id.SyncId.TreeId), 666 + le64_to_cpu(rsp->hdr.SessionId), 667 + *((u64 *)rsp->LeaseKey), 668 + *((u64 *)&rsp->LeaseKey[8])); 676 669 677 670 return false; 678 671 }
+2 -2
fs/smb/client/smb2pdu.c
··· 6192 6192 please_key_high = (__u64 *)(lease_key+8); 6193 6193 if (rc) { 6194 6194 cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE); 6195 - trace_smb3_lease_err(le32_to_cpu(lease_state), tcon->tid, 6195 + trace_smb3_lease_ack_err(le32_to_cpu(lease_state), tcon->tid, 6196 6196 ses->Suid, *please_key_low, *please_key_high, rc); 6197 6197 cifs_dbg(FYI, "Send error in Lease Break = %d\n", rc); 6198 6198 } else 6199 - trace_smb3_lease_done(le32_to_cpu(lease_state), tcon->tid, 6199 + trace_smb3_lease_ack_done(le32_to_cpu(lease_state), tcon->tid, 6200 6200 ses->Suid, *please_key_low, *please_key_high); 6201 6201 6202 6202 return rc;
+49 -3
fs/smb/client/trace.h
··· 1171 1171 __u64 lease_key_high), \ 1172 1172 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high)) 1173 1173 1174 - DEFINE_SMB3_LEASE_DONE_EVENT(lease_done); 1175 - DEFINE_SMB3_LEASE_DONE_EVENT(lease_not_found); 1174 + DEFINE_SMB3_LEASE_DONE_EVENT(lease_ack_done); 1175 + /* Tracepoint when a lease break request is received/entered (includes epoch and flags) */ 1176 + DECLARE_EVENT_CLASS(smb3_lease_enter_class, 1177 + TP_PROTO(__u32 lease_state, 1178 + __u32 flags, 1179 + __u16 epoch, 1180 + __u32 tid, 1181 + __u64 sesid, 1182 + __u64 lease_key_low, 1183 + __u64 lease_key_high), 1184 + TP_ARGS(lease_state, flags, epoch, tid, sesid, lease_key_low, lease_key_high), 1185 + TP_STRUCT__entry( 1186 + __field(__u32, lease_state) 1187 + __field(__u32, flags) 1188 + __field(__u16, epoch) 1189 + __field(__u32, tid) 1190 + __field(__u64, sesid) 1191 + __field(__u64, lease_key_low) 1192 + __field(__u64, lease_key_high) 1193 + ), 1194 + TP_fast_assign( 1195 + __entry->lease_state = lease_state; 1196 + __entry->flags = flags; 1197 + __entry->epoch = epoch; 1198 + __entry->tid = tid; 1199 + __entry->sesid = sesid; 1200 + __entry->lease_key_low = lease_key_low; 1201 + __entry->lease_key_high = lease_key_high; 1202 + ), 1203 + TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x flags=0x%x epoch=%u", 1204 + __entry->sesid, __entry->tid, __entry->lease_key_high, 1205 + __entry->lease_key_low, __entry->lease_state, __entry->flags, __entry->epoch) 1206 + ) 1207 + 1208 + #define DEFINE_SMB3_LEASE_ENTER_EVENT(name) \ 1209 + DEFINE_EVENT(smb3_lease_enter_class, smb3_##name, \ 1210 + TP_PROTO(__u32 lease_state, \ 1211 + __u32 flags, \ 1212 + __u16 epoch, \ 1213 + __u32 tid, \ 1214 + __u64 sesid, \ 1215 + __u64 lease_key_low, \ 1216 + __u64 lease_key_high), \ 1217 + TP_ARGS(lease_state, flags, epoch, tid, sesid, lease_key_low, lease_key_high)) 1218 + 1219 + DEFINE_SMB3_LEASE_ENTER_EVENT(lease_break_enter); 1220 + /* Lease not found: reuse lease_enter payload (includes epoch and flags) */ 1221 + DEFINE_SMB3_LEASE_ENTER_EVENT(lease_not_found); 1176 1222 1177 1223 DECLARE_EVENT_CLASS(smb3_lease_err_class, 1178 1224 TP_PROTO(__u32 lease_state, ··· 1259 1213 int rc), \ 1260 1214 TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc)) 1261 1215 1262 - DEFINE_SMB3_LEASE_ERR_EVENT(lease_err); 1216 + DEFINE_SMB3_LEASE_ERR_EVENT(lease_ack_err); 1263 1217 1264 1218 DECLARE_EVENT_CLASS(smb3_connect_class, 1265 1219 TP_PROTO(char *hostname,