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>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 28 Aug 2022 08:00:37 +0900
From:   Shigeru Yoshida <syoshida@...hat.com>
To:     akpm@...ux-foundation.org
Cc:     apopple@...dia.com, jhubbard@...dia.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Shigeru Yoshida <yshigeru@...il.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH] mm/gup.c: Fix uninitialized return value on __gup_longterm_locked()

From: Shigeru Yoshida <yshigeru@...il.com>

In __gup_longterm_locked(), it returns uninitialized value if
__get_user_pages_locked() fails on the first iteration of the loop
since rc is not initialized.

This patch fixes this issue by properly returning error code if
__get_user_pages_locked() fails.

Fixes: 11147539df44 (mm/gup.c: Fix return value for __gup_longterm_locked())
Cc: Alistair Popple <apopple@...dia.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Shigeru Yoshida <yshigeru@...il.com>
---
 mm/gup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index ad59c796d4d3..66d8619e02ad 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2110,8 +2110,10 @@ static long __gup_longterm_locked(struct mm_struct *mm,
 		nr_pinned_pages = __get_user_pages_locked(mm, start, nr_pages,
 							  pages, vmas, NULL,
 							  gup_flags);
-		if (nr_pinned_pages <= 0)
+		if (nr_pinned_pages <= 0) {
+			rc = nr_pinned_pages;
 			break;
+		}
 		rc = check_and_migrate_movable_pages(nr_pinned_pages, pages);
 	} while (rc == -EAGAIN);
 	memalloc_pin_restore(flags);
-- 
2.37.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ