Skip to content

Commit 6111962

Browse files
dubeykoUlrich Hecht
authored andcommitted
ceph: add checking of wait_for_completion_killable() return value
[ Upstream commit b7ed1e29cfe773d648ca09895b92856bd3a2092d ] 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 <Slava.Dubeyko@ibm.com> Reviewed-by: Alex Markuze <amarkuze@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent d4d2524 commit 6111962

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/ceph/locks.c

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

205-
wait_for_completion_killable(&req->r_safe_completion);
205+
err = wait_for_completion_killable(&req->r_safe_completion);
206+
if (err)
207+
return err;
208+
206209
return 0;
207210
}
208211

0 commit comments

Comments
 (0)