1
0
Fork 0

This tag contains a single bug fix for 5.8-rc7:

- Check that an index is in valid range before using it to access an
   array. The index is received from the user. This is to prevent a
   possible out-of-bounds access error.
 -----BEGIN PGP SIGNATURE-----
 
 iQFKBAABCgA0FiEE7TEboABC71LctBLFZR1NuKta54AFAl8T4mgWHG9kZWQuZ2Fi
 YmF5QGdtYWlsLmNvbQAKCRBlHU24q1rngIbyB/9Ld3inoHbDxuB17WI1mIKd1KRU
 D0pqCgNL6uCVVaCxLTiF8zWIyKIT6f2f0iDDKfqXhxEEpRWEZ/1Y+TaUtTz/aDao
 6by1d0CnuTyEk1bEBpztwzRZUvalgvaNxazT+gVhrs9zuT6FAThfiQjj3CUJBtj+
 mtc0ntg+08CpDbKsYbZk6nFyaHsVY+riNoGxuw57F9A+VSHVuLYbdM09+n9CzrFg
 b1HgDhB5/Or+U99ceU9u+7Dv+c52FStbWOAAChfyo/i5xR2r9NFsZnKEab9L7wUW
 HWerZVuEQc1wOgCVuo7+awdYWuxyleDFrPqdTeDRTSm0wEWSaWsbBlinm58v
 =wv2W
 -----END PGP SIGNATURE-----

Merge tag 'misc-habanalabs-fixes-2020-07-19' of git://people.freedesktop.org/~gabbayo/linux into char-misc-linus

Oded writes:

This tag contains a single bug fix for 5.8-rc7:

- Check that an index is in valid range before using it to access an
  array. The index is received from the user. This is to prevent a
  possible out-of-bounds access error.

* tag 'misc-habanalabs-fixes-2020-07-19' of git://people.freedesktop.org/~gabbayo/linux:
  habanalabs: prevent possible out-of-bounds array access
zero-sugar-mainline-defconfig
Greg Kroah-Hartman 2020-07-20 10:01:58 +02:00
commit b62e185184
1 changed files with 11 additions and 3 deletions

View File

@ -499,11 +499,19 @@ static int validate_queue_index(struct hl_device *hdev,
struct asic_fixed_properties *asic = &hdev->asic_prop;
struct hw_queue_properties *hw_queue_prop;
/* This must be checked here to prevent out-of-bounds access to
* hw_queues_props array
*/
if (chunk->queue_index >= HL_MAX_QUEUES) {
dev_err(hdev->dev, "Queue index %d is invalid\n",
chunk->queue_index);
return -EINVAL;
}
hw_queue_prop = &asic->hw_queues_props[chunk->queue_index];
if ((chunk->queue_index >= HL_MAX_QUEUES) ||
(hw_queue_prop->type == QUEUE_TYPE_NA)) {
dev_err(hdev->dev, "Queue index %d is invalid\n",
if (hw_queue_prop->type == QUEUE_TYPE_NA) {
dev_err(hdev->dev, "Queue index %d is not applicable\n",
chunk->queue_index);
return -EINVAL;
}