Commit 52a0a98
nvmet-tcp: add bounds checks in nvmet_tcp_build_pdu_iovec
nvmet_tcp_build_pdu_iovec() could walk past cmd->req.sg when a PDU
length or offset exceeds sg_cnt and then use bogus sg->length/offset
values, leading to _copy_to_iter() GPF/KASAN. Guard sg_idx, remaining
entries, and sg->length/offset before building the bvec.
Fixes: 872d26a ("nvmet-tcp: add NVMe over TCP target driver")
Signed-off-by: YunJe Shin <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Joonkyo Jung <[email protected]>
Signed-off-by: Keith Busch <[email protected]>1 parent 071be3b commit 52a0a98
1 file changed
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
| 353 | + | |
352 | 354 | | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
356 | 358 | | |
| 359 | + | |
357 | 360 | | |
358 | 361 | | |
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
362 | 365 | | |
363 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
364 | 371 | | |
| 372 | + | |
365 | 373 | | |
366 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
367 | 383 | | |
368 | 384 | | |
369 | 385 | | |
370 | 386 | | |
371 | 387 | | |
372 | 388 | | |
373 | 389 | | |
| 390 | + | |
374 | 391 | | |
375 | 392 | | |
376 | 393 | | |
| |||
0 commit comments