set_task_ioprio() could return success (zero) even if it actually failed
to set the new ioprio.  This patch fixes this by returning -ENOMEM if the
call to get_task_io_context() fails.

Signed-off-by: Luis Henriques <[email protected]>
---
 block/ioprio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/ioprio.c b/block/ioprio.c
index 31666c92b46a..42c680a17be4 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -49,12 +49,12 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
                return err;
 
        ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE);
-       if (ioc) {
-               ioc->ioprio = ioprio;
-               put_io_context(ioc);
-       }
+       if (!ioc)
+               return -ENOMEM;
+       ioc->ioprio = ioprio;
+       put_io_context(ioc);
 
-       return err;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(set_task_ioprio);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to