Commit 734e996
smb: client: fix potential UAF in smb2_close_cached_fid()
find_or_create_cached_dir() could grab a new reference after kref_put()
had seen the refcount drop to zero but before cfid_list_lock is acquired
in smb2_close_cached_fid(), leading to use-after-free.
Switch to kref_put_lock() so cfid_release() is called with
cfid_list_lock held, closing that gap.
Fixes: ebe98f1 ("cifs: enable caching of directories for which a lease is held")
Cc: stable@vger.kernel.org
Reported-by: Jay Shin <jaeshin@redhat.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Henrique Carvalho <henrique.carvalho@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>1 parent 6146a0f commit 734e996
1 file changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
446 | | - | |
| 447 | + | |
| 448 | + | |
447 | 449 | | |
448 | 450 | | |
449 | 451 | | |
| |||
478 | 480 | | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
| 483 | + | |
482 | 484 | | |
483 | 485 | | |
484 | 486 | | |
| |||
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
490 | | - | |
| 492 | + | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
596 | 598 | | |
597 | 599 | | |
598 | 600 | | |
599 | | - | |
| 601 | + | |
600 | 602 | | |
601 | 603 | | |
602 | 604 | | |
| |||
762 | 764 | | |
763 | 765 | | |
764 | 766 | | |
765 | | - | |
| 767 | + | |
766 | 768 | | |
767 | 769 | | |
768 | 770 | | |
| |||
0 commit comments