[LU-4068] bad error return from ofd_precreate_objects() Created: 05/Oct/13  Updated: 09/Oct/13  Resolved: 09/Oct/13

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

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Duplicate Votes: 0
Labels: coccinelle, ofd

Severity: 3
Rank (Obsolete): 10902

 Description   

An error path in ofd_precreate_objects() applies PTR_ERR() to a NULL pointer.

        struct ofd_object       *fo = NULL;
        ...
        /* prepare objects */
        ostid_set_seq(&info->fti_ostid, ostid_seq(&oseq->os_oi));
        for (i = 0; i < nr; i++) {
                ostid_set_id(&info->fti_ostid, id + i);
                rc = ostid_to_fid(&info->fti_fid, &info->fti_ostid, 0);
                if (rc) {
                        if (i == 0)
                                GOTO(out, rc = PTR_ERR(fo));

                        nr = i;
                        break;
                }

                fo = ofd_object_find(env, ofd, &info->fti_fid);
                if (IS_ERR(fo)) {
                        if (i == 0)
                                GOTO(out, rc = PTR_ERR(fo));

                        nr = i;
                        break;
                }

The first GOTO statement should be GOTO(out, rc). This was found using a script from the coccinelle examples directory.



 Comments   
Comment by John Hammond [ 05/Oct/13 ]

Here is a similar one in osd_index_ea_insert()

...
        struct inode            *child_inode = NULL;
...
        } else {
                /* Insert local entry */
                child = osd_object_find(env, dt, fid);
                if (IS_ERR(child)) {
                        CERROR("%s: Can not find object "DFID"%u:%u: rc = %d\n",
                               osd_name(osd), PFID(fid),
                               id->oii_ino, id->oii_gen,
                               (int)PTR_ERR(child_inode));
                        RETURN(PTR_ERR(child_inode));
                }
                child_inode = igrab(child->oo_inode);
        }
Comment by John Hammond [ 09/Oct/13 ]

Handling in the patch for LU-4067.

Generated at Sat Feb 10 01:39:22 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.