ceph: Fix an Oops in error handling
Subsystems (2)
PATCH 1/1 ceph: Fix an Oops in error handling
The "req" pointer is an error pointer and not NULL so this check needs to be fixed.
--- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/addr.c +1 -1
@@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)if (err)iput (inode); out: -if (req) +if (!IS_ERR_OR_NULL (req))ceph_osdc_put_request (req);if (err)netfs_subreq_terminated (subreq, err);
Signature · 1 line
2.29.2
Ilya Dryomov
maintainerQuoted 15 lines · Dan Carpenter
The "req" pointer is an error pointer and not NULL so this check needs to be fixed.
Fixes 1cf7fdf52d5a ("ceph: convert readpage to fscache read helper")Signed-off-by Dan Carpenter <[email protected]>--- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/addr.c +0
-0
fs/ceph/addr.c static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq) · line 279
Quoted 8 lines
fs/ceph/addr.c +1
-1@@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)if (err)iput (inode); out: -if (req) +if (!IS_ERR_OR_NULL (req))ceph_osdc_put_request (req);if (err)netfs_subreq_terminated (subreq, err);
Hi Dan,
I think a better fix would be to set req to NULL in the offending IS_ERR branch since ceph_osdc_new_request() never returns NULL or use two separate goto labels.
While at it, the initialization of req and the check on req before calling ceph_osdc_put_request() are redundant.
Thanks,
Ilya
Quoted 19 lines · Dan Carpenter
The "req" pointer is an error pointer and not NULL so this check needs to be fixed.
Fixes 1cf7fdf52d5a ("ceph: convert readpage to fscache read helper")Signed-off-by Dan Carpenter <[email protected]>---
fs/ceph/addr.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/addr.c +0
-0@@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq) if (err) iput(inode);out:
fs/ceph/addr.c +1
-1-if (req) +if (!IS_ERR_OR_NULL (req))
Quoted 3 lines
ceph_osdc_put_request(req); if (err)netfs_subreq_terminated(subreq, err);
Good catch.
David, could you take this into your fscache-next branch?
Quoted 26 lines · Jeff Layton
Quoted 19 lines · Dan Carpenter
The "req" pointer is an error pointer and not NULL so this check needs to be fixed.
Fixes 1cf7fdf52d5a ("ceph: convert readpage to fscache read helper")Signed-off-by Dan Carpenter <[email protected]>---
fs/ceph/addr.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)fs/ceph/addr.c +0
-0@@ -273,7 +273,7 @@ static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq) if (err) iput(inode);out:
fs/ceph/addr.c +1
-1-if (req) +if (!IS_ERR_OR_NULL (req))Quoted 3 lines
ceph_osdc_put_request(req); if (err)netfs_subreq_terminated(subreq, err);Good catch.
Quoted 3 lines
David, could you take this into your fscache-next branch?
Reviewed-by Jeff Layton <[email protected]>
Jeff sent a different fix for this. Let's just apply his instead.
regards,
dan carpenter