]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ice: ensure the copied buf is NUL terminated
authorBui Quang Minh <minhquangbui99@gmail.com>
Wed, 24 Apr 2024 14:44:18 +0000 (21:44 +0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 26 Apr 2024 02:23:11 +0000 (19:23 -0700)
commit666854ea9cad844f75a068f32812a2d78004914a
treeabe621b87f1b9b7512c3babfdae15a2afaa03629
parent52afb15e9d9a021ab6eec923a087ec9f518cb713
ice: ensure the copied buf is NUL terminated

Currently, we allocate a count-sized kernel buffer and copy count bytes
from userspace to that buffer. Later, we use sscanf on this buffer but we
don't ensure that the string is terminated inside the buffer, this can lead
to OOB read when using sscanf. Fix this issue by using memdup_user_nul
instead of memdup_user.

Fixes: 96a9a9341cda ("ice: configure FW logging")
Fixes: 73671c3162c8 ("ice: enable FW logging")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Link: https://lore.kernel.org/r/20240424-fix-oob-read-v2-1-f1f1b53a10f4@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_debugfs.c