From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: re: fix encryption error checks on mount
Date: Mon, 28 Sep 2015 13:01:57 +0300 [thread overview]
Message-ID: <20150928100157.GC11367@mwanda> (raw)
Hello Steve French,
This is a semi-automatic email about new static checker warnings.
The patch 88627148400e: "fix encryption error checks on mount" from
Sep 22, 2015, leads to the following Smatch complaint:
fs/cifs/smb2pdu.c:948 SMB2_tcon()
warn: variable dereferenced before check 'tcon' (see line 926)
fs/cifs/smb2pdu.c
922 if (tcon && tcon->bad_network_name)
^^^^
Old code assumes "tcon" can be NULL.
923 return -ENOENT;
924
925 if ((tcon->seal) &&
^^^^^^^^^^
Patch adds unchecked dereference.
926 ((ses->server->capabilities & SMB2_GLOBAL_CAP_ENCRYPTION) == 0)) {
927 cifs_dbg(VFS, "encryption requested but no server support");
928 return -EOPNOTSUPP;
929 }
930
931 unc_path = kmalloc(MAX_SHARENAME_LENGTH * 2, GFP_KERNEL);
932 if (unc_path == NULL)
933 return -ENOMEM;
934
935 unc_path_len = cifs_strtoUTF16(unc_path, tree, strlen(tree), cp) + 1;
936 unc_path_len *= 2;
937 if (unc_path_len < 2) {
938 kfree(unc_path);
939 return -EINVAL;
940 }
941
942 rc = small_smb2_init(SMB2_TREE_CONNECT, tcon, (void **) &req);
943 if (rc) {
944 kfree(unc_path);
945 return rc;
946 }
947
948 if (tcon == NULL) {
^^^^^^^^^^^^
Another check for NULL.
949 /* since no tcon, smb2_init can not do this, so do here */
950 req->hdr.SessionId = ses->Suid;
regards,
dan carpenter
next reply other threads:[~2015-09-28 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 10:01 Dan Carpenter [this message]
2015-09-28 21:07 ` fix encryption error checks on mount Steve French
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=20150928100157.GC11367@mwanda \
--to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.