Commit 3722873a authored by Zhong Jinghua's avatar Zhong Jinghua
Browse files

scsi: iscsi_tcp: Check that sock is valid before iscsi_set_param()

mainline inclusion
from mainline-v6.3-rc6
commit 48b19b79
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7L8DZ?from=project-issue
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=48b19b79cfa37b1e50da3b5a8af529f994c08901



----------------------------------------

The validity of sock should be checked before assignment to avoid incorrect
values. Commit 57569c37 ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref
while calling getpeername()") introduced this change which may lead to
inconsistent values of tcp_sw_conn->sendpage and conn->datadgst_en.

Fix the issue by moving the position of the assignment.

Fixes: 57569c37 ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()")
Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
Link: https://lore.kernel.org/r/20230329071739.2175268-1-zhongjinghua@huaweicloud.com


Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
parent 80e7361a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment