Skip to content
Commit 5925e224 authored by Lin Ma's avatar Lin Ma Committed by Greg Kroah-Hartman
Browse files

scsi: qla4xxx: Add length check when parsing nlattrs

[ Upstream commit 47cd3770 ]

There are three places that qla4xxx parses nlattrs:

 - qla4xxx_set_chap_entry()

 - qla4xxx_iface_set_param()

 - qla4xxx_sysfs_ddb_set_param()

and each of them directly converts the nlattr to specific pointer of
structure without length checking. This could be dangerous as those
attributes are not validated and a malformed nlattr (e.g., length 0) could
result in an OOB read that leaks heap dirty data.

Add the nla_len check before accessing the nlattr data and return EINVAL if
the length check fails.

Fixes: 26ffd7b4 ("[SCSI] qla4xxx: Add support to set CHAP entries")
Fixes: 1e9e2be3 ("[SCSI] qla4xxx: Add flash node mgmt support")
Fixes: 00c31889

 ("[SCSI] qla4xxx: fix data alignment and use nl helpers")
Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
Link: https://lore.kernel.org/r/20230723080053.3714534-1-linma@zju.edu.cn
Reviewed-by: default avatarChris Leech <cleech@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 94ec7f34
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment