3.10.44-stable review
Greg Kroah-Hartman
maintainercover 3.10.44-stable review
This is the start of the stable review cycle for the 3.10.44 release. There are 18 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 me know.
Responses should be made by Sat Jun 14 23:22:02 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.44-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.44-rc1
Andreas Schrägle <[email protected]>
ahci: add PCI ID for Marvell 88SE91A0 SATA Controller
Jérôme Carretero <[email protected]>
ahci: Add Device ID for HighPoint RocketRaid 642L
Tomas Winkler <[email protected]>
mei: me: drop harmful wait optimization
Ben Collins <[email protected]>
SCSI: megaraid: Use resource_size_t for PCI resources, not long
Andy Lutomirski <[email protected]>
auditsc: audit_krule mask accesses need bounds checking
Vlastimil Babka <[email protected]>
mm/compaction: make isolate_freepages start at pageblock boundary
Vlastimil Babka <[email protected]>
mm: compaction: detect when scanners meet in isolate_freepages
Vlastimil Babka <[email protected]>
mm: compaction: reset cached scanner pfn's before reading them
Nicholas Bellinger <[email protected]>
target: Fix alua_access_state attribute OOPs for un-configured devices
Nicholas Bellinger <[email protected]>
target: Allow READ_CAPACITY opcode in ALUA Standby access state
Roland Dreier <[email protected]>
iscsi-target: Fix wrong buffer / buffer overrun in iscsi_change_param_value()
Nicholas Bellinger <[email protected]>
iser-target: Fix multi network portal shutdown regression
Sagi Grimberg <[email protected]>
Target/iscsi,iser: Avoid accepting transport connections during stop stage
Florian Westphal <[email protected]>
netfilter: ipv4: defrag: set local_df flag on defragmented skb
Thomas Petazzoni <[email protected]>
ARM: mvebu: fix NOR bus-width in Armada XP OpenBlocks AX3 Device Tree
Thomas Petazzoni <[email protected]>
ARM: mvebu: fix NOR bus-width in Armada XP GP Device Tree
Chris Mason <[email protected]>
mlx4_en: don't use napi_synchronize inside mlx4_en_netpoll
Andy Lutomirski <[email protected]>
fs,userns: Change inode_capable to capable_wrt_inode_uidgid
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/armada-xp-gp.dts | 2 +- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 2 +- drivers/ata/ahci.c | 4 ++ drivers/infiniband/ulp/isert/ib_isert.c | 8 ++++ drivers/misc/mei/hw-me.c | 4 +- drivers/net/ethernet/mellanox/mlx4/en_cq.c | 1 - drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +-- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 - drivers/scsi/megaraid/megaraid_sas.h | 1 - drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_core.h | 1 + drivers/target/iscsi/iscsi_target_login.c | 51 +++++++++++---------- drivers/target/iscsi/iscsi_target_tpg.c | 9 ++-- drivers/target/target_core_alua.c | 9 ++++ drivers/target/target_core_configfs.c | 5 +++ fs/attr.c | 8 ++-- fs/inode.c | 10 +++-- fs/namei.c | 11 ++--- include/linux/capability.h | 2 +- kernel/auditsc.c | 27 +++++++---- kernel/capability.c | 18 +++----- mm/compaction.c | 57 +++++++++++++++--------- net/ipv4/netfilter/nf_defrag_ipv4.c | 5 ++- 25 files changed, 152 insertions(+), 100 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/18 fs,userns: Change inode_capable to capable_wrt_inode_uidgid
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 23adbe12ef7d3d4195e80800ab36b37bee28cd03 upstream.
The kernel has no concept of capabilities with respect to inodes; inodes exist independently of namespaces. For example, inode_capable(inode, CAP_LINUX_IMMUTABLE) would be nonsense.
This patch changes inode_capable to check for uid and gid mappings and renames it to capable_wrt_inode_uidgid, which should make it more obvious what it does.
Fixes CVE-2014-4014.
--- fs/attr.c | 8 ++++---- fs/inode.c | 10 +++++++--- fs/namei.c | 11 ++++++----- include/linux/capability.h | 2 +- kernel/capability.c | 18 +++++++----------- 5 files changed, 25 insertions(+), 24 deletions(-)
fs/attr.c +4 -4
@@ -50,14 +50,14 @@ int inode_change_ok(const struct inode *if ((ia_valid &ATTR_UID ) && (!uid_eq (current_fsuid (), inode->i_uid) || !uid_eq (attr->ia_uid, inode->i_uid)) && - !inode_capable (inode,CAP_CHOWN )) + !capable_wrt_inode_uidgid (inode,CAP_CHOWN ))return -EPERM ;/* Make sure caller can chgrp. */ if ((ia_valid &ATTR_GID ) && (!uid_eq (current_fsuid (), inode->i_uid) || (!in_group_p (attr->ia_gid) && !gid_eq (attr->ia_gid, inode->i_gid))) && - !inode_capable (inode,CAP_CHOWN )) + !capable_wrt_inode_uidgid (inode,CAP_CHOWN ))return -EPERM ;/* Make sure a caller can chmod. */
@@ -67,7 +67,7 @@ int inode_change_ok(const struct inode */* Also check the setgid bit! */ if (!in_group_p ((ia_valid &ATTR_GID ) ? attr->ia_gid : inode->i_gid) && - !inode_capable (inode,CAP_FSETID )) + !capable_wrt_inode_uidgid (inode,CAP_FSETID )) attr->ia_mode &= ~S_ISGID ; }
@@ -160,7 +160,7 @@ void setattr_copy(struct inode *inode, cumode_t mode = attr->ia_mode;if (!in_group_p (inode->i_gid) && - !inode_capable (inode,CAP_FSETID )) + !capable_wrt_inode_uidgid (inode,CAP_FSETID )) mode &= ~S_ISGID ; inode->i_mode = mode; }
fs/inode.c +7 -3
@@ -1837,14 +1837,18 @@ EXPORT_SYMBOL(inode_init_owner);* inode_owner_or_capable - check current task permissions to inode * @inode: inode being checked * -* Return true if current either has CAP_FOWNER to the inode, or -* owns the file. +* Return true if current either has CAP_FOWNER in a namespace with the +* inode owner uid mapped, or owns the file. */ bool inode_owner_or_capable (const struct inode *inode) { +struct user_namespace *ns; +if (uid_eq (current_fsuid (), inode->i_uid))return true; -if (inode_capable (inode,CAP_FOWNER )) + + ns =current_user_ns (); +if (ns_capable (ns,CAP_FOWNER ) &&kuid_has_mapping (ns, inode->i_uid))return true;return false; }
fs/namei.c +6 -5
@@ -321,10 +321,11 @@ int generic_permission(struct inode *inoif (S_ISDIR (inode->i_mode)) {/* DACs are overridable for directories */ -if (inode_capable (inode,CAP_DAC_OVERRIDE )) +if (capable_wrt_inode_uidgid (inode,CAP_DAC_OVERRIDE ))return 0 ;if (!(mask &MAY_WRITE )) -if (inode_capable (inode,CAP_DAC_READ_SEARCH )) +if (capable_wrt_inode_uidgid (inode, +CAP_DAC_READ_SEARCH ))return 0 ;return -EACCES ; }
@@ -334,7 +335,7 @@ int generic_permission(struct inode *ino* at least one exec bit set. */ if (!(mask &MAY_EXEC ) || (inode->i_mode &S_IXUGO )) -if (inode_capable (inode,CAP_DAC_OVERRIDE )) +if (capable_wrt_inode_uidgid (inode,CAP_DAC_OVERRIDE ))return 0 ;/*
@@ -342,7 +343,7 @@ int generic_permission(struct inode *ino*/ mask &=MAY_READ |MAY_WRITE |MAY_EXEC ;if (mask ==MAY_READ ) -if (inode_capable (inode,CAP_DAC_READ_SEARCH )) +if (capable_wrt_inode_uidgid (inode,CAP_DAC_READ_SEARCH ))return 0 ;return -EACCES ;
@@ -2199,7 +2200,7 @@ static inline int check_sticky(struct inreturn 0 ;if (uid_eq (dir->i_uid, fsuid))return 0 ; -return !inode_capable (inode,CAP_FOWNER ); +return !capable_wrt_inode_uidgid (inode,CAP_FOWNER ); }/*
include/linux/capability.h +1 -1
@@ -211,7 +211,7 @@ extern bool has_ns_capability_noaudit(stextern bool capable (int cap);extern bool ns_capable (struct user_namespace *ns,int cap);extern bool nsown_capable (int cap); -extern bool inode_capable (const struct inode *inode,int cap); +extern bool capable_wrt_inode_uidgid (const struct inode *inode,int cap);extern bool file_ns_capable (const struct file *file,struct user_namespace *ns,int cap);/* audit system wants to get cap info from files as well */
kernel/capability.c +7 -11
@@ -445,22 +445,18 @@ bool nsown_capable(int cap) }/** -* inode_capable - Check superior capability over inode +* capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped * @inode: The inode in question * @cap: The capability in question * -* Return true if the current task has the given superior capability -* targeted at it's own user namespace and that the given inode is owned -* by the current user namespace or a child namespace. -* -* Currently we check to see if an inode is owned by the current -* user namespace by seeing if the inode's owner maps into the -* current user namespace. -* +* Return true if the current task has the given capability targeted at +* its own user namespace and that the given inode's uid and gid are +* mapped into the current user namespace. */ -bool inode_capable (const struct inode *inode,int cap) +bool capable_wrt_inode_uidgid (const struct inode *inode,int cap) {struct user_namespace *ns =current_user_ns (); -return ns_capable (ns, cap) &&kuid_has_mapping (ns, inode->i_uid); +return ns_capable (ns, cap) &&kuid_has_mapping (ns, inode->i_uid) && +kgid_has_mapping (ns, inode->i_gid); }
Greg Kroah-Hartman
maintainerPATCH 2/18 mlx4_en: dont use napi_synchronize inside mlx4_en_netpoll
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit c98235cb8584a72e95786e17d695a8e5fafcd766 upstream.
The mlx4 driver is triggering schedules while atomic inside mlx4_en_netpoll:
spin_lock_irqsave(&cq->lock, flags); napi_synchronize(&cq->napi); ^^^^^ msleep here mlx4_en_process_rx_cq(dev, cq, 0); spin_unlock_irqrestore(&cq->lock, flags);
This was part of a patch by Alexander Guller from Mellanox in 2011, but it still isn't upstream.
--- drivers/net/ethernet/mellanox/mlx4/en_cq.c | 1 - drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +----- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_cq.c +0 -1
@@ -55,7 +55,6 @@ int mlx4_en_create_cq(struct mlx4_en_pri cq->ring = ring; cq->is_tx = mode; -spin_lock_init (&cq->lock); err =mlx4_alloc_hwq_res (mdev->dev, &cq->wqres, cq->buf_size,2 *PAGE_SIZE );
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -5
@@ -1190,15 +1190,11 @@ static void mlx4_en_netpoll(struct net_d {struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_cq *cq; -unsigned long flags;int i;for (i =0 ; i < priv->rx_ring_num; i++) { cq = &priv->rx_cq[i]; -spin_lock_irqsave (&cq->lock, flags); -napi_synchronize (&cq->napi); -mlx4_en_process_rx_cq (dev, cq,0 ); -spin_unlock_irqrestore (&cq->lock, flags); +napi_schedule (&cq->napi); } }#endif
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +0 -1
@@ -299,7 +299,6 @@ struct mlx4_en_cq {struct mlx4_cq mcq;struct mlx4_hwq_resources wqres;int ring; -spinlock_t lock;struct net_device *dev;struct napi_struct napi;int size;
Greg Kroah-Hartman
maintainerPATCH 3/18 ARM: mvebu: fix NOR bus-width in Armada XP GP Device Tree
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 1a88f809ccb5db1509a7514b187c00b3a995fc82 upstream.
The mvebu-devbus driver had a serious bug, which lead to a 8 bits bus width declared in the Device Tree being considered as a 16 bits bus width when configuring the hardware.
This bug in mvebu-devbus driver was compensated by a symetric mistake in the Armada XP GP Device Tree: a 8 bits bus width was declared, even though the hardware actually has a 16 bits bus width connection with the NOR flash.
Now that we have fixed the mvebu-devbus driver to behave according to its Device Tree binding, this commit fixes the problematic Device Tree files as well.
This bug was introduced in commit da8d1b38356853c37116f9afa29f15648d7fb159 ('ARM: mvebu: Add support for NOR flash device on Armada XP-GP board') which was merged in v3.10.
--- arch/arm/boot/dts/armada-xp-gp.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-xp-gp.dts +1 -1
@@ -124,7 +124,7 @@ /* Device Bus parameters are required */ /* Read parameters */ - devbus,bus-width = <8>; + devbus,bus-width = <16>; devbus,turn-off-ps = <60000>; devbus,badr-skew-ps = <0>; devbus,acc-first-ps = <124000>;
Greg Kroah-Hartman
maintainerPATCH 4/18 ARM: mvebu: fix NOR bus-width in Armada XP OpenBlocks AX3 Device Tree
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Petazzoni <[email protected]>
commit 6e20bae8a39c40d4e03698e4160bad2d2629062b upstream.
The mvebu-devbus driver had a serious bug, which lead to a 8 bits bus width declared in the Device Tree being considered as a 16 bits bus width when configuring the hardware.
This bug in mvebu-devbus driver was compensated by a symetric mistake in the Armada XP OpenBlocks AX3 Device Tree: a 8 bits bus width was declared, even though the hardware actually has a 16 bits bus width connection with the NOR flash.
Now that we have fixed the mvebu-devbus driver to behave according to its Device Tree binding, this commit fixes the problematic Device Tree files as well.
This bug was introduced in commit a7d4f81821f7eec3175f8e23dd6949c71ab2da43 ('ARM: mvebu: Add support for NOR flash device on Openblocks AX3 board') which was merged in v3.10.
--- arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +1 -1
@@ -152,7 +152,7 @@ /* Device Bus parameters are required */ /* Read parameters */ - devbus,bus-width = <8>; + devbus,bus-width = <16>; devbus,turn-off-ps = <60000>; devbus,badr-skew-ps = <0>; devbus,acc-first-ps = <124000>;
Greg Kroah-Hartman
maintainerPATCH 5/18 netfilter: ipv4: defrag: set local_df flag on defragmented skb
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 895162b1101b3ea5db08ca6822ae9672717efec0 upstream.
else we may fail to forward skb even if original fragments do fit outgoing link mtu:
1. remote sends 2k packets in two 1000 byte frags, DF set
2. we want to forward but only see '2k > mtu and DF set'
3. we then send icmp error saying that outgoing link is 1500
But original sender never sent a packet that would not fit the outgoing link.
Setting local_df makes outgoing path test size vs. IPCB(skb)->frag_max_size, so we will still send the correct error in case the largest original size did not fit outgoing link mtu.
--- net/ipv4/netfilter/nf_defrag_ipv4.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv4/netfilter/nf_defrag_ipv4.c +3 -2
@@ -22,7 +22,6 @@#endif #include <net/netfilter/nf_conntrack_zones.h> -/* Returns new sk_buff, or NULL */ static int nf_ct_ipv4_gather_frags (struct sk_buff *skb,u_int32_t user) {int err;
@@ -33,8 +32,10 @@ static int nf_ct_ipv4_gather_frags(struc err =ip_defrag (skb, user);local_bh_enable (); -if (!err) +if (!err) {ip_send_check (ip_hdr (skb)); + skb->local_df =1 ; + }return err; }
Greg Kroah-Hartman
maintainerPATCH 6/18 Target/iscsi,iser: Avoid accepting transport connections during stop stage
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 14f4b54fe38f3a8f8392a50b951c8aa43b63687a upstream.
When the target is in stop stage, iSER transport initiates RDMA disconnects. The iSER initiator may wish to establish a new connection over the still existing network portal. In this case iSER transport should not accept and resume new RDMA connections. In order to learn that, iscsi_np is added with enabled flag so the iSER transport can check when deciding weather to accept and resume a new connection request.
The iscsi_np is enabled after successful transport setup, and disabled before iscsi_np login threads are cleaned up.
(Fix up context changes for v3.10.y - nab)
--- drivers/infiniband/ulp/isert/ib_isert.c | 8 ++++++++ drivers/target/iscsi/iscsi_target_core.h | 1 + drivers/target/iscsi/iscsi_target_login.c | 1 + drivers/target/iscsi/iscsi_target_tpg.c | 1 + 4 files changed, 11 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +8 -0
@@ -382,6 +382,14 @@ isert_connect_request(struct rdma_cm_idstruct ib_device *ib_dev = cma_id->device;int ret =0 ; +spin_lock_bh (&np->np_thread_lock); +if (!np->enabled) { +spin_unlock_bh (&np->np_thread_lock); +pr_debug ("iscsi_np is not enabled, reject connect request\n" ); +return rdma_reject (cma_id,NULL ,0 ); + } +spin_unlock_bh (&np->np_thread_lock); +pr_debug ("Entering isert_connect_request cma_id: %p, context: %p\n" , cma_id, cma_id->context);
drivers/target/iscsi/iscsi_target_core.h +1 -0
@@ -760,6 +760,7 @@ struct iscsi_np {int np_ip_proto;int np_sock_type;enum np_thread_state_table np_thread_state; +bool enabled;enum iscsi_timer_flags_table np_login_timer_flags;u32 np_exports;enum np_flags_table np_flags;
drivers/target/iscsi/iscsi_target_login.c +1 -0
@@ -984,6 +984,7 @@ int iscsi_target_setup_login_socket( } np->np_transport = t; + np->enabled = true;return 0 ; }
drivers/target/iscsi/iscsi_target_tpg.c +1 -0
@@ -182,6 +182,7 @@ static void iscsit_clear_tpg_np_login_threturn ; } + tpg_np->tpg_np->enabled = false;iscsit_reset_np_thread (tpg_np->tpg_np, tpg_np, tpg); }
Greg Kroah-Hartman
maintainerPATCH 7/18 iser-target: Fix multi network portal shutdown regression
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 2363d196686e44c0158929e7cf96c8589a24a81b upstream.
This patch fixes a iser-target specific regression introduced in v3.15-rc6 with:
commit 14f4b54fe38f3a8f8392a50b951c8aa43b63687a
Author: Sagi Grimberg <[email protected]> Date: Tue Apr 29 13:13:47 2014 +0300
Target/iscsi,iser: Avoid accepting transport connections during stop stage
where the change to set iscsi_np->enabled = false within iscsit_clear_tpg_np_login_thread() meant that a iscsi_np with two iscsi_tpg_np exports would have it's parent iscsi_np set to a disabled state, even if other iscsi_tpg_np exports still existed.
This patch changes iscsit_clear_tpg_np_login_thread() to only set iscsi_np->enabled = false when shutdown = true, and also changes iscsit_del_np() to set iscsi_np->enabled = true when iscsi_np->np_exports is non zero.
(Fix up context changes for v3.10.y - nab)
--- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_tpg.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/target/iscsi/iscsi_target.c +1 -0
@@ -460,6 +460,7 @@ int iscsit_del_np(struct iscsi_np *np)spin_lock_bh (&np->np_thread_lock); np->np_exports--;if (np->np_exports) { + np->enabled = true;spin_unlock_bh (&np->np_thread_lock);return 0 ; }
drivers/target/iscsi/iscsi_target_tpg.c +6 -4
@@ -175,14 +175,16 @@ void iscsit_put_tpg(struct iscsi_portal_static void iscsit_clear_tpg_np_login_thread (struct iscsi_tpg_np *tpg_np, -struct iscsi_portal_group *tpg) +struct iscsi_portal_group *tpg, +bool shutdown) {if (!tpg_np->tpg_np) {pr_err ("struct iscsi_tpg_np->tpg_np is NULL!\n" );return ; } - tpg_np->tpg_np->enabled = false; +if (shutdown) + tpg_np->tpg_np->enabled = false;iscsit_reset_np_thread (tpg_np->tpg_np, tpg_np, tpg); }
@@ -198,7 +200,7 @@ void iscsit_clear_tpg_np_login_threads(continue ; }spin_unlock (&tpg->tpg_np_lock); -iscsit_clear_tpg_np_login_thread (tpg_np, tpg); +iscsit_clear_tpg_np_login_thread (tpg_np, tpg, false);spin_lock (&tpg->tpg_np_lock); }spin_unlock (&tpg->tpg_np_lock);
@@ -521,7 +523,7 @@ static int iscsit_tpg_release_np(struct iscsi_portal_group *tpg, struct iscsi_np *np) { -iscsit_clear_tpg_np_login_thread (tpg_np ,tpg ); +iscsit_clear_tpg_np_login_thread (tpg_np ,tpg ,true ); pr_debug("CORE[%s] - Removed Network Portal: %s:%hu,%hu on %s\n", tpg->tpg_tiqn->tiqn, np->np_ip, np->np_port, tpg->tpgt,
Greg Kroah-Hartman
maintainerPATCH 8/18 iscsi-target: Fix wrong buffer / buffer overrun in iscsi_change_param_value()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit 79d59d08082dd0a0a18f8ceb78c99f9f321d72aa upstream.
In non-leading connection login, iscsi_login_non_zero_tsih_s1() calls iscsi_change_param_value() with the buffer it uses to hold the login PDU, not a temporary buffer. This leads to the login header getting corrupted and login failing for non-leading connections in MC/S.
Fix this by adding a wrapper iscsi_change_param_sprintf() that handles the temporary buffer itself to avoid confusion. Also handle sending a reject in case of failure in the wrapper, which lets the calling code get quite a bit smaller and easier to read.
Finally, bump the size of the temporary buffer from 32 to 64 bytes to be safe, since "MaxRecvDataSegmentLength=" by itself is 25 bytes; with a trailing NUL, a value >= 1M will lead to a buffer overrun. (This isn't the default but we don't need to run right at the ragged edge here)
(Fix up context changes for v3.10.y - nab)
--- drivers/target/iscsi/iscsi_target_login.c | 50 ++++++++++++++++-------------- 1 file changed, 27 insertions(+), 23 deletions(-)
drivers/target/iscsi/iscsi_target_login.c +27 -23
@@ -250,6 +250,28 @@ static void iscsi_login_set_conn_values(mutex_unlock (&auth_id_lock); } +static __printf(2, 3) int iscsi_change_param_sprintf( +struct iscsi_conn *conn, +const char *fmt, ...) +{ +va_list args; +unsigned char buf[64 ]; + +memset (buf,0 ,sizeof buf); + +va_start (args, fmt); +vsnprintf (buf,sizeof buf, fmt, args); +va_end (args); + +if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) { +iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , +ISCSI_LOGIN_STATUS_NO_RESOURCES ); +return -1 ; + } + +return 0 ; +} +/* * This is the leading connection of a new session, * or session reinstatement.
@@ -339,7 +361,6 @@ static int iscsi_login_zero_tsih_s2( {struct iscsi_node_attrib *na;struct iscsi_session *sess = conn->sess; -unsigned char buf[32 ];bool iser = false; sess->tpg = conn->tpg;
@@ -380,26 +401,16 @@ static int iscsi_login_zero_tsih_s2(* * In our case, we have already located the struct iscsi_tiqn at this point. */ -memset (buf,0 ,32 ); -sprintf (buf,"TargetPortalGroupTag=%hu" ,ISCSI_TPG_S (sess)->tpgt); -if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) { -iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , -ISCSI_LOGIN_STATUS_NO_RESOURCES ); +if (iscsi_change_param_sprintf (conn,"TargetPortalGroupTag=%hu" , sess->tpg->tpgt))return -1 ; - }/* * Workaround for Initiators that have broken connection recovery logic. * * "We would really like to get rid of this." Linux-iSCSI.org team */ -memset (buf,0 ,32 ); -sprintf (buf,"ErrorRecoveryLevel=%d" , na->default_erl); -if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) { -iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , -ISCSI_LOGIN_STATUS_NO_RESOURCES ); +if (iscsi_change_param_sprintf (conn,"ErrorRecoveryLevel=%d" , na->default_erl))return -1 ; - }if (iscsi_login_disable_FIM_keys (conn->param_list, conn) <0 )return -1 ;
@@ -411,12 +422,9 @@ static int iscsi_login_zero_tsih_s2(unsigned long mrdsl, off;int rc; -sprintf (buf,"RDMAExtensions=Yes" ); -if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) { -iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , -ISCSI_LOGIN_STATUS_NO_RESOURCES ); +if (iscsi_change_param_sprintf (conn,"RDMAExtensions=Yes" ))return -1 ; - } +/* * Make MaxRecvDataSegmentLength PAGE_SIZE aligned for * Immediate Data + Unsolicitied Data-OUT if necessary..
@@ -446,12 +454,8 @@ static int iscsi_login_zero_tsih_s2(pr_warn ("Aligning ISER MaxRecvDataSegmentLength: %lu down" " to PAGE_SIZE\n" , mrdsl); -sprintf (buf,"MaxRecvDataSegmentLength=%lu\n" , mrdsl); -if (iscsi_change_param_value (buf, conn->param_list,0 ) <0 ) { -iscsit_tx_login_rsp (conn,ISCSI_STATUS_CLS_TARGET_ERR , -ISCSI_LOGIN_STATUS_NO_RESOURCES ); +if (iscsi_change_param_sprintf (conn,"MaxRecvDataSegmentLength=%lu\n" , mrdsl))return -1 ; - } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 9/18 target: Allow READ_CAPACITY opcode in ALUA Standby access state
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit e7810c2d2c37fa8e58dda74b00790dab60fe6fba upstream.
This patch allows READ_CAPACITY + SAI_READ_CAPACITY_16 opcode processing to occur while the associated ALUA group is in Standby access state.
This is required to avoid host side LUN probe failures during the initial scan if an ALUA group has already implicitly changed into Standby access state.
This addresses a bug reported by Chris + Philip using dm-multipath
+ ESX hosts configured with ALUA multipath.
(Drop v3.15 specific set_ascq usage - nab)
--- drivers/target/target_core_alua.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/target/target_core_alua.c +9 -0
@@ -409,7 +409,16 @@ static inline int core_alua_state_standbcase REPORT_LUNS :case RECEIVE_DIAGNOSTIC :case SEND_DIAGNOSTIC : +case READ_CAPACITY :return 0 ; +case SERVICE_ACTION_IN : +switch (cdb[1 ] &0x1f ) { +case SAI_READ_CAPACITY_16 : +return 0 ; +default : + *alua_ascq =ASCQ_04H_ALUA_TG_PT_STANDBY ; +return 1 ; + }case MAINTENANCE_IN :switch (cdb[1 ] &0x1f ) {case MI_REPORT_TARGET_PGS :
Greg Kroah-Hartman
maintainerPATCH 10/18 target: Fix alua_access_state attribute OOPs for un-configured devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit f1453773514bb8b0bba0716301e8c8f17f8d39c7 upstream.
This patch fixes a OOPs where an attempt to write to the per-device alua_access_state configfs attribute at:
/sys/kernel/config/target/core/$HBA/$DEV/alua/$TG_PT_GP/alua_access_state
results in an NULL pointer dereference when the backend device has not yet been configured.
This patch adds an explicit check for DF_CONFIGURED, and fails with -ENODEV to avoid this case.
--- drivers/target/target_core_configfs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/target/target_core_configfs.c +5 -0
@@ -2034,6 +2034,11 @@ static ssize_t target_core_alua_tg_pt_gp " tg_pt_gp ID: %hu\n", tg_pt_gp->tg_pt_gp_valid_id);return -EINVAL ; } +if (!(dev->dev_flags &DF_CONFIGURED )) { +pr_err ("Unable to set alua_access_state while device is" +" not configured\n" ); +return -ENODEV ; + } ret =strict_strtoul (page,0 , &tmp);if (ret <0 ) {
Greg Kroah-Hartman
maintainerPATCH 11/18 mm: compaction: reset cached scanner pfns before reading them
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit d3132e4b83e6bd383c74d716f7281d7c3136089c upstream.
Compaction caches pfn's for its migrate and free scanners to avoid scanning the whole zone each time. In compact_zone(), the cached values are read to set up initial values for the scanners. There are several situations when these cached pfn's are reset to the first and last pfn of the zone, respectively. One of these situations is when a compaction has been deferred for a zone and is now being restarted during a direct compaction, which is also done in compact_zone().
However, compact_zone() currently reads the cached pfn's *before* resetting them. This means the reset doesn't affect the compaction that performs it, and with good chance also subsequent compactions, as update_pageblock_skip() is likely to be called and update the cached pfn's to those being processed. Another chance for a successful reset is when a direct compaction detects that migration and free scanners meet (which has its own problems addressed by another patch) and sets update_pageblock_skip flag which kswapd uses to do the reset because it goes to sleep.
This is clearly a bug that results in non-deterministic behavior, so this patch moves the cached pfn reset to be performed *before* the values are read.
--- mm/compaction.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
mm/compaction.c +8 -8
@@ -947,6 +947,14 @@ static int compact_zone(struct zone *zon }/* +* Clear pageblock skip if there were failures recently and compaction +* is about to be retried after being deferred. kswapd does not do +* this reset as it'll reset the cached information when going to sleep. +*/ +if (compaction_restarting (zone, cc->order) && !current_is_kswapd ()) +__reset_isolation_suitable (zone); + +/* * Setup to move all movable pages to the end of the zone. Used cached * information on where the scanners should start but check that it * is initialised by ensuring the values are within zone boundaries.
@@ -962,14 +970,6 @@ static int compact_zone(struct zone *zon zone->compact_cached_migrate_pfn = cc->migrate_pfn; } -/* -* Clear pageblock skip if there were failures recently and compaction -* is about to be retried after being deferred. kswapd does not do -* this reset as it'll reset the cached information when going to sleep. -*/ -if (compaction_restarting (zone, cc->order) && !current_is_kswapd ()) -__reset_isolation_suitable (zone); -migrate_prep_local ();while ((ret =compact_finished (zone, cc)) ==COMPACT_CONTINUE ) {
Greg Kroah-Hartman
maintainerPATCH 12/18 mm: compaction: detect when scanners meet in isolate_freepages
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 7ed695e069c3cbea5e1fd08f84a04536da91f584 upstream.
Compaction of a zone is finished when the migrate scanner (which begins at the zone's lowest pfn) meets the free page scanner (which begins at the zone's highest pfn). This is detected in compact_zone() and in the case of direct compaction, the compact_blockskip_flush flag is set so that kswapd later resets the cached scanner pfn's, and a new compaction may again start at the zone's borders.
The meeting of the scanners can happen during either scanner's activity. However, it may currently fail to be detected when it occurs in the free page scanner, due to two problems. First, isolate_freepages() keeps free_pfn at the highest block where it isolated pages from, for the purposes of not missing the pages that are returned back to allocator when migration fails. Second, failing to isolate enough free pages due to scanners meeting results in -ENOMEM being returned by migrate_pages(), which makes compact_zone() bail out immediately without calling compact_finished() that would detect scanners meeting.
This failure to detect scanners meeting might result in repeated attempts at compaction of a zone that keep starting from the cached pfn's close to the meeting point, and quickly failing through the -ENOMEM path, without the cached pfns being reset, over and over. This has been observed (through additional tracepoints) in the third phase of the mmtests stress-highalloc benchmark, where the allocator runs on an otherwise idle system. The problem was observed in the DMA32 zone, which was used as a fallback to the preferred Normal zone, but on the 4GB system it was actually the largest zone. The problem is even amplified for such fallback zone - the deferred compaction logic, which could (after being fixed by a previous patch) reset the cached scanner pfn's, is only applied to the preferred zone and not for the fallbacks.
The problem in the third phase of the benchmark was further amplified by commit 81c0a2bb515f ("mm: page_alloc: fair zone allocator policy") which resulted in a non-deterministic regression of the allocation success rate from ~85% to ~65%. This occurs in about half of benchmark runs, making bisection problematic. It is unlikely that the commit itself is buggy, but it should put more pressure on the DMA32 zone during phases 1 and 2, which may leave it more fragmented in phase 3 and expose the bugs that this patch fixes.
The fix is to make scanners meeting in isolate_freepage() stay that way, and to check in compact_zone() for scanners meeting when migrate_pages() returns -ENOMEM. The result is that compact_finished() also detects scanners meeting and sets the compact_blockskip_flush flag to make kswapd reset the scanner pfn's.
The results in stress-highalloc benchmark show that the "regression" by commit 81c0a2bb515f in phase 3 no longer occurs, and phase 1 and 2 allocation success rates are also significantly improved.
--- mm/compaction.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
mm/compaction.c +15 -4
@@ -667,7 +667,7 @@ static void isolate_freepages(struct zon* is the end of the pageblock the migration scanner is using. */ pfn = cc->free_pfn; - low_pfn = cc->migrate_pfn + pageblock_nr_pages; + low_pfn =ALIGN (cc->migrate_pfn +1 , pageblock_nr_pages);/* * Take care that if the migration scanner is at the end of the zone
@@ -683,7 +683,7 @@ static void isolate_freepages(struct zon* pages on cc->migratepages. We stop searching if the migrate * and free page scanners meet or enough free pages are isolated. */ -for (; pfn > low_pfn && cc->nr_migratepages > nr_freepages; +for (; pfn >= low_pfn && cc->nr_migratepages > nr_freepages; pfn -= pageblock_nr_pages) {unsigned long isolated;
@@ -738,7 +738,14 @@ static void isolate_freepages(struct zon/* split_free_page does not map the pages */ map_pages (freelist); - cc->free_pfn = high_pfn; +/* +* If we crossed the migrate scanner, we want to keep it that way +* so that compact_finished() may detect this +*/ +if (pfn < low_pfn) + cc->free_pfn =max (pfn, zone->zone_start_pfn); +else + cc->free_pfn = high_pfn; cc->nr_freepages = nr_freepages; }
@@ -1003,7 +1010,11 @@ static int compact_zone(struct zone *zonif (err) {putback_movable_pages (&cc->migratepages); cc->nr_migratepages =0 ; -if (err == -ENOMEM ) { +/* +* migrate_pages() may return -ENOMEM when scanners meet +* and we want compact_finished() to detect it +*/ +if (err == -ENOMEM && cc->free_pfn > cc->migrate_pfn) { ret =COMPACT_PARTIAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 13/18 mm/compaction: make isolate_freepages start at pageblock boundary
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 49e068f0b73dd042c186ffa9b420a9943e90389a upstream.
The compaction freepage scanner implementation in isolate_freepages() starts by taking the current cc->free_pfn value as the first pfn. In a for loop, it scans from this first pfn to the end of the pageblock, and then subtracts pageblock_nr_pages from the first pfn to obtain the first pfn for the next for loop iteration.
This means that when cc->free_pfn starts at offset X rather than being aligned on pageblock boundary, the scanner will start at offset X in all scanned pageblock, ignoring potentially many free pages. Currently this can happen when
a) zone's end pfn is not pageblock aligned, or
b) through zone->compact_cached_free_pfn with CONFIG_HOLES_IN_ZONE enabled and a hole spanning the beginning of a pageblock
This patch fixes the problem by aligning the initial pfn in isolate_freepages() to pageblock boundary. This also permits replacing the end-of-pageblock alignment within the for loop with a simple pageblock_nr_pages increment.
--- mm/compaction.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
mm/compaction.c +12 -10
@@ -657,16 +657,20 @@ static void isolate_freepages(struct zon struct compact_control *cc) {struct page *page; -unsigned long high_pfn, low_pfn, pfn, z_end_pfn, end_pfn; +unsigned long high_pfn, low_pfn, pfn, z_end_pfn;int nr_freepages = cc->nr_freepages;struct list_head *freelist = &cc->freepages;/* * Initialise the free scanner. The starting point is where we last -* scanned from (or the end of the zone if starting). The low point -* is the end of the pageblock the migration scanner is using. +* successfully isolated from, zone-cached value, or the end of the +* zone when isolating for the first time. We need this aligned to +* the pageblock boundary, because we do pfn -= pageblock_nr_pages +* in the for loop. +* The low boundary is the end of the pageblock the migration scanner +* is using. */ - pfn = cc->free_pfn; + pfn = cc->free_pfn & ~(pageblock_nr_pages-1 ); low_pfn =ALIGN (cc->migrate_pfn +1 , pageblock_nr_pages);/*
@@ -686,6 +690,7 @@ static void isolate_freepages(struct zonfor (; pfn >= low_pfn && cc->nr_migratepages > nr_freepages; pfn -= pageblock_nr_pages) {unsigned long isolated; +unsigned long end_pfn;if (!pfn_valid (pfn))continue ;
@@ -713,13 +718,10 @@ static void isolate_freepages(struct zon isolated =0 ;/* -* As pfn may not start aligned, pfn+pageblock_nr_page -* may cross a MAX_ORDER_NR_PAGES boundary and miss -* a pfn_valid check. Ensure isolate_freepages_block() -* only scans within a pageblock +* Take care when isolating in last pageblock of a zone which +* ends in the middle of a pageblock. */ - end_pfn =ALIGN (pfn +1 , pageblock_nr_pages); - end_pfn =min (end_pfn, z_end_pfn); + end_pfn =min (pfn + pageblock_nr_pages, z_end_pfn); isolated =isolate_freepages_block (cc, pfn, end_pfn, freelist, false); nr_freepages += isolated;
Greg Kroah-Hartman
maintainerPATCH 14/18 auditsc: audit_krule mask accesses need bounds checking
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit a3c54931199565930d6d84f4c3456f6440aefd41 upstream.
Fixes an easy DoS and possible information disclosure.
This does nothing about the broken state of x32 auditing.
eparis: If the admin has enabled auditd and has specifically loaded audit rules. This bug has been around since before git. Wow...
--- kernel/auditsc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
kernel/auditsc.c +18 -9
@@ -733,6 +733,22 @@ static enum audit_state audit_filter_tasreturn AUDIT_BUILD_CONTEXT ; } +static int audit_in_mask (const struct audit_krule *rule,unsigned long val) +{ +int word, bit; + +if (val >0xffffffff ) +return false; + + word =AUDIT_WORD (val); +if (word >=AUDIT_BITMASK_SIZE ) +return false; + + bit =AUDIT_BIT (val); + +return rule->mask[word] & bit; +} +/* At syscall entry and exit time, this filter is called if the * audit_state is not low enough that auditing cannot take place, but is * also not high enough that we already know we have to write an audit
@@ -750,11 +766,8 @@ static enum audit_state audit_filter_sysrcu_read_lock ();if (!list_empty (list)) { -int word =AUDIT_WORD (ctx->major); -int bit =AUDIT_BIT (ctx->major); -list_for_each_entry_rcu (e, list, list) { -if ((e->rule.mask[word] & bit) == bit && +if (audit_in_mask (&e->rule, ctx->major) &&audit_filter_rules (tsk, &e->rule, ctx,NULL , &state, false)) {rcu_read_unlock ();
@@ -774,20 +787,16 @@ static enum audit_state audit_filter_sysstatic int audit_filter_inode_name (struct task_struct *tsk,struct audit_names *n,struct audit_context *ctx) { -int word, bit;int h =audit_hash_ino ((u32 )n->ino);struct list_head *list = &audit_inode_hash[h];struct audit_entry *e;enum audit_state state; - word =AUDIT_WORD (ctx->major); - bit =AUDIT_BIT (ctx->major); -if (list_empty (list))return 0 ;list_for_each_entry_rcu (e, list, list) { -if ((e->rule.mask[word] & bit) == bit && +if (audit_in_mask (&e->rule, ctx->major) &&audit_filter_rules (tsk, &e->rule, ctx, n, &state, false)) { ctx->current_state = state;return 1 ;
Greg Kroah-Hartman
maintainerPATCH 15/18 SCSI: megaraid: Use resource_size_t for PCI resources, not long
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Collins <[email protected]>
commit 11f8a7b31f2140b0dc164bb484281235ffbe51d3 upstream.
The assumption that sizeof(long) >= sizeof(resource_size_t) can lead to truncation of the PCI resource address, meaning this driver didn't work on 32-bit systems with 64-bit PCI adressing ranges.
--- drivers/scsi/megaraid/megaraid_sas.h | 1 - drivers/scsi/megaraid/megaraid_sas_base.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +0 -1
@@ -1295,7 +1295,6 @@ struct megasas_instance {u32 *reply_queue;dma_addr_t reply_queue_h; -unsigned long base_addr;struct megasas_register_set __iomem *reg_set;struct megasas_pd_list pd_list[MEGASAS_MAX_PD ];
drivers/scsi/megaraid/megaraid_sas_base.c +3 -2
@@ -3461,6 +3461,7 @@ static int megasas_init_fw(struct megasau32 max_sectors_1;u32 max_sectors_2;u32 tmp_sectors, msix_enable; +resource_size_t base_addr;struct megasas_register_set __iomem *reg_set;struct megasas_ctrl_info *ctrl_info;unsigned long bar_list;
@@ -3469,14 +3470,14 @@ static int megasas_init_fw(struct megasa/* Find first memory bar */ bar_list =pci_select_bars (instance->pdev,IORESOURCE_MEM ); instance->bar =find_first_bit (&bar_list,sizeof (unsigned long )); - instance->base_addr =pci_resource_start (instance->pdev, instance->bar);if (pci_request_selected_regions (instance->pdev, instance->bar,"megasas: LSI" )) {printk (KERN_DEBUG "megasas: IO memory region busy!\n" );return -EBUSY ; } - instance->reg_set =ioremap_nocache (instance->base_addr,8192 ); + base_addr =pci_resource_start (instance->pdev, instance->bar); + instance->reg_set =ioremap_nocache (base_addr,8192 );if (!instance->reg_set) {printk (KERN_DEBUG "megasas: Failed to map IO mem\n" );
Greg Kroah-Hartman
maintainerPATCH 16/18 mei: me: drop harmful wait optimization
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit 07cd7be3d92eeeae1f92a017f2cfe4fdd9256526 upstream.
It my take time till ME_RDY will be cleared after the reset, so we cannot check the bit before we got the interrupt
--- drivers/misc/mei/hw-me.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/mei/hw-me.c +1 -3
@@ -183,6 +183,7 @@ static void mei_me_hw_reset(struct mei_delse hcsr &= ~H_IE ; + dev->recvd_hw_ready = false;mei_me_reg_write (hw,H_CSR , hcsr);if (dev->dev_state ==MEI_DEV_POWER_DOWN )
@@ -233,10 +234,7 @@ static bool mei_me_hw_is_ready(struct mestatic int mei_me_hw_ready_wait (struct mei_device *dev) {int err; -if (mei_me_hw_is_ready (dev)) -return 0 ; - dev->recvd_hw_ready = false;mutex_unlock (&dev->device_lock); err = wait_event_interruptible_timeout(dev->wait_hw_ready, dev->recvd_hw_ready,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.44 release. There are 18 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 me know.
Responses should be made by Sat Jun 14 23:22:02 UTC 2014. Anything received after that time might be too late.
Build results:
total: 143 pass: 136 skipped: 6 fail: 1
Failed builds:
unicore32:defconfig
Qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter