fs/ntfs3: Check if more than chunk-size bytes are written
Subsystems (9)
Sasha Levin
maintainerPATCH 1/10 fs/ntfs3: Check if more than chunk-size bytes are written
From: Andrew Ballance <[email protected]>
[ Upstream commit 9931122d04c6d431b2c11b5bb7b10f28584067f0 ]
A incorrectly formatted chunk may decompress into more than LZNT_CHUNK_SIZE bytes and a index out of bounds will occur in s_max_off.
--- fs/ntfs3/lznt.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ntfs3/lznt.c +3 -0
@@ -236,6 +236,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,/* Do decompression until pointers are inside range. */ while (up < unc_end && cmpr < cmpr_end) { +// return err if more than LZNT_CHUNK_SIZE bytes are written +if (up - unc >LZNT_CHUNK_SIZE ) +return -EINVAL ;/* Correct index */ while (unc + s_max_off[index] < up) index +=1 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/10 fs/ntfs3: Fix warning possible deadlock in ntfs_set_state
From: Konstantin Komarov <[email protected]>
[ Upstream commit 5b2db723455a89dc96743d34d8bdaa23a402db2f ]
Use non-zero subkey to skip analyzer warnings.
--- fs/ntfs3/ntfs_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/ntfs_fs.h +1 -1
@@ -328,7 +328,7 @@ struct mft_inode {/* Nested class for ntfs_inode::ni_lock. */ enum ntfs_inode_mutex_lock_class { -NTFS_INODE_MUTEX_DIRTY , +NTFS_INODE_MUTEX_DIRTY =1 ,NTFS_INODE_MUTEX_SECURITY ,NTFS_INODE_MUTEX_OBJID ,NTFS_INODE_MUTEX_REPARSE ,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/10 fs/ntfs3: Stale inode instead of bad
In reply to Sasha LevinFrom: Konstantin Komarov <[email protected]>
[ Upstream commit 1fd21919de6de245b63066b8ee3cfba92e36f0e9 ]
Fixed the logic of processing inode with wrong sequence number.
--- fs/ntfs3/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ntfs3/inode.c +7 -3
@@ -524,11 +524,15 @@ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,if (inode->i_state &I_NEW ) inode =ntfs_read_mft (inode, name, ref);else if (ref->seq !=ntfs_i (inode)->mi.mrec->seq) { -/* Inode overlaps? */ -_ntfs_bad_inode (inode); +/* +* Sequence number is not expected. +* Looks like inode was reused but caller uses the old reference +*/ +iput (inode); + inode =ERR_PTR (-ESTALE ); } -if (IS_ERR (inode) && name) +if (IS_ERR (inode))ntfs_set_state (sb->s_fs_info,NTFS_DIRTY_ERROR );return inode;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/10 fs/ntfs3: Fix possible deadlock in mi_read
In reply to Sasha LevinFrom: Konstantin Komarov <[email protected]>
[ Upstream commit 03b097099eef255fbf85ea6a786ae3c91b11f041 ]
Mutex lock with another subclass used in ni_lock_dir().
--- fs/ntfs3/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/namei.c +1 -1
@@ -79,7 +79,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,if (err <0 ) inode =ERR_PTR (err);else { -ni_lock (ni); +ni_lock_dir (ni); inode =dir_search_u (dir, uni,NULL );ni_unlock (ni); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/10 fs/ntfs3: Additional check in ni_clear()
In reply to Sasha LevinFrom: Konstantin Komarov <[email protected]>
[ Upstream commit d178944db36b3369b78a08ba520de109b89bf2a9 ]
Checking of NTFS_FLAGS_LOG_REPLAYING added to prevent access to uninitialized bitmap during replay process.
--- fs/ntfs3/frecord.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ntfs3/frecord.c +3 -1
@@ -102,7 +102,9 @@ void ni_clear(struct ntfs_inode *ni) {struct rb_node *node; -if (!ni->vfs_inode.i_nlink && ni->mi.mrec &&is_rec_inuse (ni->mi.mrec)) +if (!ni->vfs_inode.i_nlink && ni->mi.mrec && +is_rec_inuse (ni->mi.mrec) && + !(ni->mi.sbi->flags &NTFS_FLAGS_LOG_REPLAYING ))ni_delete_all (ni);al_destroy (ni);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/10 scsi: scsi_transport_fc: Allow setting rport state to current state
In reply to Sasha LevinFrom: Benjamin Marzinski <[email protected]>
[ Upstream commit d539a871ae47a1f27a609a62e06093fa69d7ce99 ]
The only input fc_rport_set_marginal_state() currently accepts is "Marginal" when port_state is "Online", and "Online" when the port_state is "Marginal". It should also allow setting port_state to its current state, either "Marginal or "Online".
--- drivers/scsi/scsi_transport_fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_transport_fc.c +2 -2
@@ -1252,7 +1252,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,*/ if (rport->port_state ==FC_PORTSTATE_ONLINE ) rport->port_state = port_state; -else +else if (port_state != rport->port_state)return -EINVAL ; }else if (port_state ==FC_PORTSTATE_ONLINE ) {/*
@@ -1262,7 +1262,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,*/ if (rport->port_state ==FC_PORTSTATE_MARGINAL ) rport->port_state = port_state; -else +else if (port_state != rport->port_state)return -EINVAL ; }else return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/10 cifs: Fix creating native symlinks pointing to current or parent directory
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 63271b7d569fbe924bccc7dadc17d3d07a4e5f7a ]
Calling 'ln -s . symlink' or 'ln -s .. symlink' creates symlink pointing to some object name which ends with U+F029 unicode codepoint. This is because trailing dot in the object name is replaced by non-ASCII unicode codepoint.
So Linux SMB client currently is not able to create native symlink pointing to current or parent directory on Windows SMB server which can be read by either on local Windows server or by any other SMB client which does not implement compatible-reverse character replacement.
Fix this problem in cifsConvertToUTF16() function which is doing that character replacement. Function comment already says that it does not need to handle special cases '.' and '..', but after introduction of native symlinks in reparse point form, this handling is needed.
Note that this change depends on the previous change "cifs: Improve creating native symlinks pointing to directory".
--- fs/smb/client/cifs_unicode.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
fs/smb/client/cifs_unicode.c +14 -3
@@ -485,10 +485,21 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,/** * Remap spaces and periods found at the end of every * component of the path. The special cases of '.' and -* '..' do not need to be dealt with explicitly because -* they are addressed in namei.c:link_path_walk(). +* '..' are need to be handled because of symlinks. +* They are treated as non-end-of-string to avoid +* remapping and breaking symlinks pointing to . or .. **/ -if ((i == srclen -1 ) || (source[i+1 ] =='\\' )) +if ((i ==0 || source[i-1 ] =='\\' ) && + source[i] =='.' && + (i == srclen-1 || source[i+1 ] =='\\' )) + end_of_string = false;/* "." case */ +else if (i >=1 && + (i ==1 || source[i-2 ] =='\\' ) && + source[i-1 ] =='.' && + source[i] =='.' && + (i == srclen-1 || source[i+1 ] =='\\' )) + end_of_string = false;/* ".." case */ +else if ((i == srclen -1 ) || (source[i+1 ] =='\\' )) end_of_string = true;else end_of_string = false;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/10 net: amd: mvme147: Fix probe banner message
In reply to Sasha LevinFrom: Daniel Palmer <[email protected]>
[ Upstream commit 82c5b53140faf89c31ea2b3a0985a2f291694169 ]
Currently this driver prints this line with what looks like a rogue format specifier when the device is probed:
[ 2.840000] eth%d: MVME147 at 0xfffe1800, irq 12, Hardware Address xx:xx:xx:xx:xx:xx
Change the printk() for netdev_info() and move it after the registration has completed so it prints out the name of the interface properly.
--- drivers/net/ethernet/amd/mvme147.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/amd/mvme147.c +3 -4
@@ -105,10 +105,6 @@ static struct net_device * __init mvme147lance_probe(void) macaddr[3 ] = address&0xff ;eth_hw_addr_set (dev, macaddr); -printk ("%s: MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n" , - dev->name, dev->base_addr,MVME147_LANCE_IRQ , - dev->dev_addr); - lp =netdev_priv (dev); lp->ram =__get_dma_pages (GFP_ATOMIC ,3 );/* 32K */ if (!lp->ram) {
@@ -138,6 +134,9 @@ static struct net_device * __init mvme147lance_probe(void)return ERR_PTR (err); } +netdev_info (dev,"MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n" , + dev->base_addr,MVME147_LANCE_IRQ , dev->dev_addr); +return dev; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/10 NFS: remove revoked delegation from server's delegation list
In reply to Sasha LevinFrom: Dai Ngo <[email protected]>
[ Upstream commit 7ef60108069b7e3cc66432304e1dd197d5c0a9b5 ]
After the delegation is returned to the NFS server remove it from the server's delegations list to reduce the time it takes to scan this list.
Network trace captured while running the below script shows the time taken to service the CB_RECALL increases gradually due to the overhead of traversing the delegation list in nfs_delegation_find_inode_server.
The NFS server in this test is a Solaris server which issues CB_RECALL when receiving the all-zero stateid in the SETATTR.
mount=/mnt/data
for i in $(seq 1 20)
do
echo $i
mkdir $mount/testtarfile$i
time tar -C $mount/testtarfile$i -xf 5000_files.tar
done
--- fs/nfs/delegation.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfs/delegation.c +5 -0
@@ -981,6 +981,11 @@ void nfs_delegation_mark_returned(struct inode *inode, }nfs_mark_delegation_revoked (delegation); +clear_bit (NFS_DELEGATION_RETURNING , &delegation->flags); +spin_unlock (&delegation->lock); +if (nfs_detach_delegation (NFS_I (inode), delegation,NFS_SERVER (inode))) +nfs_put_delegation (delegation); + goto out_rcu_unlock; out_clear_returning:clear_bit (NFS_DELEGATION_RETURNING , &delegation->flags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/10 misc: sgi-gru: Don't disable preemption in GRU driver
In reply to Sasha LevinFrom: Dimitri Sivanich <[email protected]>
[ Upstream commit b983b271662bd6104d429b0fd97af3333ba760bf ]
Disabling preemption in the GRU driver is unnecessary, and clashes with sleeping locks in several code paths. Remove preempt_disable and preempt_enable from the GRU driver.
--- drivers/misc/sgi-gru/grukservices.c | 2 -- drivers/misc/sgi-gru/grumain.c | 4 ---- drivers/misc/sgi-gru/grutlbpurge.c | 2 -- 3 files changed, 8 deletions(-)
drivers/misc/sgi-gru/grukservices.c +0 -2
@@ -258,7 +258,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)int lcpu;BUG_ON (dsr_bytes >GRU_NUM_KERNEL_DSR_BYTES ); -preempt_disable (); bs =gru_lock_kernel_context (-1 ); lcpu =uv_blade_processor_id (); *cb = bs->kernel_cb + lcpu *GRU_HANDLE_STRIDE ;
@@ -272,7 +271,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)static void gru_free_cpu_resources (void *cb,void *dsr) {gru_unlock_kernel_context (uv_numa_blade_id ()); -preempt_enable (); }/*
drivers/misc/sgi-gru/grumain.c +0 -4
@@ -941,10 +941,8 @@ vm_fault_t gru_fault(struct vm_fault *vmf) again:mutex_lock (>s->ts_ctxlock); -preempt_disable ();if (gru_check_context_placement (gts)) { -preempt_enable ();mutex_unlock (>s->ts_ctxlock);gru_unload_context (gts,1 );return VM_FAULT_NOPAGE ;
@@ -953,7 +951,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf)if (!gts->ts_gru) {STAT (load_user_context);if (!gru_assign_gru_context (gts)) { -preempt_enable ();mutex_unlock (>s->ts_ctxlock);set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (GRU_ASSIGN_DELAY );/* true hack ZZZ */
@@ -969,7 +966,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf) vma->vm_page_prot); } -preempt_enable ();mutex_unlock (>s->ts_ctxlock);return VM_FAULT_NOPAGE ;
drivers/misc/sgi-gru/grutlbpurge.c +0 -2
@@ -65,7 +65,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_statestruct gru_tlb_global_handle *tgh;int n; -preempt_disable ();if (uv_numa_blade_id () == gru->gs_blade_id) n =get_on_blade_tgh (gru);else
@@ -79,7 +78,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_statestatic void get_unlock_tgh_handle (struct gru_tlb_global_handle *tgh) {unlock_tgh_handle (tgh); -preempt_enable (); }/*
Signature · 1 line
2.43.0