@@ -2204,7 +2204,7 @@ static void ocfs2_unpack_timespec(struct timespec64 *spec,
22042204 spec -> tv_nsec = packed_time & OCFS2_NSEC_MASK ;
22052205}
22062206
2207- static void ocfs2_refresh_inode_from_lvb (struct inode * inode )
2207+ static int ocfs2_refresh_inode_from_lvb (struct inode * inode )
22082208{
22092209 struct ocfs2_inode_info * oi = OCFS2_I (inode );
22102210 struct ocfs2_lock_res * lockres = & oi -> ip_inode_lockres ;
@@ -2213,6 +2213,8 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
22132213 mlog_meta_lvb (0 , lockres );
22142214
22152215 lvb = ocfs2_dlm_lvb (& lockres -> l_lksb );
2216+ if (inode_wrong_type (inode , be16_to_cpu (lvb -> lvb_imode )))
2217+ return - ESTALE ;
22162218
22172219 /* We're safe here without the lockres lock... */
22182220 spin_lock (& oi -> ip_lock );
@@ -2240,6 +2242,7 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
22402242 ocfs2_unpack_timespec (& inode -> i_ctime ,
22412243 be64_to_cpu (lvb -> lvb_ictime_packed ));
22422244 spin_unlock (& oi -> ip_lock );
2245+ return 0 ;
22432246}
22442247
22452248static inline int ocfs2_meta_lvb_is_trustable (struct inode * inode ,
@@ -2342,7 +2345,8 @@ static int ocfs2_inode_lock_update(struct inode *inode,
23422345 if (ocfs2_meta_lvb_is_trustable (inode , lockres )) {
23432346 mlog (0 , "Trusting LVB on inode %llu\n" ,
23442347 (unsigned long long )oi -> ip_blkno );
2345- ocfs2_refresh_inode_from_lvb (inode );
2348+ status = ocfs2_refresh_inode_from_lvb (inode );
2349+ goto bail_refresh ;
23462350 } else {
23472351 /* Boo, we have to go to disk. */
23482352 /* read bh, cast, ocfs2_refresh_inode */
@@ -2352,6 +2356,10 @@ static int ocfs2_inode_lock_update(struct inode *inode,
23522356 goto bail_refresh ;
23532357 }
23542358 fe = (struct ocfs2_dinode * ) (* bh )-> b_data ;
2359+ if (inode_wrong_type (inode , le16_to_cpu (fe -> i_mode ))) {
2360+ status = - ESTALE ;
2361+ goto bail_refresh ;
2362+ }
23552363
23562364 /* This is a good chance to make sure we're not
23572365 * locking an invalid object. ocfs2_read_inode_block()
0 commit comments