]> git.baikalelectronics.ru Git - kernel.git/commit
media: [PATCH] pci: atomisp_cmd: fix three missing checks on list iterator
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Thu, 14 Apr 2022 04:14:15 +0000 (05:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:22:57 +0000 (14:22 +0200)
commite434cffbce30ddef2c755fb7952fb9c2d4f6c677
tree94c162fdef73118bc024d4c0164a48785bbc9ad2
parent551a5fc8e5543c99c7f264ceb505b128b5259e74
media: [PATCH] pci: atomisp_cmd: fix three missing checks on list iterator

commit 747212a7f86ab345566d4c99978380d04e2b7acb upstream.

The three bugs are here:
__func__, s3a_buf->s3a_data->exp_id);
__func__, md_buf->metadata->exp_id);
__func__, dis_buf->dis_data->exp_id);

The list iterator 's3a_buf/md_buf/dis_buf' 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 old variable '*_buf' as a dedicated
pointer to point to the found element.

Link: https://lore.kernel.org/linux-media/20220414041415.3342-1-xiam0nd.tong@gmail.com
Cc: stable@vger.kernel.org
Fixes: 8fa81731e15ad ("Revert "media: staging: atomisp: Remove driver"")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c