Skip to content

Commit b7ed1e2

Browse files
dubeykoidryomov
authored andcommitted
ceph: add checking of wait_for_completion_killable() return value
The Coverity Scan service has detected the calling of wait_for_completion_killable() without checking the return value in ceph_lock_wait_for_completion() [1]. The CID 1636232 defect contains explanation: "If the function returns an error value, the error value may be mistaken for a normal value. In ceph_lock_wait_for_completion(): Value returned from a function is not checked for errors before being used. (CWE-252)". The patch adds the checking of wait_for_completion_killable() return value and return the error code from ceph_lock_wait_for_completion(). [1] https://scan5.scan.coverity.com/#/project-view/64304/10063?selectedIssue=1636232 Signed-off-by: Viacheslav Dubeyko <[email protected]> Reviewed-by: Alex Markuze <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent fa07303 commit b7ed1e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/ceph/locks.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ static int ceph_lock_wait_for_completion(struct ceph_mds_client *mdsc,
221221
if (err && err != -ERESTARTSYS)
222222
return err;
223223

224-
wait_for_completion_killable(&req->r_safe_completion);
224+
err = wait_for_completion_killable(&req->r_safe_completion);
225+
if (err)
226+
return err;
227+
225228
return 0;
226229
}
227230

0 commit comments

Comments
 (0)