LinuxのLinux KernelにおけるNULL ポインタデリファレンスに関する脆弱性
タイトル LinuxのLinux KernelにおけるNULL ポインタデリファレンスに関する脆弱性
概要

Linuxカーネルにおいて、以下の脆弱性が修正されました。ksmbdのsmb2_lock()関数におけるメモリリークおよびNULL参照の問題を修正しました。smb2_lock()では、no_check_clでlist_del()がsmb_lockをlock_listから切り離した後に、3つのエラー処理問題が存在していました。まず、非UNLOCKパスにおいてvfs_lock_file()が予期しないエラーを返した場合、goto outによってsmb_lockおよびそのflockがリークしていました。これはout:ハンドラがlock_listとrollback_listのみをイテレートし、切り離されたsmb_lockを含んでいなかったためです。次に、UNLOCKパスでvfs_lock_file()が-ENOENTを返した場合も同様に、goto outによってsmb_lockとflockがリークし、ディスパッチャに返されるエラーコードも古いままでした。最後に、ロールバックパスでsmb_flock_init()が割り当て失敗によりNULLを返すことがあり、その戻り値が無条件に参照されたため、カーネルのNULLポインタ参照が発生していました。クラッシュを防ぐためにNULLチェックを追加し、管理情報を適切にクリーンアップしています。割り当てがない場合、VFSロック自体はロールバックできず、ファイルまたは接続の終了時に解放されます。ケース1および2については、UNLOCKブランチのif(!rc)チェックの前にlocks_free_lock()やkfree()を移動させ、すべての終了パスが1つの解放箇所を共有するように修正しました。また、非UNLOCKブランチではgoto outの前にsmb_lockとflockを解放するようにしています。さらに、両ケースで正しいエラーコードを伝播させるようにしています。ケース3は、VFSアンロックをif(rlock)でガードし、共通のクリーンアップ処理内でlocks_free_lock(rlock)のNULLチェックを追加して修正しました。この脆弱性はsqryを用いたコールグラフ解析で発見されました。

想定される影響 当該ソフトウェアが扱う情報について、外部への漏えいは発生しません。 また、当該ソフトウェアが扱う情報について、書き換えは発生しません。 さらに、当該ソフトウェアが完全に停止する可能性があります。 そして、この脆弱性を悪用した攻撃の影響は、他のソフトウェアには及びません。 
対策

リリース情報、またはパッチ情報が公開されています。参考情報を参照して適切な対策を実施してください。

公表日 2026年4月22日0:00
登録日 2026年4月30日12:10
最終更新日 2026年4月30日12:10
CVSS3.0 : 重要
スコア 7.5
ベクター CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
影響を受けるシステム
Linux
Linux Kernel 5.15
Linux Kernel 5.15.1 以上 6.1.168 未満
Linux Kernel 6.13 以上 6.18.21 未満
Linux Kernel 6.19 以上 6.19.11 未満
Linux Kernel 6.2 以上 6.6.131 未満
Linux Kernel 6.7 以上 6.12.80 未満
Linux Kernel 7.0
CVE (情報セキュリティ 共通脆弱性識別子)
CWE (共通脆弱性タイプ一覧)
その他
変更履歴
No 変更内容 変更日
1 [2026年04月30日]
  掲載
2026年4月30日12:10

NVD脆弱性情報
CVE-2026-31477
概要

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: fix memory leaks and NULL deref in smb2_lock()

smb2_lock() has three error handling issues after list_del() detaches
smb_lock from lock_list at no_check_cl:

1) If vfs_lock_file() returns an unexpected error in the non-UNLOCK
path, goto out leaks smb_lock and its flock because the out:
handler only iterates lock_list and rollback_list, neither of
which contains the detached smb_lock.

2) If vfs_lock_file() returns -ENOENT in the UNLOCK path, goto out
leaks smb_lock and flock for the same reason. The error code
returned to the dispatcher is also stale.

3) In the rollback path, smb_flock_init() can return NULL on
allocation failure. The result is dereferenced unconditionally,
causing a kernel NULL pointer dereference. Add a NULL check to
prevent the crash and clean up the bookkeeping; the VFS lock
itself cannot be rolled back without the allocation and will be
released at file or connection teardown.

Fix cases 1 and 2 by hoisting the locks_free_lock()/kfree() to before
the if(!rc) check in the UNLOCK branch so all exit paths share one
free site, and by freeing smb_lock and flock before goto out in the
non-UNLOCK branch. Propagate the correct error code in both cases.
Fix case 3 by wrapping the VFS unlock in an if(rlock) guard and adding
a NULL check for locks_free_lock(rlock) in the shared cleanup.

Found via call-graph analysis using sqry.

公表日 2026年4月22日23:16
登録日 2026年4月25日4:05
最終更新日 2026年4月27日23:16
関連情報、対策とツール
共通脆弱性一覧