[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: |
|
||||
| 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 |
| Comment by Gerrit Updater [ 28/Oct/16 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/23285/ |
| Comment by Peter Jones [ 29/Oct/16 ] |
|
Landed for 2.9 |