[LU-8723] llapi_obd_statfs() tests errno in non error cases, may leak file descriptors Created: 18/Oct/16  Updated: 16/Nov/16  Resolved: 29/Oct/16

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

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: easy

Issue Links:
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In llapi_obd_statfs() we have:

        fd = open(path, O_RDONLY);
        if (errno == EISDIR)
                fd = open(path, O_DIRECTORY | O_RDONLY);

Second, if open() succeeds then the value of errno is arbitrary and the file descriptor may be leaked if errno was previously set to EISDIR.

Also note that open() will never set errno to EISDIR when write access is not requested.



 Comments   
Comment by Gerrit Updater [ 20/Oct/16 ]

John L. Hammond (john.hammond@intel.com) uploaded a new patch: http://review.whamcloud.com/23285
Subject: LU-8723 llapi: correct open() handling in llapi_obd_statfs()
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: bde378b948a515b53f22feb5f32fecd628b2bbd0

Comment by Gerrit Updater [ 28/Oct/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/23285/
Subject: LU-8723 llapi: correct open() handling in llapi_obd_statfs()
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: c791db551d022cd804e9dcc751cd7e33102a741a

Comment by Peter Jones [ 29/Oct/16 ]

Landed for 2.9

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