Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: Anh Nguyen Hoang via B4 Relay
	<devnull+anhnh.4work.gmail.com@kernel.org>,
	Namjae Jeon <linkinjeon@kernel.org>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	Jeff Layton <jlayton@kernel.org>,
	Steve French <smfrench@gmail.com>,
	Pavel Shilovsky <piastry@etersoft.ru>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	Anh Nguyen Hoang <anhnh.4work@gmail.com>
Subject: Re: [PATCH] smb: client: fix shift of SID authority[0] in sid_to_key_str()
Date: Wed, 02 Dec 2026 20:52:04 -0300	[thread overview]
Message-ID: <37e3ebeaabff5994cd7b431d4bbcac63@manguebit.org> (raw)
In-Reply-To: <20261202-kbug-l990-v1-1-0f894e0f1d77@gmail.com>

Anh Nguyen Hoang via B4 Relay <devnull+anhnh.4work.gmail.com@kernel.org>
writes:

> From: Anh Nguyen Hoang <anhnh.4work@gmail.com>
>
> sid_to_key_str() builds the description of the cifs.idmap key from a
> SID. The identifier authority is a 48-bit big-endian number held in six
> bytes, and the function assembles it by shifting authority[5]..[1] by 0,
> 8, 16, 24 and 32 bits. authority[0] is then shifted by 48 instead of 40,
> which leaves bits 40-47 empty and puts the top byte in bits 48-55.
>
> A SID whose first authority byte is not zero is therefore converted to
> the wrong string, and the idmap upcall is asked to map a SID other than
> the one the server sent.
>
> The value can also need 14 hex digits, while SID_STRING_BASE_SIZE
> reserves room for "-0x" plus 12. With a revision of two or three digits
> the string no longer fits and sprintf() writes one or two bytes past
> the size requested from kmalloc().
>
> Shift authority[0] by 40 so that the authority is the 48-bit value the
> comment and the buffer size expect.
> ...

Applied.

      reply	other threads:[~2026-12-02 23:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:01 [PATCH] smb: client: fix shift of SID authority[0] in sid_to_key_str() Anh Nguyen Hoang via B4 Relay
2026-12-02 23:52 ` Paulo Alcantara [this message]

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=37e3ebeaabff5994cd7b431d4bbcac63@manguebit.org \
    --to=pc@manguebit.org \
    --cc=anhnh.4work@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=devnull+anhnh.4work.gmail.com@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=piastry@etersoft.ru \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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