]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: iscsi_tcp: Check that sock is valid before iscsi_set_param()
authorZhong Jinghua <zhongjinghua@huawei.com>
Wed, 29 Mar 2023 07:17:39 +0000 (15:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Apr 2023 14:55:31 +0000 (16:55 +0200)
commit6e06a68fbbfcd8576eee8f7139fa2b13c9b72e91
tree066d4e9adf60f8cbd684258a113fa6f0d9754c85
parent44374911ac63f769c442f56fdfadea673c5f4425
scsi: iscsi_tcp: Check that sock is valid before iscsi_set_param()

[ Upstream commit 48b19b79cfa37b1e50da3b5a8af529f994c08901 ]

The validity of sock should be checked before assignment to avoid incorrect
values. Commit 57569c37f0ad ("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: 57569c37f0ad ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()")
Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com>
Link: https://lore.kernel.org/r/20230329071739.2175268-1-zhongjinghua@huaweicloud.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/iscsi_tcp.c