[PATCH 1/3] fs: squashfs: set s_op in time

Sascha Hauer s.hauer at pengutronix.de
Mon Aug 10 07:12:10 EDT 2020


When calling squashfs_mount() s_op needs to be set already, otherwise
calling alloc_inode() yields in a NULL pointer derefence.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/squashfs/squashfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index 69451f7b84..be03618b2f 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -101,6 +101,7 @@ static int squashfs_probe(struct device_d *dev)
 	if (ret)
 		goto err_out;
 
+	sb->s_op = &squashfs_super_ops;
 
 	ret = squashfs_mount(fsdev, 0);
 	if (ret) {
@@ -110,8 +111,6 @@ static int squashfs_probe(struct device_d *dev)
 
 	squashfs_set_rootarg(fsdev);
 
-	sb->s_op = &squashfs_super_ops;
-
 	return 0;
 
 err_out:
-- 
2.28.0




More information about the barebox mailing list