diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-01-07 16:04:41 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-28 15:42:35 +0100 |
commit | 60bea48fd40116fd60f5950f45bb35b450d70714 (patch) | |
tree | 53a300660e140dcafab5d9c6d1c5b19d6391fecc /drivers/ide | |
parent | d8c8434dad4d524b80606d8c487808472dc010d3 (diff) | |
download | linux-stable-60bea48fd40116fd60f5950f45bb35b450d70714.tar.gz linux-stable-60bea48fd40116fd60f5950f45bb35b450d70714.tar.bz2 linux-stable-60bea48fd40116fd60f5950f45bb35b450d70714.zip |
cmd64x: potential buffer overflow in cmd64x_program_timings()
[ Upstream commit 117fcc3053606d8db5cef8821dca15022ae578bb ]
The "drive->dn" value is a u8 and it is controlled by root only, but
it could be out of bounds here so let's check.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/cmd64x.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index b127ed60c733..9dde8390da09 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c @@ -65,6 +65,9 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode) struct ide_timing t; u8 arttim = 0; + if (drive->dn >= ARRAY_SIZE(drwtim_regs)) + return; + ide_timing_compute(drive, mode, &t, T, 0); /* |