linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: namjae.jeon@samsung.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifsd: add server-side procedures for SMB3
Date: Tue, 30 Nov 2021 14:54:30 +0300	[thread overview]
Message-ID: <20211130115430.GA16669@kili> (raw)

Hello Namjae Jeon,

The patch e2f34481b24d: "cifsd: add server-side procedures for SMB3"
from Mar 16, 2021, leads to the following Smatch static checker
warning:

	fs/ksmbd/smb2pdu.c:2970 smb2_open()
	error: uninitialized symbol 'pntsd_size'.

fs/ksmbd/smb2pdu.c
    2930                 if (rc) {
    2931                         rc = smb2_create_sd_buffer(work, req, &path);
    2932                         if (rc) {
    2933                                 if (posix_acl_rc)
    2934                                         ksmbd_vfs_set_init_posix_acl(user_ns,
    2935                                                                      inode);
    2936 
    2937                                 if (test_share_config_flag(work->tcon->share_conf,
    2938                                                            KSMBD_SHARE_FLAG_ACL_XATTR)) {
    2939                                         struct smb_fattr fattr;
    2940                                         struct smb_ntsd *pntsd;
    2941                                         int pntsd_size, ace_num = 0;
    2942 
    2943                                         ksmbd_acls_fattr(&fattr, user_ns, inode);
    2944                                         if (fattr.cf_acls)
    2945                                                 ace_num = fattr.cf_acls->a_count;
    2946                                         if (fattr.cf_dacls)
    2947                                                 ace_num += fattr.cf_dacls->a_count;
    2948 
    2949                                         pntsd = kmalloc(sizeof(struct smb_ntsd) +
    2950                                                         sizeof(struct smb_sid) * 3 +
    2951                                                         sizeof(struct smb_acl) +
    2952                                                         sizeof(struct smb_ace) * ace_num * 2,
    2953                                                         GFP_KERNEL);
    2954                                         if (!pntsd)
    2955                                                 goto err_out;
    2956 
    2957                                         rc = build_sec_desc(user_ns,
    2958                                                             pntsd, NULL,
    2959                                                             OWNER_SECINFO |
    2960                                                             GROUP_SECINFO |
    2961                                                             DACL_SECINFO,
    2962                                                             &pntsd_size, &fattr);

No check for if "rc" is an error code.

    2963                                         posix_acl_release(fattr.cf_acls);
    2964                                         posix_acl_release(fattr.cf_dacls);
    2965 
    2966                                         rc = ksmbd_vfs_set_sd_xattr(conn,
    2967                                                                     user_ns,
    2968                                                                     path.dentry,
    2969                                                                     pntsd,
--> 2970                                                                     pntsd_size);
                                                                             ^^^^^^^^^^

    2971                                         kfree(pntsd);
    2972                                         if (rc)
    2973                                                 pr_err("failed to store ntacl in xattr : %d\n",
    2974                                                        rc);
    2975                                 }
    2976                         }
    2977                 }
    2978                 rc = 0;
    2979         }

regards,
dan carpenter

             reply	other threads:[~2021-11-30 11:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 11:54 Dan Carpenter [this message]
2021-11-30 23:59 ` [bug report] cifsd: add server-side procedures for SMB3 Hyunchul Lee
2021-12-01  1:57 ` Namjae Jeon
  -- strict thread matches above, loose matches on Subject: below --
2023-05-26 11:56 Dan Carpenter
2023-05-26 14:38 ` Namjae Jeon
2021-07-08 11:30 Dan Carpenter

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=20211130115430.GA16669@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=namjae.jeon@samsung.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).