Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754628AbbBZW5H (ORCPT ); Thu, 26 Feb 2015 17:57:07 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:54594 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754058AbbBZW5F (ORCPT ); Thu, 26 Feb 2015 17:57:05 -0500 From: Luis Henriques To: Jens Axboe Cc: linux-kernel@vger.kernel.org Subject: [PATCH] block: ioprio: fix error path return code in set_task_ioprio() Date: Thu, 26 Feb 2015 22:57:53 +0000 Message-Id: <1424991473-3280-1-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1085 Lines: 39 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/