diff options
| author | Dan Carpenter <dan.carpenter@linaro.org> | 2025-08-01 20:03:35 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-15 12:03:42 +0200 |
| commit | 6df3687922570f753574c40b35e83b26b32292d0 (patch) | |
| tree | 5340f99b301f91cb6f8c3a443ce25f9e32f72f33 /drivers/misc | |
| parent | 77732c58fef6247b71493dc3997af0ec0aaad5c7 (diff) | |
| download | linux-6df3687922570f753574c40b35e83b26b32292d0.tar.gz linux-6df3687922570f753574c40b35e83b26b32292d0.tar.bz2 linux-6df3687922570f753574c40b35e83b26b32292d0.zip | |
misc: pci_endpoint_test: Fix array underflow in pci_endpoint_test_ioctl()
[ Upstream commit 1ad82f9db13d85667366044acdfb02009d576c5a ]
Commit eefb83790a0d ("misc: pci_endpoint_test: Add doorbell test case")
added NO_BAR (-1) to the pci_barno enum which, in practical terms,
changes the enum from an unsigned int to a signed int. If the user
passes a negative number in pci_endpoint_test_ioctl() then it results in
an array underflow in pci_endpoint_test_bar().
Fixes: eefb83790a0d ("misc: pci_endpoint_test: Add doorbell test case")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/aIzzZ4vc6ZrmM9rI@suswa
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/pci_endpoint_test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 1c156a3f845e..f935175d8bf5 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -937,7 +937,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case PCITEST_BAR: bar = arg; - if (bar > BAR_5) + if (bar <= NO_BAR || bar > BAR_5) goto ret; if (is_am654_pci_dev(pdev) && bar == BAR_0) goto ret; |
