[RTEMS Project] #4538: mutex is not initilaized in jffs2_read_inode

RTEMS trac trac at rtems.org
Wed Oct 27 15:13:14 UTC 2021


#4538: mutex is not initilaized in jffs2_read_inode
----------------------------+--------------------
  Reporter:  chenjin_zhong  |      Owner:  (none)
      Type:  defect         |     Status:  new
  Priority:  normal         |  Milestone:  5.1
 Component:  admin          |    Version:  5
  Severity:  normal         |   Keywords:
Blocked By:                 |   Blocking:
----------------------------+--------------------
 HI, I have found when call jffs2_read_inode to read inode. the f->sem is
 not initiliazed and locked, but it is be unlocked. The peice of source
 code is as follows:
 static int jffs2_read_inode (struct _inode *inode)
 {
         struct jffs2_inode_info *f;
         struct jffs2_sb_info *c;
         struct jffs2_raw_inode latest_node;
         int ret;

         D1(printk(KERN_DEBUG "jffs2_read_inode(): inode->i_ino == %lu\n",
 inode->i_ino));

         f = JFFS2_INODE_INFO(inode);
         c = JFFS2_SB_INFO(inode->i_sb);

         jffs2_init_inode_info(f);
         ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);

         if (ret) {
                 **mutex_unlock(&f->sem);**
                 return ret;
         }

         inode->i_mode = jemode_to_cpu(latest_node.mode);
         inode->i_uid = je16_to_cpu(latest_node.uid);
         inode->i_gid = je16_to_cpu(latest_node.gid);
         inode->i_size = je32_to_cpu(latest_node.isize);
         inode->i_atime = je32_to_cpu(latest_node.atime);
         inode->i_mtime = je32_to_cpu(latest_node.mtime);
         inode->i_ctime = je32_to_cpu(latest_node.ctime);

         inode->i_nlink = f->inocache->pino_nlink;
         **mutex_unlock(&f->sem);
 **
         D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n"));
         return 0;
 }

--
Ticket URL: <http://devel.rtems.org/ticket/4538>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list