]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()
authorHarshvardhan Jha <harshvardhan.jha@oracle.com>
Thu, 8 Jul 2021 07:46:42 +0000 (13:16 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 29 Jul 2021 03:29:09 +0000 (23:29 -0400)
commit24d7379ae24f3dd2b603c1d31d9dde79196bef9e
tree9ecd57ea025a3d4f4405df2b9d8f2e0d0ac02558
parent6fd39003fb17cb4462bb5e613ee48fac958cc2f7
scsi: megaraid_mm: Fix end of loop tests for list_for_each_entry()

The list_for_each_entry() iterator, "adapter" in this code, can never be
NULL.  If we exit the loop without finding the correct adapter then
"adapter" points invalid memory that is an offset from the list head.  This
will eventually lead to memory corruption and presumably a kernel crash.

Link: https://lore.kernel.org/r/20210708074642.23599-1-harshvardhan.jha@oracle.com
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_mm.c