mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
target: fix NULL pointer dereference bug alloc_page() fails to get memory
I am hitting this bug when the target is low in memory that fails the alloc_page() for the newly submitted command. This is a sort of off-by-one bug causing NULL pointer dereference in __free_page() since 'i' here is really the counter of total pages that have been successfully allocated here. Signed-off-by: Yi Zou <[email protected]> Cc: Andy Grover <[email protected]> Cc: Nicholas Bellinger <[email protected]> Cc: Open-FCoE.org <[email protected]> Cc: [email protected] Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
1fa8f45041
commit
d0e27c88d7
1 changed files with 2 additions and 2 deletions
|
|
@ -2294,9 +2294,9 @@ transport_generic_get_mem(struct se_cmd *cmd)
|
|||
return 0;
|
||||
|
||||
out:
|
||||
while (i >= 0) {
|
||||
__free_page(sg_page(&cmd->t_data_sg[i]));
|
||||
while (i > 0) {
|
||||
i--;
|
||||
__free_page(sg_page(&cmd->t_data_sg[i]));
|
||||
}
|
||||
kfree(cmd->t_data_sg);
|
||||
cmd->t_data_sg = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue