Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm ioctl: restore __GFP_HIGH in copy_params()

Commit d224e9381897 ("drivers/md/dm-ioctl.c: use kvmalloc rather than
opencoded variant") left out the __GFP_HIGH flag when converting from
__vmalloc to kvmalloc. This can cause the DM ioctl to fail in some low
memory situations where it wouldn't have failed earlier. Add __GFP_HIGH
back to avoid any potential regression.

Fixes: d224e9381897 ("drivers/md/dm-ioctl.c: use kvmalloc rather than opencoded variant")
Signed-off-by: Junaid Shahid <junaids@google.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Junaid Shahid and committed by
Mike Snitzer
8c1e2162 702a6204

+3 -2
+3 -2
drivers/md/dm-ioctl.c
··· 1710 1710 } 1711 1711 1712 1712 /* 1713 - * Try to avoid low memory issues when a device is suspended. 1713 + * Use __GFP_HIGH to avoid low memory issues when a device is 1714 + * suspended and the ioctl is needed to resume it. 1714 1715 * Use kmalloc() rather than vmalloc() when we can. 1715 1716 */ 1716 1717 dmi = NULL; 1717 1718 noio_flag = memalloc_noio_save(); 1718 - dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL); 1719 + dmi = kvmalloc(param_kernel->data_size, GFP_KERNEL | __GFP_HIGH); 1719 1720 memalloc_noio_restore(noio_flag); 1720 1721 1721 1722 if (!dmi) {