diff --git a/fs/jffs2/src/vfs_jffs2.c b/fs/jffs2/src/vfs_jffs2.c index 5fa6a156..234c435a 100644 --- a/fs/jffs2/src/vfs_jffs2.c +++ b/fs/jffs2/src/vfs_jffs2.c @@ -717,14 +717,17 @@ ssize_t VfsJffs2Readlink(struct Vnode *vnode, char *buffer, size_t bufLen) int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const char *path) { int ret; - struct jffs2_inode *parentInode = (struct jffs2_inode *)parentVnode->data; - struct jffs2_inode *targetInode = (struct jffs2_inode *)targetVnode->data; + struct jffs2_inode *parentInode = NULL; + struct jffs2_inode *targetInode = NULL; if (!parentVnode || !targetVnode) { PRINTK("%s-%d parentVnode=%x, targetVnode=%x\n", __FUNCTION__, __LINE__, parentVnode, targetVnode); return -EINVAL; } + parentInode = (struct jffs2_inode *)parentVnode->data; + targetInode = (struct jffs2_inode *)targetVnode->data; + LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER); ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path);