Commit 551b6bc
committed
cmds: avoid possible infinite loop
nvme_fw_download_seq() updates data, size, and offset by xfer even
though the actual submitted chunk length is min(xfer, size). If xfer >
size, size -= xfer underflows (since size is __u32), potentially causing
an infinite loop and out-of-bounds reads. Track the chunk size in a
variable and advance/decrement by that value instead.
Signed-off-by: Daniel Wagner <[email protected]>1 parent 82967b9 commit 551b6bc
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
0 commit comments