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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221013071035.2890124-3-yebin10@huawei.com>
Date:   Thu, 13 Oct 2022 15:10:35 +0800
From:   Ye Bin <yebin10@...wei.com>
To:     <sfrench@...ba.org>, <pc@....nz>, <lsahlber@...hat.com>,
        <sprasad@...rosoft.com>, <linux-cifs@...r.kernel.org>
CC:     <samba-technical@...ts.samba.org>, <linux-kernel@...r.kernel.org>,
        <yebin10@...wei.com>
Subject: [PATCH -next 2/2] smb3: fix potential wild-ptr-deref in 'smb3_free_compound_rqst'

As 'smb3_init_transform_rq' first set 'new_rq[i].rq_npages', then
allocate page, if allocate page failed will call 'smb3_free_compound_rqst'
to free page. However, there may only allocate part of 'rq_npages' pages
which will lead to wild-ptr-deref when free pages.
To solve above issue just increase 'new_rq[i].rq_npages' after allocate
page success.

Signed-off-by: Ye Bin <yebin10@...wei.com>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 180f0260cbc4..a1b47ce4ea15 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4467,7 +4467,6 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
 			goto err_free;
 
 		nrq->rq_pages = pages;
-		nrq->rq_npages = npages;
 		nrq->rq_offset = orq->rq_offset;
 		nrq->rq_pagesz = orq->rq_pagesz;
 		nrq->rq_tailsz = orq->rq_tailsz;
@@ -4480,6 +4479,7 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
 			pages[j] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM);
 			if (!pages[j])
 				goto err_free;
+			nrq->rq_npages++;
 		}
 
 		/* copy pages form the old */
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ