[bug report] cifsd: add server-side procedures for SMB3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux