linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjoern Doebel <doebel@amazon.de>
To: <linux-cifs@vger.kernel.org>
Cc: <linkinjeon@kernel.org>, <pc@manguebit.com>,
	<stable@vger.kernel.org>, Bjoern Doebel <doebel@amazon.de>
Subject: [PATCH v3 0/2] smb: client: fix DACL rewrite overflows
Date: Tue, 8 Sep 2026 16:09:59 +0000	[thread overview]
Message-ID: <20260908161001.2603610-1-doebel@amazon.de> (raw)
In-Reply-To: <20260904125844.1803343-1-doebel@amazon.de>

Two overflow fixes in the CIFS DACL owner/group rewrite path:

1. Patch 1 fixes a heap overflow when copying ACEs whose total size
   exceeds what kmalloc() allocated. The allocation used the old
   (pre-rewrite) ACE count, but the copy loop iterated over the new
   count.

2. Patch 2 fixes a u16 accumulator overflow in the size calculation
   that could wrap around for DACLs with 800+ ACEs, causing the
   check in patch 1 to pass despite the actual size exceeding 64KB.
   Returns -EOVERFLOW when this would occur.

Changes since v2:
- Patch 1 unchanged (already Reviewed-by Namjae Jeon)
- Patch 2: widened nsize from u16 to u32 and added explicit overflow
  guard instead of relying on check_add_overflow (which gcc optimized
  away for a u16 accumulator)
- Patch 2: fixed build_sec_desc() to propagate error from set_chmod_dacl()
  when it fails (discovered during testing)

Bjoern Doebel (2):
  smb: client: fix heap overflow in DACL owner/group rewrite
  smb: client: fail DACL rewrite when the new DACL exceeds 64K

 fs/smb/client/cifsacl.c | 51 ++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 18 deletions(-)

-- 
2.50.1


  parent reply	other threads:[~2026-09-08 16:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 15:54 [PATCH] smb: client: fix DACL-rewrite heap overflow in id_mode_to_cifs_acl() Bjoern Doebel
2026-07-09 22:15 ` Steve French
2026-07-10  6:37   ` Bjoern Doebel
2026-09-04 12:58 ` [PATCH] smb: client: fix heap overflow in DACL owner/group rewrite Bjoern Doebel
2026-09-05  1:15   ` Namjae Jeon
2026-09-07 17:59     ` Bjoern Doebel
2026-09-08 16:09   ` Bjoern Doebel [this message]
2026-09-08 16:10     ` [PATCH v3 1/2] " Bjoern Doebel
2026-09-08 16:10     ` [PATCH v3 2/2] smb: client: fail DACL rewrite when the new DACL exceeds 64K Bjoern Doebel
2026-09-09  2:55       ` Namjae Jeon
2026-09-09 17:15     ` [PATCH v3 0/2] smb: client: fix DACL rewrite overflows Paulo Alcantara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908161001.2603610-1-doebel@amazon.de \
    --to=doebel@amazon.de \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).