[RTEMS Project] #4537: mutex is not initilaized in jffs2_new_inode
RTEMS trac
trac at rtems.org
Thu Oct 28 14:34:47 UTC 2021
#4537: mutex is not initilaized in jffs2_new_inode
---------------------------+----------------------
Reporter: chenjin_zhong | Owner: (none)
Type: defect | Status: closed
Priority: normal | Milestone: 5.1
Component: fs/jaffs2 | Version: 5
Severity: normal | Resolution: invalid
Keywords: | Blocked By:
Blocking: |
---------------------------+----------------------
Comment (by chenjin_zhong):
Replying to [comment:1 Joel Sherrill]:
> The code in this file is related to similar code for ports of JFFS2. Can
you compare this to the current code for Linux and other ports to see what
they do? That might significantly ease the analysis for all these issues.
I have compared it with Linux JFFS2. The peice of source code in Linux is
as follows,As shown in black-body section, the f->sem is not be
initialized and locked in RTEMS.
struct jffs2_sb_info *c;
struct jffs2_raw_inode latest_node;
union jffs2_device_node jdev;
struct inode *inode;
dev_t rdev = 0;
int ret;
jffs2_dbg(1, "%s(): ino == %lu\n", __func__, ino);
inode = iget_locked(sb, ino);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
return inode;
f = JFFS2_INODE_INFO(inode);
c = JFFS2_SB_INFO(inode->i_sb);
jffs2_init_inode_info(f);
**mutex_lock(&f->sem);**
ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);
if (ret)
goto error;
inode->i_mode = jemode_to_cpu(latest_node.mode);
i_uid_write(inode, je16_to_cpu(latest_node.uid));
i_gid_write(inode, je16_to_cpu(latest_node.gid));
inode->i_size = je32_to_cpu(latest_node.isize);
inode->i_atime = ITIME(je32_to_cpu(latest_node.atime));
inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime));
inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime));
set_nlink(inode, f->inocache->pino_nlink);
inode->i_blocks = (inode->i_size + 511) >> 9;
--
Ticket URL: <http://devel.rtems.org/ticket/4537#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list