Commit b812965
scsi: hpsa: Fix potential memory leak in hpsa_big_passthru_ioctl()
Replace kmalloc() followed by copy_from_user() with memdup_user() to fix
a memory leak that occurs when copy_from_user(buff[sg_used],,) fails and
the 'cleanup1:' path does not free the memory for 'buff[sg_used]'. Using
memdup_user() avoids this by freeing the memory internally.
Since memdup_user() already allocates memory, use kzalloc() in the else
branch instead of manually zeroing 'buff[sg_used]' using memset(0).
Cc: [email protected]
Fixes: edd1636 ("[SCSI] hpsa: add driver for HP Smart Array controllers.")
Signed-off-by: Thorsten Blum <[email protected]>
Acked-by: Don Brace <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>1 parent 88e8acf commit b812965
1 file changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6517 | 6517 | | |
6518 | 6518 | | |
6519 | 6519 | | |
6520 | | - | |
6521 | | - | |
6522 | | - | |
6523 | | - | |
6524 | | - | |
| 6520 | + | |
6525 | 6521 | | |
6526 | | - | |
6527 | | - | |
| 6522 | + | |
| 6523 | + | |
| 6524 | + | |
6528 | 6525 | | |
6529 | 6526 | | |
6530 | | - | |
6531 | | - | |
| 6527 | + | |
| 6528 | + | |
| 6529 | + | |
| 6530 | + | |
| 6531 | + | |
| 6532 | + | |
| 6533 | + | |
| 6534 | + | |
6532 | 6535 | | |
6533 | 6536 | | |
6534 | 6537 | | |
| |||
0 commit comments