Fix GFP_KERNEL allocations flags
The kmem_vasprintf(), kmem_vsprintf(), kobj_open_file(), and vn_openat() functions should all use the kmem_flags_convert() function to generate the GFP_* flags. This ensures that they can be safely called in any context and the correct flags will be used. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #426
This commit is contained in:
parent
9099312977
commit
54cccfc2e3
|
@ -80,7 +80,7 @@ kmem_vasprintf(const char *fmt, va_list ap)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
va_copy(aq, ap);
|
va_copy(aq, ap);
|
||||||
ptr = kvasprintf(GFP_KERNEL, fmt, aq);
|
ptr = kvasprintf(kmem_flags_convert(KM_SLEEP), fmt, aq);
|
||||||
va_end(aq);
|
va_end(aq);
|
||||||
} while (ptr == NULL);
|
} while (ptr == NULL);
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ kmem_asprintf(const char *fmt, ...)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ptr = kvasprintf(GFP_KERNEL, fmt, ap);
|
ptr = kvasprintf(kmem_flags_convert(KM_SLEEP), fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
} while (ptr == NULL);
|
} while (ptr == NULL);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ kobj_open_file(const char *name)
|
||||||
vnode_t *vp;
|
vnode_t *vp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
file = kmalloc(sizeof(_buf_t), GFP_KERNEL);
|
file = kmalloc(sizeof(_buf_t), kmem_flags_convert(KM_SLEEP));
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
return ((_buf_t *)-1UL);
|
return ((_buf_t *)-1UL);
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
|
||||||
ASSERT(vp == rootdir);
|
ASSERT(vp == rootdir);
|
||||||
|
|
||||||
len = strlen(path) + 2;
|
len = strlen(path) + 2;
|
||||||
realpath = kmalloc(len, GFP_KERNEL);
|
realpath = kmalloc(len, kmem_flags_convert(KM_SLEEP));
|
||||||
if (!realpath)
|
if (!realpath)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue