linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: "Aurélien Aptel" <aaptel@suse.com>
Cc: Shyam Prasad N <nspmangalore@gmail.com>,
	CIFS <linux-cifs@vger.kernel.org>
Subject: Re: 2 error cases in sid_to_id are ignored
Date: Tue, 22 Jun 2021 14:16:56 -0500	[thread overview]
Message-ID: <CAH2r5msuTbaxKVXzM1Uq3cCyymATHhZ=jgqUMWLUS1aq3ktv8A@mail.gmail.com> (raw)
In-Reply-To: <CAH2r5muhe-2GNe0MgVvKy=X+wCxN5E2_tXT8wN8AKXCjanwqgg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

OK - removed the two places where rc is set uselessly.

Patch attached

On Tue, Jun 22, 2021 at 2:05 PM Steve French <smfrench@gmail.com> wrote:
>
> Should we make the error noisier?
>
> Perhaps we could add a dynamic trace point for failed id mappings so
> we could debug these if problems with the upcall, malformed ids/SIDs
> etc?
>
> On Tue, Jun 22, 2021 at 5:18 AM Aurélien Aptel <aaptel@suse.com> wrote:
> >
> > Steve French <smfrench@gmail.com> writes:
> > > Any thoughts on whether it would be better to return the errors, or
> > > continue the current strategy of simply using the default uid/gid for
> > > the mount and returning 0 (and removing the two places above where we
> > > set rc to non zero values, since rc will be overwritten with 0)?
> >
> > My opinion: I think best-effort would be better, so returning things as
> > default uid/gid (or possibly root).
> >
> > Cheers,
> > --
> > Aurélien Aptel / SUSE Labs Samba Team
> > GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> > GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
> >
>
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve

[-- Attachment #2: 0001-cifs-remove-two-cases-where-rc-is-set-unnecessarily-.patch --]
[-- Type: text/x-patch, Size: 1434 bytes --]

From 7c3cbf7dbc5d67ba4b3df4a502fbc2441aedd36a Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Tue, 22 Jun 2021 14:07:36 -0500
Subject: [PATCH] cifs: remove two cases where rc is set unnecessarily in
 sid_to_id

In both these cases sid_to_id unconditionally returned success, and
used the default uid/gid for the mount, so setting rc is confusing
and simply gets overwritten (set to 0) later in the function.

Addresses-Coverity: 1491672 ("Unused value")
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/cifsacl.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 3898a9e6d3c6..5ec5d9d24032 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -397,7 +397,6 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
 	saved_cred = override_creds(root_cred);
 	sidkey = request_key(&cifs_idmap_key_type, sidstr, "");
 	if (IS_ERR(sidkey)) {
-		rc = -EINVAL;
 		cifs_dbg(FYI, "%s: Can't map SID %s to a %cid\n",
 			 __func__, sidstr, sidtype == SIDOWNER ? 'u' : 'g');
 		goto out_revert_creds;
@@ -410,7 +409,6 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
 	 */
 	BUILD_BUG_ON(sizeof(uid_t) != sizeof(gid_t));
 	if (sidkey->datalen != sizeof(uid_t)) {
-		rc = -EIO;
 		cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu)\n",
 			 __func__, sidkey->datalen);
 		key_invalidate(sidkey);
-- 
2.30.2


      reply	other threads:[~2021-06-22 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 20:57 2 error cases in sid_to_id are ignored Steve French
2021-06-22 10:18 ` Aurélien Aptel
2021-06-22 19:05   ` Steve French
2021-06-22 19:16     ` Steve French [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='CAH2r5msuTbaxKVXzM1Uq3cCyymATHhZ=jgqUMWLUS1aq3ktv8A@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=aaptel@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.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;
as well as URLs for NNTP newsgroup(s).