2.6.15.7 -stable review
Subsystems (10)
cover 2.6.15.7 -stable review
This is the start of the stable review cycle for the 2.6.15.7 release. There are 8 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a signed-off-by: line to the patch, please respond with it.
These patches are sent out with a number of different people on the Cc:
line. If you wish to be a reviewer, please email [email protected] to add your name to the list. If you want to be off the reviewer list, also email us.
Responses should be made by Tuesday March 28 02:00:00 UTC. Anything received after that time, might be too late.
thanks,
the -stable release team
PATCH 1/8 IB/srp: Don't send task management commands after target removal
From: Roland Dreier <[email protected]>
Just fail abort and reset requests that come in after we've already decided to remove a target. This fixes a nasty crash if a storage target goes away.
---
This is upstream in Linus's tree as 1285b3a0b0aa2391ac6f6939e6737203c8220f68
drivers/infiniband/ulp/srp/ib_srp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/infiniband/ulp/srp/ib_srp.c +6 -0
@@ -1154,6 +1154,12 @@ static int srp_send_tsk_mgmt(struct scsispin_lock_irq (target->scsi_host->host_lock); +if (target->state ==SRP_TARGET_DEAD || + target->state ==SRP_TARGET_REMOVED ) { + scmnd->result =DID_BAD_TARGET <<16 ; + goto out; + } +if (scmnd->host_scribble == (void *)-1L ) goto out;
PATCH 2/8 Netfilter ip_queue: Fix wrong skb->len == nlmsg_len assumption
In reply to Greg KHFrom: "David S. Miller" <[email protected]>
The size of the skb carrying the netlink message is not equivalent to the length of the actual netlink message due to padding. ip_queue matches the length of the payload against the original packet size to determine if packet mangling is desired, due to the above wrong assumption arbitary packets may not be mangled depening on their original size.
---
net/ipv4/netfilter/ip_queue.c | 2 +- net/ipv6/netfilter/ip6_queue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/netfilter/ip_queue.c +1 -1
@@ -524,7 +524,7 @@ ipq_rcv_skb(struct sk_buff *skb)write_unlock_bh (&queue_lock); status =ipq_receive_peer (NLMSG_DATA (nlh), type, - skblen -NLMSG_LENGTH (0 )); + nlmsglen -NLMSG_LENGTH (0 ));if (status <0 )RCV_SKB_FAIL (status);
net/ipv6/netfilter/ip6_queue.c +1 -1
@@ -522,7 +522,7 @@ ipq_rcv_skb(struct sk_buff *skb)write_unlock_bh (&queue_lock); status =ipq_receive_peer (NLMSG_DATA (nlh), type, - skblen -NLMSG_LENGTH (0 )); + nlmsglen -NLMSG_LENGTH (0 ));if (status <0 )RCV_SKB_FAIL (status);
PATCH 3/8 NET: compat ifconf: fix limits
In reply to Greg KHFrom: Randy Dunlap <[email protected]>
A recent change to compat. dev_ifconf() in fs/compat_ioctl.c causes ifconf data to be truncated 1 entry too early when copying it to userspace. The correct amount of data (length) is returned, but the final entry is empty (zero, not filled in).
The for-loop 'i' check should use <= to allow the final struct ifreq32 to be copied. I also used the ifconf-corruption program in kernel bugzilla #4746 to make sure that this change does not re-introduce the corruption.
---
fs/compat_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/compat_ioctl.c +1 -1
@@ -687,7 +687,7 @@ static int dev_ifconf(unsigned int fd, u ifr = ifc.ifc_req; ifr32 =compat_ptr (ifc32.ifcbuf);for (i =0 , j =0 ; - i +sizeof (struct ifreq32 ) < ifc32.ifc_len && j < ifc.ifc_len; + i +sizeof (struct ifreq32 ) <= ifc32.ifc_len && j < ifc.ifc_len; i +=sizeof (struct ifreq32 ), j +=sizeof (struct ifreq )) {if (copy_in_user (ifr32, ifr,sizeof (struct ifreq32 )))return -EFAULT ;
PATCH 4/8 cramfs mounts provide corrupted content since 2.6.15
In reply to Greg KHFrom: Dave Johnson <[email protected]>
Fix handling of cramfs images created by util-linux containing empty regular files. Images created by cramfstools 1.x were ok.
Fill out inode contents in cramfs_iget5_set() instead of get_cramfs_inode() to prevent issues if cramfs_iget5_test() is called with I_LOCK|I_NEW still set.
---
fs/cramfs/inode.c | 60 ++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 31 deletions(-)
ff3aea0e68bfd46120ce2d08bc1f8240fa2bd36a
fs/cramfs/inode.c +29 -31
@@ -36,7 +36,7 @@ static DECLARE_MUTEX(read_mutex);/* These two macros may change in future, to provide better st_ino semantics. */ -#define CRAMINO (x) ((x)->offset?(x)->offset<<2:1) +#define CRAMINO (x) (((x)->offset && (x)->size)?(x)->offset<<2:1)#define OFFSET (x) ((x)->i_ino)
@@ -66,8 +66,36 @@ static int cramfs_iget5_test(struct inodstatic int cramfs_iget5_set (struct inode *inode,void *opaque) { +static struct timespec zerotime;struct cramfs_inode *cramfs_inode = opaque; + inode->i_mode = cramfs_inode->mode; + inode->i_uid = cramfs_inode->uid; + inode->i_size = cramfs_inode->size; + inode->i_blocks = (cramfs_inode->size -1 ) /512 +1 ; + inode->i_blksize =PAGE_CACHE_SIZE ; + inode->i_gid = cramfs_inode->gid; +/* Struct copy intentional */ + inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime; inode->i_ino =CRAMINO (cramfs_inode); +/* inode->i_nlink is left 1 - arguably wrong for directories, +but it's the best we can do without reading the directory +contents. 1 yields the right result in GNU find, even +without -noleaf option. */ +if (S_ISREG (inode->i_mode)) { + inode->i_fop = &generic_ro_fops; + inode->i_data.a_ops = &cramfs_aops; + }else if (S_ISDIR (inode->i_mode)) { + inode->i_op = &cramfs_dir_inode_operations; + inode->i_fop = &cramfs_directory_operations; + }else if (S_ISLNK (inode->i_mode)) { + inode->i_op = &page_symlink_inode_operations; + inode->i_data.a_ops = &cramfs_aops; + }else { + inode->i_size =0 ; + inode->i_blocks =0 ; +init_special_inode (inode, inode->i_mode, +old_decode_dev (cramfs_inode->size)); + }return 0 ; }
@@ -77,37 +105,7 @@ static struct inode *get_cramfs_inode(ststruct inode *inode =iget5_locked (sb,CRAMINO (cramfs_inode), cramfs_iget5_test, cramfs_iget5_set, cramfs_inode); -static struct timespec zerotime; -if (inode && (inode->i_state &I_NEW )) { - inode->i_mode = cramfs_inode->mode; - inode->i_uid = cramfs_inode->uid; - inode->i_size = cramfs_inode->size; - inode->i_blocks = (cramfs_inode->size -1 ) /512 +1 ; - inode->i_blksize =PAGE_CACHE_SIZE ; - inode->i_gid = cramfs_inode->gid; -/* Struct copy intentional */ - inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime; - inode->i_ino =CRAMINO (cramfs_inode); -/* inode->i_nlink is left 1 - arguably wrong for directories, -but it's the best we can do without reading the directory -contents. 1 yields the right result in GNU find, even -without -noleaf option. */ -if (S_ISREG (inode->i_mode)) { - inode->i_fop = &generic_ro_fops; - inode->i_data.a_ops = &cramfs_aops; - }else if (S_ISDIR (inode->i_mode)) { - inode->i_op = &cramfs_dir_inode_operations; - inode->i_fop = &cramfs_directory_operations; - }else if (S_ISLNK (inode->i_mode)) { - inode->i_op = &page_symlink_inode_operations; - inode->i_data.a_ops = &cramfs_aops; - }else { - inode->i_size =0 ; - inode->i_blocks =0 ; -init_special_inode (inode, inode->i_mode, -old_decode_dev (cramfs_inode->size)); - }unlock_new_inode (inode); }return inode;
PATCH 5/8 Kconfig: VIDEO_DECODER must select FW_LOADER
In reply to Greg KHFrom: Michael Krufky <[email protected]>
The cx25840 module requires external firmware in order to function, so it must select FW_LOADER, but saa7115 and saa7129 do not require it.
---
drivers/media/video/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/video/Kconfig +1 -0
@@ -340,6 +340,7 @@ config VIDEO_AUDIO_DECODER config VIDEO_DECODER tristate "Add support for additional video chipsets" depends on VIDEO_DEV && I2C && EXPERIMENTAL + select FW_LOADER ---help--- Say Y here to compile drivers for SAA7115, SAA7127 and CX25840 video decoders.
PATCH 6/8 TCP: Do not use inet->id of global tcp_socket when sending RST (CVE-2006-1242)
In reply to Greg KHFrom: Alexey Kuznetsov <[email protected]>
The problem is in ip_push_pending_frames(), which uses:
if (!df) {
__ip_select_ident(iph, &rt->u.dst, 0);
} else {
iph->id = htons(inet->id++);
}instead of ip_select_ident().
Right now I think the code is a nonsense. Most likely, I copied it from old ip_build_xmit(), where it was really special, we had to decide whether to generate unique ID when generating the first (well, the last) fragment.
In ip_push_pending_frames() it does not make sense, it should use plain ip_select_ident() instead.
---
net/ipv4/ip_output.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/ipv4/ip_output.c +1 -5
@@ -1237,11 +1237,7 @@ int ip_push_pending_frames(struct sock * iph->tos = inet->tos; iph->tot_len =htons (skb->len); iph->frag_off = df; -if (!df) { -__ip_select_ident (iph, &rt->u.dst,0 ); - }else { - iph->id =htons (inet->id++); - } +ip_select_ident (iph, &rt->u.dst, sk); iph->ttl = ttl; iph->protocol = sk->sk_protocol; iph->saddr = rt->rt_src;
PATCH 7/8 NET: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.
In reply to Greg KHFrom: "David S. Miller" <[email protected]>
The user can pass us arbitrary garbage so we should ensure the string they give us is null terminated before we pass it on to dev_get_by_index() et al.
Found by Solar Designer.
---
net/core/sock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/core/sock.c +3 -2
@@ -403,8 +403,9 @@ set_rcvbuf:if (!valbool) { sk->sk_bound_dev_if =0 ; }else { -if (optlen >IFNAMSIZ ) - optlen =IFNAMSIZ ; +if (optlen >IFNAMSIZ -1 ) + optlen =IFNAMSIZ -1 ; +memset (devname,0 ,sizeof (devname));if (copy_from_user (devname, optval, optlen)) { ret = -EFAULT ;break ;
PATCH 8/8 Fix ext2 readdir f_pos re-validation logic
In reply to Greg KHFrom: Al Viro <[email protected]>
This fixes not one, but _two_, silly (but admittedly hard to hit) bugs in the ext2 filesystem "readdir()" function. It also cleans up the code to avoid the unnecessary goto mess.
The bugs were related to re-valiating the f_pos value after somebody had either done an "lseek()" on the directory to an invalid offset, or when the offset had become invalid due to a file being unlinked in the directory. The code would not only set the f_version too eagerly, it would also not update f_pos appropriately for when the offset fixup took place.
When that happened, we'd occasionally subsequently fail the readdir() even when we shouldn't (no real harm done, but an ugly printk, and obviously you would end up not necessarily seeing all entries).
Thanks to Masoud Sharbiani <[email protected]> who noticed the problem and had a test-case for it, and also fixed up a thinko in the first version of this patch.
---
fs/ext2/dir.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
2d7f2ea9c989853310c7f6e8be52cc090cc8e66b
fs/ext2/dir.c +12 -16
@@ -256,11 +256,10 @@ ext2_readdir (struct file * filp, void *unsigned long npages =dir_pages (inode);unsigned chunk_mask = ~(ext2_chunk_size (inode)-1 );unsigned char *types =NULL ; -int need_revalidate = (filp->f_version != inode->i_version); -int ret; +int need_revalidate = filp->f_version != inode->i_version;if (pos > inode->i_size -EXT2_DIR_REC_LEN (1 )) - goto success; +return 0 ;if (EXT2_HAS_INCOMPAT_FEATURE (sb,EXT2_FEATURE_INCOMPAT_FILETYPE )) types = ext2_filetype_table;
@@ -275,12 +274,15 @@ ext2_readdir (struct file * filp, void *"bad page in #%lu" , inode->i_ino); filp->f_pos +=PAGE_CACHE_SIZE - offset; - ret = -EIO ; - goto done; +return -EIO ; } kaddr =page_address (page); -if (need_revalidate) { - offset =ext2_validate_entry (kaddr, offset, chunk_mask); +if (unlikely (need_revalidate)) { +if (offset) { + offset =ext2_validate_entry (kaddr, offset, chunk_mask); + filp->f_pos = (n<<PAGE_CACHE_SHIFT ) + offset; + } + filp->f_version = inode->i_version; need_revalidate =0 ; } de = (ext2_dirent *)(kaddr+offset);
@@ -289,9 +291,8 @@ ext2_readdir (struct file * filp, void *if (de->rec_len ==0 ) {ext2_error (sb, __FUNCTION__,"zero-length directory entry" ); - ret = -EIO ;ext2_put_page (page); - goto done; +return -EIO ; }if (de->inode) {int over;
@@ -306,19 +307,14 @@ ext2_readdir (struct file * filp, void * le32_to_cpu(de->inode), d_type);if (over) {ext2_put_page (page); - goto success; +return 0 ; } } filp->f_pos +=le16_to_cpu (de->rec_len); }ext2_put_page (page); } - -success: - ret =0 ; -done: - filp->f_version = inode->i_version; -return ret; +return 0 ; }/*
Re: [PATCH 05/08] Kconfig: VIDEO_DECODER must select FW_LOADER
In reply to Greg KHEm Sex, 2006-03-24 às 20:11 -0800, Greg KH escreveu:
Quoted 9 lines
From: Michael Krufky <[email protected]>
The cx25840 module requires external firmware in order to function, so it must select
FW_LOADER, but saa7115 and saa7129 do not require it.Signed-off-by Michael Krufky <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Chris Wright <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Cheers,
Mauro.