lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 26 Feb 2015 22:57:53 +0000
From:	Luis Henriques <luis.henriques@...onical.com>
To:	Jens Axboe <axboe@...nel.dk>
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] block: ioprio: fix error path return code in set_task_ioprio()

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 <luis.henriques@...onical.com>
---
 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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ