[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq1czh4t3ab.fsf@ca-mkp.ca.oracle.com>
Date: Tue, 26 Apr 2022 08:52:58 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: Xiaomeng Tong <xiam0nd.tong@...il.com>
Cc: oliver@...kum.org, aliakc@....de, lenehan@...bble.org,
jejb@...ux.ibm.com, martin.petersen@...cle.com, dc395x@...bble.org,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [RESEND][PATCH] scsi: dc395x: fix a missing check on list iterator
Xiaomeng,
> The bug is here:
> p->target_id, p->target_lun);
>
> The list iterator 'p' will point to a bogus position containing HEAD
> if the list is empty or no element is found. This case must be checked
> before any use of the iterator, otherwise it will lead to a invalid
> memory access.
>
> To fix this bug, add an check. Use a new variable 'iter' as the list
> iterator, while use the origin variable 'p' as a dedicated pointer to
> point to the found element.
Applied to 5.19/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
Powered by blists - more mailing lists