[LU-7628] bad NULL pointer check in cb_migrate_mdt_init() Created: 04/Jan/16  Updated: 25/Jan/16  Resolved: 25/Jan/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: Emoly Liu
Resolution: Fixed Votes: 0
Labels: llapi

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

At the end of cb_migrate_mdt_init(), after calling opendir() we should test *dirp rather than dirp:

out:
        if (dirp != NULL) {
                /* If the directory is being migration, we need
                 * close the directory after migration,
                 * so the old directory cache will be cleanup
                 * on the client side, and re-open to get the
                 * new directory handle */
                *dirp = opendir(path);
		if (dirp == NULL) {
                        ret = -errno;
                        llapi_error(LLAPI_MSG_ERROR, ret,
                                    "%s: Failed to open '%s'", __func__, path);
			return ret;
                }
        }

        if (parent == NULL)
                closedir(dir);

        return ret;

We also may leak dir on early return but the logic of this function is so convoluted that it's hard to tell.



 Comments   
Comment by Gerrit Updater [ 05/Jan/16 ]

Emoly Liu (emoly.liu@intel.com) uploaded a new patch: http://review.whamcloud.com/17814
Subject: LU-7628 lfs: fix NULL pointer check in cb_migrate_mdt_init()
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 6cad5b0ed6b49dfd61c6c702f9ff3b70df182347

Comment by Gerrit Updater [ 25/Jan/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/17814/
Subject: LU-7628 lfs: fix NULL pointer check in cb_migrate_mdt_init()
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 39fe7d2ef4da9bcfc2f9113c7c2ea45fcf93450e

Comment by Emoly Liu [ 25/Jan/16 ]

Landed for 2.8.0

Generated at Sat Feb 10 02:10:32 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.