[LU-13768] potential null pointer dereference in osd_statfs in osd-ldiskfs Created: 09/Jul/20  Updated: 09/Jul/20

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.14.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

here's the code:

int osd_statfs(const struct lu_env *env, struct dt_device *d,
                struct obd_statfs *sfs, struct obd_statfs_info *info)
{
        struct osd_device *osd = osd_dt_dev(d);
        struct super_block *sb = osd_sb(osd);
        struct kstatfs *ksfs;
        __u64 reserved;
        int result = 0;

        if (unlikely(osd->od_mnt == NULL))
                return -EINPROGRESS;

the osd_sb is expanded as "osd->od_mnt->mnt_sb" so it does look like we either don't need the check for NUL below or should put the sb assignment after it.


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