🇰🇷 한글 설명
Linux 커널의 CIFS 모듈에서 smb3_fs_context_parse_param 함수 오류 발생 시 메모리 누수가 발생하는 취약점입니다. mount 옵션 처리 중 오류가 발생하면 할당된 소스 문자열 메모리가 해제되지 않고 남게 되어 시스템 자원이 소모됩니다.
💡 쉬운 설명
컴퓨터가 파일을 연결하는 과정에서 오류가 났을 때, 사용했던 메모리를 제대로 돌려주지 않고 계속 붙잡고 있는 문제입니다. 이 문제가 반복되면 컴퓨터의 메모리가 부족해질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
cifs: fix memory leak in smb3_fs_context_parse_param error path
Add proper cleanup of ctx->source and fc->source to the
cifs_parse_mount_err error handler. This ensures that memory allocated
for the source strings is correctly freed on all error paths, matching
the cleanup already performed in the success path by
smb3_cleanup_fs_context_contents().
Pointers are also set to NULL after freeing to prevent potential
double-free issues.
This change fixes a memory leak originally detected by syzbot. The
leak occurred when processing Opt_source mount options if an error
happened after ctx->source and fc->source were successfully
allocated but before the function completed.
The specific leak sequence was:
1. ctx->source = smb3_fs_context_fullpath(ctx, '/') allocates memory
2. fc->source = kstrdup(ctx->source, GFP_KERNEL) allocates more memory
3. A subsequent error jumps to cifs_parse_mount_err
4. The old error handler freed passwords but not the source strings,
causing the memory to leak.
This issue was not addressed by commit e8c73eb7db0a ("cifs: client:
fix memory leak in smb3_fs_context_parse_param"), which only fixed
leaks from repeated fsconfig() calls but not this error path.
Patch updated with minor change suggested by kernel test robot
📍 영향받는 시스템
Linux Kernel (CIFS/SMB3 관련 모듈 사용 시스템)
⚔️ 공격 벡터
악의적인 mount 옵션을 사용하여 의도적으로 오류를 유발함으로써 메모리 누수 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인