2.6.28.10-stable review
Subsystems (47)
PATCH 35/88 sched: do not count frozen tasks toward load
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nathan Lynch <[email protected]>
upstream commit: e3c8ca8336707062f3f7cb1cd7e6b3c753baccdd
Freezing tasks via the cgroup freezer causes the load average to climb because the freezer's current implementation puts frozen tasks in uninterruptible sleep (D state).
Some applications which perform job-scheduling functions consult the load average when making decisions. If a cgroup is frozen, the load average does not provide a useful measure of the system's utilization to such applications. This is especially inconvenient if the job scheduler employs the cgroup freezer as a mechanism for preempting low priority jobs. Contrast this with using SIGSTOP for the same purpose:
the stopped tasks do not count toward system load.
Change task_contributes_to_load() to return false if the task is frozen. This results in /proc/loadavg behavior that better meets users' expectations.
LKML-Reference: <[email protected]>
--- include/linux/sched.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/sched.h +2 -1
@@ -201,7 +201,8 @@ extern unsigned long long time_sync_thre#define task_is_stopped_or_traced (task) \ ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)#define task_contributes_to_load (task) \ - ((task->state & TASK_UNINTERRUPTIBLE) != 0) + ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ + (task->flags & PF_FROZEN) == 0)#define __set_task_state (tsk, state_value) \ do { (tsk)->state = (state_value); } while (0)
PATCH 35/88 sched: do not count frozen tasks toward load
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nathan Lynch <[email protected]>
upstream commit: e3c8ca8336707062f3f7cb1cd7e6b3c753baccdd
Freezing tasks via the cgroup freezer causes the load average to climb because the freezer's current implementation puts frozen tasks in uninterruptible sleep (D state).
Some applications which perform job-scheduling functions consult the load average when making decisions. If a cgroup is frozen, the load average does not provide a useful measure of the system's utilization to such applications. This is especially inconvenient if the job scheduler employs the cgroup freezer as a mechanism for preempting low priority jobs. Contrast this with using SIGSTOP for the same purpose:
the stopped tasks do not count toward system load.
Change task_contributes_to_load() to return false if the task is frozen. This results in /proc/loadavg behavior that better meets users' expectations.
LKML-Reference: <[email protected]>
--- include/linux/sched.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/sched.h +2 -1
@@ -201,7 +201,8 @@ extern unsigned long long time_sync_thre#define task_is_stopped_or_traced (task) \ ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)#define task_contributes_to_load (task) \ - ((task->state & TASK_UNINTERRUPTIBLE) != 0) + ((task->state & TASK_UNINTERRUPTIBLE) != 0 && \ + (task->flags & PF_FROZEN) == 0)#define __set_task_state (tsk, state_value) \ do { (tsk)->state = (state_value); } while (0)
PATCH 76/88 ath9k: implement IO serialization
In reply to Greg KHAn embedded and charset-unspecified text was scrubbed...
Name: ath9k-implement-io-serialization.patch
Url: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20090430/436f1ee6/attachment.txt
PATCH 77/88 ath9k: AR9280 PCI devices must serialize IO as well
In reply to Greg KHAn embedded and charset-unspecified text was scrubbed...
Name: ath9k-ar9280-pci-devices-must-serialize-io-as-well.patch
Url: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20090430/41218968/attachment.txt
cover 2.6.28.10-stable review
This is the start of the stable review cycle for the 2.6.28.10 release.
NOTE! This is going to be the last release in the 2.6.28-stable series!
There are 88 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 Saturday, May 2, 17:00:00 UTC. 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/v2.6/stable-review/patch-2.6.28.10-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/powerpc/include/asm/futex.h | 12 +- arch/powerpc/include/asm/processor.h | 19 ++ arch/powerpc/kernel/signal.c | 4 +- arch/powerpc/kernel/signal.h | 2 +- arch/powerpc/kernel/signal_32.c | 4 +- arch/powerpc/kernel/signal_64.c | 2 +- arch/x86/boot/memory.c | 7 +- arch/x86/include/asm/kvm_host.h | 10 +- arch/x86/kernel/cpu/mtrr/generic.c | 51 ++-- arch/x86/kvm/i8254.c | 2 +- arch/x86/kvm/irq.c | 7 - arch/x86/kvm/irq.h | 1 - arch/x86/kvm/lapic.c | 66 +---- arch/x86/kvm/lapic.h | 2 - arch/x86/kvm/mmu.c | 24 ++- arch/x86/kvm/paging_tmpl.h | 8 +- arch/x86/kvm/svm.c | 17 ++- arch/x86/kvm/vmx.c | 7 +- arch/x86/kvm/vmx.h | 5 +- arch/x86/kvm/x86.c | 14 +- arch/x86/kvm/x86_emulate.c | 2 +- arch/x86/pci/i386.c | 3 + block/genhd.c | 12 +- drivers/acpi/dock.c | 3 +- drivers/ata/pata_hpt37x.c | 22 +-- drivers/char/agp/generic.c | 4 +- drivers/char/raw.c | 1 + drivers/crypto/ixp4xx_crypto.c | 182 +++++-------- drivers/ide/hpt366.c | 4 +- drivers/input/gameport/gameport.c | 14 +- drivers/isdn/gigaset/bas-gigaset.c | 16 +- drivers/md/md.c | 27 ++- drivers/misc/thinkpad_acpi.c | 41 ++-- drivers/net/b44.c | 2 +- drivers/net/bonding/bond_main.c | 25 ++- drivers/net/bonding/bonding.h | 6 + drivers/net/r8169.c | 5 +- drivers/net/wireless/ath9k/ath9k.h | 4 +- drivers/net/wireless/ath9k/core.c | 1 + drivers/net/wireless/ath9k/core.h | 33 +++ drivers/net/wireless/ath9k/hw.c | 22 ++- drivers/net/wireless/b43/xmit.c | 2 +- drivers/scsi/libiscsi.c | 9 +- drivers/scsi/sg.c | 466 +++++++++++++++----------------- drivers/spi/spi.c | 22 +- drivers/usb/class/cdc-wdm.c | 2 +- drivers/usb/core/message.c | 3 +- drivers/usb/core/quirks.c | 4 + drivers/usb/core/sysfs.c | 4 +- drivers/usb/gadget/f_rndis.c | 2 +- drivers/usb/gadget/u_ether.c | 8 +- drivers/usb/host/ehci-q.c | 32 +++ drivers/usb/host/ehci.h | 3 + drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio.h | 7 + drivers/usb/storage/cypress_atacb.c | 15 +- drivers/usb/storage/scsiglue.c | 6 + drivers/usb/storage/unusual_devs.h | 6 +- fs/anon_inodes.c | 7 +- fs/buffer.c | 2 +- fs/cifs/CHANGES | 3 + fs/cifs/cifssmb.c | 6 +- fs/cifs/connect.c | 2 +- fs/compat.c | 12 +- fs/dquot.c | 2 +- fs/drop_caches.c | 2 +- fs/exec.c | 4 +- fs/fs-writeback.c | 3 +- fs/hugetlbfs/inode.c | 3 +- fs/ocfs2/file.c | 8 +- fs/proc/base.c | 50 ++--- fs/splice.c | 25 ++- include/linux/capability.h | 23 ++- include/linux/genhd.h | 1 + include/linux/kvm.h | 2 + include/linux/pagemap.h | 12 +- include/linux/pci_regs.h | 2 +- include/linux/raid/md_k.h | 2 + include/linux/sched.h | 3 +- include/linux/usb/quirks.h | 3 + kernel/exit.c | 3 +- kernel/kprobes.c | 4 +- kernel/posix-cpu-timers.c | 7 +- kernel/sched.c | 65 ++++- kernel/signal.c | 8 + mm/filemap_xip.c | 4 +- mm/mmap.c | 2 +- net/bridge/br_if.c | 1 - net/ipv4/netfilter/arp_tables.c | 4 +- net/ipv4/netfilter/ip_tables.c | 4 +- net/ipv6/inet6_hashtables.c | 4 +- net/ipv6/ip6_input.c | 4 +- net/ipv6/netfilter/ip6_tables.c | 4 +- net/netfilter/nf_conntrack_proto_tcp.c | 3 +- net/netrom/af_netrom.c | 8 +- net/rose/af_rose.c | 4 + net/sctp/endpointola.c | 3 +- net/x25/af_x25.c | 6 + net/xfrm/xfrm_state.c | 2 +- security/selinux/hooks.c | 1 + security/smack/smack_lsm.c | 4 +- sound/pci/hda/patch_analog.c | 2 +- virt/kvm/kvm_main.c | 41 +++- virt/kvm/kvm_trace.c | 1 + 105 files changed, 952 insertions(+), 701 deletions(-)
PATCH 1/88 bonding: Fix updating of speed/duplex changes
2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit 17d04500e2528217de5fe967599f98ee84348a9c ]
This patch corrects an omission from the following commit:
commit f0c76d61779b153dbfb955db3f144c62d02173c2
Author: Jay Vosburgh <[email protected]> Date: Wed Jul 2 18:21:58 2008 -0700
bonding: refactor mii monitor
The un-refactored code checked the link speed and duplex of
every slave on every pass; the refactored code did not do so.
The 802.3ad and balance-alb/tlb modes utilize the speed and
duplex information, and require it to be kept up to date. This patch adds a notifier check to perform the appropriate updating when the slave device speed changes.
--- drivers/net/bonding/bond_main.c | 25 ++++++++++++++++++++----- drivers/net/bonding/bonding.h | 6 ++++++ 2 files changed, 26 insertions(+), 5 deletions(-)
drivers/net/bonding/bonding.h +6 -0
@@ -248,6 +248,12 @@ static inline struct bonding *bond_get_breturn (struct bonding *)slave->dev->master->priv; } +static inline bool bond_is_lb (const struct bonding *bond) +{ +return bond->params.mode ==BOND_MODE_TLB + || bond->params.mode ==BOND_MODE_ALB ; +} +#define BOND_FOM_NONE 0#define BOND_FOM_ACTIVE 1#define BOND_FOM_FOLLOW 2
drivers/net/bonding/bond_main.c +20 -5
@@ -3536,11 +3536,26 @@ static int bond_slave_netdev_event(unsig }break ;case NETDEV_CHANGE : -/* -* TODO: is this what we get if somebody -* sets up a hierarchical bond, then rmmod's -* one of the slave bonding devices? -*/ +if (bond->params.mode ==BOND_MODE_8023AD ||bond_is_lb (bond)) { +struct slave *slave; + + slave =bond_get_slave_by_dev (bond, slave_dev); +if (slave) { +u16 old_speed = slave->speed; +u16 old_duplex = slave->duplex; + +bond_update_speed_duplex (slave); + +if (bond_is_lb (bond)) +break ; + +if (old_speed != slave->speed) +bond_3ad_adapter_speed_changed (slave); +if (old_duplex != slave->duplex) +bond_3ad_adapter_duplex_changed (slave); + } + } +break ;case NETDEV_DOWN :/*
PATCH 2/88 net: fix sctp breakage
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit cb0dc77de0d23615a845e45844a2e22fc224d7fe ]
broken by commit 5e739d1752aca4e8f3e794d431503bfca3162df4; AFAICS should be -stable fodder as well...
--- net/sctp/endpointola.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sctp/endpointola.c +2 -1
@@ -111,7 +111,8 @@ static struct sctp_endpoint *sctp_endpoiif (sctp_addip_enable) { auth_chunks->chunks[0 ] =SCTP_CID_ASCONF ; auth_chunks->chunks[1 ] =SCTP_CID_ASCONF_ACK ; - auth_chunks->param_hdr.length +=htons (2 ); + auth_chunks->param_hdr.length = +htons (sizeof (sctp_paramhdr_t) +2 ); } }
PATCH 3/88 ipv6: dont use tw net when accounting for recycled tw
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Pavel Emelyanov <[email protected]>
[ Upstream commit 3f53a38131a4e7a053c0aa060aba0411242fb6b9 ]
We already have a valid net in that place, but this is not just a cleanup - the tw pointer can be NULL there sometimes, thus causing an oops in NET_NS=y case.
The same place in ipv4 code already works correctly using existing net, rather than tw's one.
The bug exists since 2.6.27.
--- net/ipv6/inet6_hashtables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/inet6_hashtables.c +2 -2
@@ -210,11 +210,11 @@ unique:if (twp !=NULL ) { *twp = tw; -NET_INC_STATS_BH (twsk_net (tw),LINUX_MIB_TIMEWAITRECYCLED ); +NET_INC_STATS_BH (net,LINUX_MIB_TIMEWAITRECYCLED ); }else if (tw !=NULL ) {/* Silly. Should hash-dance instead... */ inet_twsk_deschedule (tw, death_row); -NET_INC_STATS_BH (twsk_net (tw),LINUX_MIB_TIMEWAITRECYCLED ); +NET_INC_STATS_BH (net,LINUX_MIB_TIMEWAITRECYCLED );inet_twsk_put (tw); }
PATCH 4/88 ipv6: Plug sk_buff leak in ipv6_rcv (net/ipv6/ip6_input.c)
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jesper Nilsson <[email protected]>
[ Upstream commit 71f6f6dfdf7c7a67462386d9ea05c1095a89c555 ]
Commit 778d80be52699596bf70e0eb0761cf5e1e46088d
(ipv6: Add disable_ipv6 sysctl to disable IPv6 operaion on specific interface) seems to have introduced a leak of sk_buff's for ipv6 traffic,
at least in some configurations where idev is NULL, or when ipv6 is disabled via sysctl.
The problem is that if the first condition of the if-statement returns non-NULL, it returns an skb with only one reference, and when the other conditions apply, execution jumps to the "out" label, which does not call kfree_skb for it.
To plug this leak, change to use the "drop" label instead. (this relies on it being ok to call kfree_skb on NULL) This also allows us to avoid calling rcu_read_unlock here, and removes the only user of the "out" label.
--- net/ipv6/ip6_input.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv6/ip6_input.c +1 -3
@@ -75,8 +75,7 @@ int ipv6_rcv(struct sk_buff *skb, structif ((skb =skb_share_check (skb,GFP_ATOMIC )) ==NULL || !idev ||unlikely (idev->cnf.disable_ipv6)) {IP6_INC_STATS_BH (net, idev,IPSTATS_MIB_INDISCARDS ); -rcu_read_unlock (); - goto out; + goto drop; }memset (IP6CB (skb),0 ,sizeof (struct inet6_skb_parm ));
@@ -147,7 +146,6 @@ err: drop:rcu_read_unlock ();kfree_skb (skb); -out:return 0 ; }
PATCH 5/88 netfilter: nf_conntrack_tcp: fix unaligned memory access in tcp_sack
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mark H. Weaver <[email protected]>
[ Upstream commit 534f81a5068799799e264fd162e9488a129f98d4 ]
This patch fixes an unaligned memory access in tcp_sack while reading sequence numbers from TCP selective acknowledgement options. Prior to applying this patch, upstream linux-2.6.27.20 was occasionally generating messages like this on my sparc64 system:
[54678.532071] Kernel unaligned access at TPC[6b17d4] tcp_packet+0xcd4/0xd00
--- net/netfilter/nf_conntrack_proto_tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_proto_tcp.c +2 -1
@@ -15,6 +15,7 @@#include <linux/skbuff.h> #include <linux/ipv6.h> #include <net/ip6_checksum.h> +#include <asm/unaligned.h> #include <net/tcp.h>
@@ -466,7 +467,7 @@ static void tcp_sack(const struct sk_buffor (i =0 ; i < (opsize -TCPOLEN_SACK_BASE ); i +=TCPOLEN_SACK_PERBLOCK ) { - tmp =ntohl (*((__be32 *)(ptr+i)+1 )); + tmp =get_unaligned_be32 ((__be32 *)(ptr+i)+1 );if (after (tmp, *sack)) *sack = tmp;
PATCH 6/88 xfrm: spin_lock() should be spin_unlock() in xfrm_state.c
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chuck Ebbert <[email protected]>
[ Upstream commit 7d0b591c655ca0d72ebcbd242cf659a20a8995c5 ]
spin_lock() should be spin_unlock() in xfrm_state_walk_done().
caused by:
commit 12a169e7d8f4b1c95252d8b04ed0f1033ed7cfe2
"ipsec: Put dumpers on the dump list"
--- net/xfrm/xfrm_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
@@ -1601,7 +1601,7 @@ void xfrm_state_walk_done(struct xfrm_stspin_lock_bh (&xfrm_state_lock);list_del (&walk->all); -spin_lock_bh (&xfrm_state_lock); +spin_unlock_bh (&xfrm_state_lock); }EXPORT_SYMBOL (xfrm_state_walk_done);
PATCH 7/88 bridge: bad error handling when adding invalid ether address
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit cda6d377ec6b2ee2e58d563d0bd7eb313e0165df ]
This fixes an crash when empty bond device is added to a bridge. If an interface with invalid ethernet address (all zero) is added to a bridge, then bridge code detects it when setting up the forward databas entry. But the error unwind is broken, the bridge port object can get freed twice: once when ref count went to zeo, and once by kfree. Since object is never really accessible, just free it.
--- net/bridge/br_if.c | 1 - 1 file changed, 1 deletion(-)
net/bridge/br_if.c +0 -1
@@ -426,7 +426,6 @@ err2: err1:kobject_del (&p->kobj); err0: -kobject_put (&p->kobj);dev_set_promiscuity (dev,-1 ); put_back:dev_put (dev);
PATCH 8/88 bas_gigaset: correctly allocate USB interrupt transfer buffer
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tilman Schmidt <[email protected]>
[ Upstream commit 170ebf85160dd128e1c4206cc197cce7d1424705 ]
Every USB transfer buffer has to be allocated individually by kmalloc.
Impact: bugfix, no functional change
--- drivers/isdn/gigaset/bas-gigaset.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/isdn/gigaset/bas-gigaset.c +13 -3
@@ -46,6 +46,9 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"/* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ #define IF_WRITEBUF 264 +/* interrupt pipe message size according to ibid. ch. 2.2 */ +#define IP_MSGSIZE 3 +/* Values for the Gigaset 307x */ #define USB_GIGA_VENDOR_ID 0x0681#define USB_3070_PRODUCT_ID 0x0001
@@ -110,7 +113,7 @@ struct bas_cardstate {unsigned char *rcvbuf;/* AT reply receive buffer */ struct urb *urb_int_in;/* URB for interrupt pipe */ -unsigned char int_in_buf[3 ]; +unsigned char *int_in_buf;spinlock_t lock;/* locks all following */ int basstate;/* bitmap (BS_*) */
@@ -657,7 +660,7 @@ static void read_int_callback(struct urb }/* drop incomplete packets even if the missing bytes wouldn't matter */ -if (unlikely (urb->actual_length <3 )) { +if (unlikely (urb->actual_length <IP_MSGSIZE )) {dev_warn (cs->dev,"incomplete interrupt packet (%d bytes)\n" , urb->actual_length); goto resubmit;
@@ -2127,6 +2130,7 @@ static void gigaset_reinitbcshw(struct bstatic void gigaset_freecshw (struct cardstate *cs) {/* timers, URBs and rcvbuf are disposed of in disconnect */ +kfree (cs->hw.bas->int_in_buf);kfree (cs->hw.bas); cs->hw.bas =NULL ; }
@@ -2232,6 +2236,12 @@ static int gigaset_probe(struct usb_inte } hostif = interface->cur_altsetting; } + ucs->int_in_buf =kmalloc (IP_MSGSIZE ,GFP_KERNEL ); +if (!ucs->int_in_buf) { +kfree (ucs); +pr_err ("out of memory\n" ); +return 0 ; + }/* Reject application specific interfaces */
@@ -2290,7 +2300,7 @@ static int gigaset_probe(struct usb_inteusb_fill_int_urb (ucs->urb_int_in, udev,usb_rcvintpipe (udev, (endpoint->bEndpointAddress) &0x0f ), - ucs->int_in_buf,3 , read_int_callback, cs, + ucs->int_in_buf,IP_MSGSIZE , read_int_callback, cs, endpoint->bInterval);if ((rc =usb_submit_urb (ucs->urb_int_in,GFP_KERNEL )) !=0 ) { dev_err(cs->dev, "could not submit interrupt URB: %s\n",
PATCH 9/88 USB: EHCI: add software retry for transaction errors
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
upstream commit: a2c2706e1043c17139c2dafd171c4a5cf008ef7e
This patch (as1204) adds a software retry mechanism to ehci-hcd. It gets invoked when the driver encounters transaction errors on an asynchronous endpoint. On many systems, hardware deficiencies cause such errors to occur if one device is unplugged while the host is communicating with another device. With the patch, the failed transactions are retried and generally succeed the second or third time through.
This is based on code originally written by Koichiro Saito.
Tested by: Koichiro Saito <[email protected]>
--- drivers/usb/host/ehci-q.c | 32 ++++++++++++++++++++++++++++++++ drivers/usb/host/ehci.h | 3 +++ 2 files changed, 35 insertions(+)
drivers/usb/host/ehci.h +3 -0
@@ -366,6 +366,9 @@ struct ehci_qh {#define QH_STATE_UNLINK_WAIT 4/* LINKED and on reclaim q */ #define QH_STATE_COMPLETING 5/* don't touch token.HALT */ +u8 xacterrs;/* XactErr retry counter */ +#define QH_XACTERR_MAX 32/* XactErr retry limit */ +/* periodic schedule info */ u8 usecs;/* intr bandwidth */ u8 gap_uf;/* uframes split/csplit gap */
drivers/usb/host/ehci-q.c +32 -0
@@ -333,12 +333,40 @@ qh_completions (struct ehci_hcd *ehci, s token =hc32_to_cpu (ehci, qtd->hw_token);/* always clean up qtds the hc de-activated */ + retry_xacterr:if ((token &QTD_STS_ACTIVE ) ==0 ) {/* on STALL, error, and short reads this urb must * complete and all its qtds must be recycled. */ if ((token &QTD_STS_HALT ) !=0 ) { + +/* retry transaction errors until we +* reach the software xacterr limit +*/ +if ((token &QTD_STS_XACT ) && +QTD_CERR (token) ==0 && + --qh->xacterrs >0 && + !urb->unlinked) { +ehci_dbg (ehci, +"detected XactErr len %d/%d retry %d\n" , + qtd->length -QTD_LENGTH (token), qtd->length, +QH_XACTERR_MAX - qh->xacterrs); + +/* reset the token in the qtd and the +* qh overlay (which still contains +* the qtd) so that we pick up from +* where we left off +*/ + token &= ~QTD_STS_HALT ; + token |=QTD_STS_ACTIVE | + (EHCI_TUNE_CERR <<10 ); + qtd->hw_token =cpu_to_hc32 (ehci, + token); +wmb (); + qh->hw_token =cpu_to_hc32 (ehci, token); + goto retry_xacterr; + } stopped =1 ;/* magic dummy for some short reads; qh won't advance.
@@ -421,6 +449,9 @@ halt:/* remove qtd; it's recycled after possible urb completion */ list_del (&qtd->qtd_list); last = qtd; + +/* reinit the xacterr counter for the next qtd */ + qh->xacterrs =QH_XACTERR_MAX ; }/* last urb's completion might still need calling */
@@ -862,6 +893,7 @@ static void qh_link_async (struct ehci_h head->qh_next.qh = qh; head->hw_next = dma; + qh->xacterrs =QH_XACTERR_MAX ; qh->qh_state =QH_STATE_LINKED ;/* qtd completions reported later by interrupt */ }
PATCH 10/88 USB: fix USB_STORAGE_CYPRESS_ATACB
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Boaz Harrosh <[email protected]>
upstream commit: 1f4159c1620f74377e26d8a569d10ca5907ef475
commit 64a87b24: [SCSI] Let scsi_cmnd->cmnd use request->cmd buffer changed the scsi_eh_prep_cmnd logic by making it clear the ->cmnd buffer. But the sat to cypress atacb translation supposed the ->cmnd buffer wasn't modified.
This patch makes it set the ->cmnd buffer after scsi_eh_prep_cmnd call. The problem and a fix was reported by Matthieu CASTET <[email protected]>
It also removes all the hackery fiddling of scsi_cmnd and scsi_eh_save by requesting from scsi_eh_prep_cmnd to prepare a read into ->sense_buffer, which is much more suitable a buffer for HW transfers, then after the command execution the regs read is copied into regs buffer before actual preparation of sense_buffer.
Also fix an alien comment character to my utf-8 editor.
--- drivers/usb/storage/cypress_atacb.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/usb/storage/cypress_atacb.c +7 -8
@@ -133,19 +133,18 @@ void cypress_atacb_passthrough(struct sc/* build the command for * reading the ATA registers */ -scsi_eh_prep_cmnd (srb, &ses,NULL ,0 ,0 ); - srb->sdb.length =sizeof (regs); -sg_init_one (&ses.sense_sgl, regs, srb->sdb.length); - srb->sdb.table.sgl = &ses.sense_sgl; - srb->sc_data_direction =DMA_FROM_DEVICE ; - srb->sdb.table.nents =1 ; +scsi_eh_prep_cmnd (srb, &ses,NULL ,0 ,sizeof (regs)); +/* we use the same command as before, but we set * the read taskfile bit, for not executing atacb command, * but reading register selected in srb->cmnd[4] */ + srb->cmd_len =16 ; + srb->cmnd = ses.cmnd; srb->cmnd[2 ] =1 ;usb_stor_transparent_scsi_command (srb, us); +memcpy (regs, srb->sense_buffer,sizeof (regs)); tmp_result = srb->result;scsi_eh_restore_cmnd (srb, &ses);/* we fail to get registers, report invalid command */
@@ -162,8 +161,8 @@ void cypress_atacb_passthrough(struct sc/* XXX we should generate sk, asc, ascq from status and error * regs -* (see 11.1 Error translation � ATA device error to SCSI error map) -* and ata_to_sense_error from libata. +* (see 11.1 Error translation ATA device error to SCSI error +* map, and ata_to_sense_error from libata.) */ /* Sense data is current and format is descriptor. */
PATCH 11/88 USB: usb-storage: increase max_sectors for tape drives
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
'
upstream commit: 5c16034d73da2c1b663aa25dedadbc533b3d811c
This patch (as1203) increases the max_sector limit for USB tape drives. By default usb-storage sets max_sectors to 240 (i.e., 120 KB) for all devices. But tape drives need a higher limit, since tapes can and do have very large block sizes. Without the ability to transfer an entire large block in a single command, such tapes can't be used.
This fixes Bugzilla #12207.
--- drivers/usb/storage/scsiglue.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/scsiglue.c +6 -0
@@ -135,6 +135,12 @@ static int slave_configure(struct scsi_dif (sdev->request_queue->max_sectors > max_sectors)blk_queue_max_sectors (sdev->request_queue, max_sectors); + }else if (sdev->type ==TYPE_TAPE ) { +/* Tapes need much higher max_sector limits, so just +* raise it to the maximum possible (4 GB / 512) and +* let the queue segment size sort out the real limit. +*/ +blk_queue_max_sectors (sdev->request_queue,0x7FFFFF ); }/* We can't put these settings in slave_alloc() because that gets
PATCH 12/88 USB: gadget: fix rndis regression
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Brownell <[email protected]>
upstream commit: 090b90118207e786d2990310d063fda5d52cce6e
Restore some code that was wrongly dropped from the RNDIS driver, and caused interop problems observed with OpenMoko.
The issue is with hardware which needs help conforming to part of the USB 2.0 spec (section 8.5.3.2); some can automagically send a ZLP in response to an unexpected IN, but not all chips will do that. We don't need to check the packet length ourselves the way earlier code did, since the UDC must already check it. But we do need to tell the UDC when it must force a short packet termination of the data stage.
(Based on a patch from Aric D. Blumer <aric at sdgsystems.com>)
--- drivers/usb/gadget/f_rndis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_rndis.c +1 -1
@@ -437,7 +437,7 @@ invalid:DBG (cdev,"rndis req%02x.%02x v%04x i%04x l%d\n" , ctrl->bRequestType, ctrl->bRequest, w_value, w_index, w_length); - req->zero =0 ; + req->zero = (value < w_length); req->length = value; value =usb_ep_queue (cdev->gadget->ep0, req,GFP_ATOMIC );if (value <0 )
PATCH 13/88 USB: add quirk to avoid config and interface strings
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
upstream commit: 1662e3a7f076e51e3073faf9ce77157b529c475b
Apparently the Configuration and Interface strings aren't used as often as the Vendor, Product, and Serial strings. In at least one device (a Saitek Cyborg Gold 3D joystick), attempts to read the Configuration string cause the device to stop responding to Control requests.
This patch (as1226) adds a quirks flag, telling the kernel not to read a device's Configuration or Interface strings, together with a new quirk for the offending joystick.
--- drivers/usb/core/message.c | 3 ++- drivers/usb/core/quirks.c | 4 ++++ drivers/usb/core/sysfs.c | 4 +++- include/linux/usb/quirks.h | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-)
drivers/usb/core/message.c +2 -1
@@ -1637,7 +1637,8 @@ free_interfaces: }kfree (new_interfaces); -if (cp->string ==NULL ) +if (cp->string ==NULL && + !(dev->quirks &USB_QUIRK_CONFIG_INTF_STRINGS )) cp->string =usb_cache_string (dev, cp->desc.iConfiguration);/* Now that all the interfaces are set up, register them
drivers/usb/core/quirks.c +4 -0
@@ -54,6 +54,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0638, 0x0a13), .driver_info = USB_QUIRK_STRING_FETCH_255 }, + /* Saitek Cyborg Gold Joystick */ + { USB_DEVICE(0x06a3, 0x0006), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, + /* M-Systems Flash Disk Pioneers */ { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
drivers/usb/core/sysfs.c +3 -1
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <linux/string.h> #include <linux/usb.h> +#include <linux/usb/quirks.h> #include "usb.h" /* Active configuration fields */
@@ -847,7 +848,8 @@ int usb_create_sysfs_intf_files(struct u* and missing in others. Hence its attribute cannot be created * before the uevent is broadcast. */ -if (alt->string ==NULL ) +if (alt->string ==NULL && + !(udev->quirks &USB_QUIRK_CONFIG_INTF_STRINGS )) alt->string =usb_cache_string (udev, alt->desc.iInterface);if (alt->string) retval =device_create_file (&intf->dev, &dev_attr_interface);
include/linux/usb/quirks.h +3 -0
@@ -16,4 +16,7 @@/* device can't handle Set-Interface requests */ #define USB_QUIRK_NO_SET_INTF 0x00000004 +/* device can't handle its Configuration or Interface strings */ +#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 +#endif /* __LINUX_USB_QUIRKS_H */
PATCH 14/88 cifs: fix buffer format byte on NT Rename/hardlink
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jeff Layton <[email protected]>
upstream commit: fcc7c09d94be7b75c9ea2beb22d0fae191c6b4b9
Discovered at Connnectathon 2009...
The buffer format byte and the pad are transposed in NT_RENAME calls (which are used to set hardlinks). Most servers seem to ignore this fact, but NetApp filers throw back an error due to this problem. This patch fixes it.
--- fs/cifs/cifssmb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +4 -2
@@ -2350,8 +2350,10 @@ winCreateHardLinkRetry: PATH_MAX, nls_codepage, remap); name_len++;/* trailing null */ name_len *=2 ; - pSMB->OldFileName[name_len] =0 ;/* pad */ - pSMB->OldFileName[name_len +1 ] =0x04 ; + +/* protocol specifies ASCII buffer format (0x04) for unicode */ + pSMB->OldFileName[name_len] =0x04 ; + pSMB->OldFileName[name_len +1 ] =0x00 ;/* pad */ name_len2 =cifsConvertToUCS ((__le16 *)&pSMB->OldFileName[name_len +2 ], toName,PATH_MAX , nls_codepage, remap);
PATCH 15/88 b43: fix b43_plcp_get_bitrate_idx_ofdm return type
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Lorenzo Nava <[email protected]>
upstream commit: a3c0b87c4f21911fb7185902dd13f0e3cd7f33f7
This patch fixes the return type of b43_plcp_get_bitrate_idx_ofdm. If the plcp contains an error, the function return value is 255 instead of -1, and the packet was not dropped. This causes a warning in __ieee80211_rx function because rate idx is out of range.
--- drivers/net/wireless/b43/xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/b43/xmit.c +1 -1
@@ -51,7 +51,7 @@ static int b43_plcp_get_bitrate_idx_cck( }/* Extract the bitrate index out of an OFDM PLCP header. */ -static u8 b43_plcp_get_bitrate_idx_ofdm (struct b43_plcp_hdr6 *plcp,bool aphy) +static int b43_plcp_get_bitrate_idx_ofdm (struct b43_plcp_hdr6 *plcp,bool aphy) {int base = aphy ?0 :4 ;
PATCH 16/88 CIFS: Fix memory overwrite when saving nativeFileSystem field during mount
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Steve French <[email protected]>
upstream commit: b363b3304bcf68c4541683b2eff70b29f0446a5b
CIFS can allocate a few bytes to little for the nativeFileSystem field during tree connect response processing during mount. This can result in a "Redzone overwritten" message to be logged.
--- fs/cifs/CHANGES | 3 +++ fs/cifs/connect.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
fs/cifs/CHANGES +3 -0
@@ -1,4 +1,7 @@ Fix oops in cifs_dfs_ref.c when prefixpath is not reachable when using DFS. +Fix "redzone overwritten" bug in cifs_put_tcon (CIFSTcon may allocate too +little memory for the "nativeFileSystem" field returned by the server +during mount). Version 1.55 ------------
fs/cifs/connect.c +1 -1
@@ -3565,7 +3565,7 @@ CIFSTCon(unsigned int xid, struct cifsSe BCC(smb_buffer_response)) {kfree (tcon->nativeFileSystem); tcon->nativeFileSystem = -kzalloc (length +2 ,GFP_KERNEL ); +kzalloc (2 *(length +1 ),GFP_KERNEL );if (tcon->nativeFileSystem) cifs_strfromUCS_le( tcon->nativeFileSystem,
PATCH 17/88 Add a missing unlock_kernel() in raw_open()
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
upstream commit: 996ff68d8b358885c1de82a45517c607999947c7
--- drivers/char/raw.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/raw.c +1 -0
@@ -90,6 +90,7 @@ out1:blkdev_put (bdev, filp->f_mode); out:mutex_unlock (&raw_mutex); +unlock_kernel ();return err; }
PATCH 18/88 x86, PAT, PCI: Change vma prot in pci_mmap to reflect inherited prot
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Venkatesh Pallipadi <[email protected]>
upstream commit: 9cdec049389ce2c324fd1ec508a71528a27d4a07
While looking at the issue in the thread:
http://marc.info/?l=dri-devel&m=123606627824556&w=2
noticed a bug in pci PAT code and memory type setting.
PCI mmap code did not set the proper protection in vma, when it inherited protection in reserve_memtype. This bug only affects the case where there exists a WC mapping before X does an mmap with /proc or /sys pci interface. This will cause X userlevel mmap from /proc or /sysfs to fail on fork.
LKML-Reference: <[email protected]>
--- arch/x86/pci/i386.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/pci/i386.c +3 -0
@@ -329,6 +329,9 @@ int pci_mmap_page_range(struct pci_dev *return -EINVAL ; } flags = new_flags; + vma->vm_page_prot =__pgprot ( + (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK) | + flags); } if (((vma->vm_pgoff < max_low_pfn_mapped) ||
PATCH 19/88 x86: mtrr: dont modify RdDram/WrDram bits of fixed MTRRs
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Andreas Herrmann <[email protected]>
upstream commit: 3ff42da5048649503e343a32be37b14a6a4e8aaf
Impact: bug fix + BIOS workaround
BIOS is expected to clear the SYSCFG[MtrrFixDramModEn] on AMD CPUs after fixed MTRRs are configured.
Some BIOSes do not clear SYSCFG[MtrrFixDramModEn] on BP (and on APs).
This can lead to obfuscation in Linux when this bit is not cleared on BP but cleared on APs. A consequence of this is that the saved fixed-MTRR state (from BP) differs from the fixed-MTRRs of APs -- because RdDram/WrDram bits are read as zero when SYSCFG[MtrrFixDramModEn] is cleared -- and Linux tries to sync fixed-MTRR state from BP to AP. This implies that Linux sets SYSCFG[MtrrFixDramEn] and activates those bits.
More important is that (some) systems change these bits in SMM when ACPI is enabled. Hence it is racy if Linux modifies RdMem/WrMem bits, too.
(1) The patch modifies an old fix from Bernhard Kaindl to get suspend/resume working on some Acer Laptops. Bernhard's patch tried to sync RdMem/WrMem bits of fixed MTRR registers and that helped on those old Laptops. (Don't ask me why -- can't test it myself). But this old problem was not the motivation for the patch. (See http://lkml.org/lkml/2007/4/3/110)
(2) The more important effect is to fix issues on some more current systems.
On those systems Linux panics or just freezes, see
http://bugzilla.kernel.org/show_bug.cgi?id=11541
(and also duplicates of this bug:
http://bugzilla.kernel.org/show_bug.cgi?id=11737
http://bugzilla.kernel.org/show_bug.cgi?id=11714)
The affected systems boot only using acpi=ht, acpi=off or when the kernel is built with CONFIG_MTRR=n.
The acpi options prevent full enablement of ACPI. Obviously when ACPI is enabled the BIOS/SMM modfies RdMem/WrMem bits. When CONFIG_MTRR=y Linux also accesses and modifies those bits when it needs to sync fixed-MTRRs across cores (Bernhard's fix, see (1)). How do you synchronize that? You can't. As a consequence Linux shouldn't touch those bits at all (Rationale are AMD's BKDGs which recommend to clear the bit that makes RdMem/WrMem accessible). This is the purpose of this patch. And (so far) this suffices to fix (1) and (2).
I suggest not to touch RdDram/WrDram bits of fixed-MTRRs and SYSCFG[MtrrFixDramEn] and to clear SYSCFG[MtrrFixDramModEn] as suggested by AMD K8, and AMD family 10h/11h BKDGs. BIOS is expected to do this anyway. This should avoid that Linux and SMM tread on each other's toes ...
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mtrr/generic.c | 51 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-)
arch/x86/kernel/cpu/mtrr/generic.c +30 -21
@@ -45,6 +45,32 @@ u64 mtrr_tom2;static int mtrr_show;module_param_named (show, mtrr_show, bool,0 ); +/** +* BIOS is expected to clear MtrrFixDramModEn bit, see for example +* "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD +* Opteron Processors" (26094 Rev. 3.30 February 2006), section +* "13.2.1.2 SYSCFG Register": "The MtrrFixDramModEn bit should be set +* to 1 during BIOS initalization of the fixed MTRRs, then cleared to +* 0 for operation." +*/ +static inline void k8_check_syscfg_dram_mod_en (void ) +{ +u32 lo, hi; + +if (!((boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) && + (boot_cpu_data.x86 >=0x0f ))) +return ; + +rdmsr (MSR_K8_SYSCFG , lo, hi); +if (lo &K8_MTRRFIXRANGE_DRAM_MODIFY ) { + printk(KERN_ERR FW_WARN "MTRR: CPU %u: SYSCFG[MtrrFixDramModEn]" +" not cleared by BIOS, clearing this bit\n" , + smp_processor_id()); + lo &= ~K8_MTRRFIXRANGE_DRAM_MODIFY ; +mtrr_wrmsr (MSR_K8_SYSCFG , lo, hi); + } +} +/* * Returns the effective MTRR type for the region * Error returns:
@@ -178,6 +204,8 @@ get_fixed_ranges(mtrr_type * frs)unsigned int *p = (unsigned int *) frs;int i; +k8_check_syscfg_dram_mod_en (); +rdmsr (MTRRfix64K_00000_MSR, p[0 ], p[1 ]);for (i =0 ; i <2 ; i++)
@@ -312,27 +340,10 @@ void mtrr_wrmsr(unsigned msr, unsigned a }/** -* Enable and allow read/write of extended fixed-range MTRR bits on K8 CPUs -* see AMD publication no. 24593, chapter 3.2.1 for more information -*/ -static inline void k8_enable_fixed_iorrs (void ) -{ -unsigned lo, hi; - -rdmsr (MSR_K8_SYSCFG , lo, hi); -mtrr_wrmsr (MSR_K8_SYSCFG , lo - |K8_MTRRFIXRANGE_DRAM_ENABLE - |K8_MTRRFIXRANGE_DRAM_MODIFY , hi); -} - -/** * set_fixed_range - checks & updates a fixed-range MTRR if it differs from the value it should have * @msr: MSR address of the MTTR which should be checked and updated * @changed: pointer which indicates whether the MTRR needed to be changed * @msrwords: pointer to the MSR values which the MSR should have -* -* If K8 extentions are wanted, update the K8 SYSCFG MSR also. -* See AMD publication no. 24593, chapter 7.8.1, page 233 for more information. */ static void set_fixed_range (int msr,bool *changed,unsigned int *msrwords) {
@@ -341,10 +352,6 @@ static void set_fixed_range(int msr, boordmsr (msr, lo, hi);if (lo != msrwords[0 ] || hi != msrwords[1 ]) { -if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD && - (boot_cpu_data.x86 >=0x0f && boot_cpu_data.x86 <=0x11 ) && - ((msrwords[0 ] | msrwords[1 ]) &K8_MTRR_RDMEM_WRMEM_MASK )) -k8_enable_fixed_iorrs ();mtrr_wrmsr (msr, msrwords[0 ], msrwords[1 ]); *changed = true; }
@@ -423,6 +430,8 @@ static int set_fixed_ranges(mtrr_type *bool changed = false;int block=-1 , range; +k8_check_syscfg_dram_mod_en (); +while (fixed_range_blocks[++block].ranges)for (range=0 ; range < fixed_range_blocks[block].ranges; range++) set_fixed_range(fixed_range_blocks[block].base_msr + range,
PATCH 20/88 security/smack: fix oops when setting a size 0 SMACK64 xattr
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Etienne Basset <[email protected]>
upstream commit: 4303154e86597885bc3cbc178a48ccbc8213875f
this patch fix an oops in smack when setting a size 0 SMACK64 xattr eg attr -S -s SMACK64 -V '' somefile
This oops because smk_import_entry treats a 0 length as SMK_MAXLEN
--- security/smack/smack_lsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
security/smack/smack_lsm.c +3 -1
@@ -604,6 +604,8 @@ static int smack_inode_setxattr(struct d strcmp(name, XATTR_NAME_SMACKIPOUT) == 0) {if (!capable (CAP_MAC_ADMIN )) rc = -EPERM ; +if (size ==0 ) + rc = -EINVAL ; } else rc =cap_inode_setxattr (dentry, name, value, size, flags);
@@ -1360,7 +1362,7 @@ static int smack_inode_setsecurity(strucstruct socket *sock;int rc =0 ; -if (value ==NULL || size >SMK_LABELLEN ) +if (value ==NULL || size >SMK_LABELLEN || size ==0 )return -EACCES ; sp =smk_import (value, size);
PATCH 21/88 x86, setup: mark %esi as clobbered in E820 BIOS call
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael K. Johnson <[email protected]>
upstream commit: 01522df346f846906eaf6ca57148641476209909
Jordan Hargrave diagnosed a BIOS clobbering %esi in the E820 call. That particular BIOS has been fixed, but there is a possibility that this is responsible for other occasional reports of early boot failure, and it does not hurt to add %esi to the clobbers.
-stable candidate patch.
--- arch/x86/boot/memory.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/boot/memory.c +4 -3
@@ -27,13 +27,14 @@ static int detect_memory_e820(void) do { size = sizeof(struct e820entry); - /* Important: %edx is clobbered by some BIOSes, - so it must be either used for the error output + /* Important: %edx and %esi are clobbered by some BIOSes, + so they must be either used for the error output or explicitly marked clobbered. */ asm("int $0x15; setc %0" : "=d" (err), "+b" (next), "=a" (id), "+c" (size), "=m" (*desc) - : "D" (desc), "d" (SMAP), "a" (0xe820)); + : "D" (desc), "d" (SMAP), "a" (0xe820) + : "esi"); /* BIOSes which terminate the chain with CF = 1 as opposed to %ebx = 0 don't always report the SMAP signature on
PATCH 22/88 dock: fix dereference after kfree()
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
upstream commit: f240729832dff3785104d950dad2d3ced4387f6d
dock_remove() calls kfree() on dock_station so we should use list_for_each_entry_safe() to avoid dereferencing freed memory.
Found by smatch (http://repo.or.cz/w/smatch.git/). Compile tested.
--- drivers/acpi/dock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/dock.c +2 -1
@@ -1146,9 +1146,10 @@ static int __init dock_init(void) static void __exit dock_exit(void) {struct dock_station *dock_station; +struct dock_station *tmp;unregister_acpi_bus_notifier (&dock_acpi_notifier); -list_for_each_entry (dock_station, &dock_stations, sibiling) +list_for_each_entry_safe (dock_station, tmp, &dock_stations, sibiling)dock_remove (dock_station); }
PATCH 23/88 mm: define a UNIQUE value for AS_UNEVICTABLE flag
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Lee Schermerhorn <[email protected]>
upstream commit: 9a896c9a48ac6704c0ce8ee081b836644d0afe40
A new "address_space flag"--AS_MM_ALL_LOCKS--was defined to use the next available AS flag while the Unevictable LRU was under development. The Unevictable LRU was using the same flag and "no one" noticed. Current mainline, since 2.6.28, has same value for two symbolic flag names.
So, define a unique flag value for AS_UNEVICTABLE--up close to the other flags, [at the cost of an additional #ifdef] so we'll notice next time. Note that #ifdef is not actually required, if we don't mind having the unused flag value defined.
Replace #defines with an enum.
--- include/linux/pagemap.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
include/linux/pagemap.h +8 -4
@@ -18,9 +18,14 @@* Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page * allocation mode flags. */ -#define AS_EIO (__GFP_BITS_SHIFT + 0)/* IO error on async write */ -#define AS_ENOSPC (__GFP_BITS_SHIFT + 1)/* ENOSPC on async write */ -#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2)/* under mm_take_all_locks() */ +enum mapping_flags { +AS_EIO = __GFP_BITS_SHIFT +0 ,/* IO error on async write */ +AS_ENOSPC = __GFP_BITS_SHIFT +1 ,/* ENOSPC on async write */ +AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT +2 ,/* under mm_take_all_locks() */ +#ifdef CONFIG_UNEVICTABLE_LRU +AS_UNEVICTABLE = __GFP_BITS_SHIFT +3 ,/* e.g., ramdisk, SHM_LOCK */ +#endif +};static inline void mapping_set_error (struct address_space *mapping,int error) {
@@ -33,7 +38,6 @@ static inline void mapping_set_error(str }#ifdef CONFIG_UNEVICTABLE_LRU -#define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2)/* e.g., ramdisk, SHM_LOCK */ static inline void mapping_set_unevictable (struct address_space *mapping) {
PATCH 24/88 mm: do_xip_mapping_read: fix length calculation
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Martin Schwidefsky <[email protected]>
upstream commit: 58984ce21d315b70df1a43644df7416ea7c9bfd8
The calculation of the value nr in do_xip_mapping_read is incorrect. If the copy required more than one iteration in the do while loop the copies variable will be non-zero. The maximum length that may be passed to the call to copy_to_user(buf+copied, xip_mem+offset, nr) is len-copied but the check only compares against (nr > len).
This bug is the cause for the heap corruption Carsten has been chasing for so long:
*** glibc detected *** /bin/bash: free(): invalid next size (normal): 0x00000000800e39f0 *** ======= Backtrace: =========
/lib64/libc.so.6[0x200000b9b44]
/lib64/libc.so.6(cfree+0x8e)[0x200000bdade] /bin/bash(free_buffered_stream+0x32)[0x80050e4e] /bin/bash(close_buffered_stream+0x1c)[0x80050ea4] /bin/bash(unset_bash_input+0x2a)[0x8001c366] /bin/bash(make_child+0x1d4)[0x8004115c]
/bin/bash[0x8002fc3c]
/bin/bash(execute_command_internal+0x656)[0x8003048e] /bin/bash(execute_command+0x5e)[0x80031e1e] /bin/bash(execute_command_internal+0x79a)[0x800305d2] /bin/bash(execute_command+0x5e)[0x80031e1e] /bin/bash(reader_loop+0x270)[0x8001efe0]
/bin/bash(main+0x1328)[0x8001e960] /lib64/libc.so.6(__libc_start_main+0x100)[0x200000592a8] /bin/bash(clearerr+0x5e)[0x8001c092]
With this bug fix the commit 0e4a9b59282914fe057ab17027f55123964bc2e2 "ext2/xip: refuse to change xip flag during remount with busy inodes" can be removed again.
--- mm/filemap_xip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/filemap_xip.c +2 -2
@@ -89,8 +89,8 @@ do_xip_mapping_read(struct address_space } } nr = nr - offset; -if (nr > len) - nr = len; +if (nr > len - copied) + nr = len - copied; error = mapping->a_ops->get_xip_mem (mapping, index,0 , &xip_mem, &xip_pfn);
PATCH 25/88 vfs: skip I_CLEAR state inodes
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wu Fengguang <[email protected]>
upstream commit: b6fac63cc1f52ec27f29fe6c6c8494a2ffac33fd
clear_inode() will switch inode state from I_FREEING to I_CLEAR, and do so _outside_ of inode_lock. So any I_FREEING testing is incomplete without a coupled testing of I_CLEAR.
So add I_CLEAR tests to drop_pagecache_sb(), generic_sync_sb_inodes() and add_dquot_ref().
Masayoshi MIZUMA discovered the bug in drop_pagecache_sb() and Jan Kara reminds fixing the other two cases.
Masayoshi MIZUMA has a nice panic flow:
=====================================================================
[process A] | [process B] | | | prune_icache() | drop_pagecache() | spin_lock(&inode_lock) | drop_pagecache_sb() | inode->i_state |= I_FREEING; | | | spin_unlock(&inode_lock) | V | | | spin_lock(&inode_lock) | V | | | dispose_list() | | | list_del() | | | clear_inode() | | | inode->i_state = I_CLEAR | | | | | V | | | if (inode->i_state & (I_FREEING|I_WILL_FREE)) | | | continue; <==== NOT MATCH | | | | | | (DANGER from here on! Accessing disposing inode!) | | | | | | __iget() | | | list_move() <===== PANIC on poisoned list !! V V |
(time)
=====================================================================
--- fs/dquot.c | 2 +- fs/drop_caches.c | 2 +- fs/fs-writeback.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-)
fs/dquot.c +1 -1
@@ -724,7 +724,7 @@ static void add_dquot_ref(struct super_bcontinue ;if (!dqinit_needed (inode, type))continue ; -if (inode->i_state & (I_FREEING |I_WILL_FREE )) +if (inode->i_state & (I_FREEING |I_CLEAR |I_WILL_FREE ))continue ;__iget (inode);
fs/drop_caches.c +1 -1
@@ -18,7 +18,7 @@ static void drop_pagecache_sb(struct supspin_lock (&inode_lock);list_for_each_entry (inode, &sb->s_inodes, i_sb_list) { -if (inode->i_state & (I_FREEING |I_WILL_FREE )) +if (inode->i_state & (I_FREEING |I_CLEAR |I_WILL_FREE ))continue ;if (inode->i_mapping->nrpages ==0 )continue ;
fs/fs-writeback.c +2 -1
@@ -538,7 +538,8 @@ void generic_sync_sb_inodes(struct superlist_for_each_entry (inode, &sb->s_inodes, i_sb_list) {struct address_space *mapping; -if (inode->i_state & (I_FREEING |I_WILL_FREE |I_NEW )) +if (inode->i_state & + (I_FREEING |I_CLEAR |I_WILL_FREE |I_NEW ))continue ; mapping = inode->i_mapping;if (mapping->nrpages ==0 )
PATCH 27/88 net/netrom: Fix socket locking
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
upstream commit: cc29c70dd581f85ee7a3e7980fb031f90b90a2ab
Patch "af_rose/x25: Sanity check the maximum user frame size" (commit 83e0bbcbe2145f160fbaa109b0439dae7f4a38a9) from Alan Cox got locking wrong. If we bail out due to user frame size being too large, we must unlock the socket beforehand.
--- net/netrom/af_netrom.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/netrom/af_netrom.c +4 -2
@@ -1084,8 +1084,10 @@ static int nr_sendmsg(struct kiocb *iocb/* Build a packet - the conventional user limit is 236 bytes. We can do ludicrously large NetROM frames but must not overflow */ -if (len >65536 ) -return -EMSGSIZE ; +if (len >65536 ) { + err = -EMSGSIZE ; + goto out; + }SOCK_DEBUG (sk,"NET/ROM: sendto: building packet.\n" ); size = len +NR_NETWORK_LEN +NR_TRANSPORT_LEN ;
PATCH 26/88 af_rose/x25: Sanity check the maximum user frame size
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Cox <[email protected]>
upstream commit: 83e0bbcbe2145f160fbaa109b0439dae7f4a38a9
CVE-2009-0795.
Otherwise we can wrap the sizes and end up sending garbage.
Closes #10423
--- net/netrom/af_netrom.c | 6 +++++- net/rose/af_rose.c | 4 ++++ net/x25/af_x25.c | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
net/netrom/af_netrom.c +5 -1
@@ -1082,7 +1082,11 @@ static int nr_sendmsg(struct kiocb *iocbSOCK_DEBUG (sk,"NET/ROM: sendto: Addresses built.\n" ); -/* Build a packet */ +/* Build a packet - the conventional user limit is 236 bytes. We can +do ludicrously large NetROM frames but must not overflow */ +if (len >65536 ) +return -EMSGSIZE ; +SOCK_DEBUG (sk,"NET/ROM: sendto: building packet.\n" ); size = len +NR_NETWORK_LEN +NR_TRANSPORT_LEN ;
net/rose/af_rose.c +4 -0
@@ -1124,6 +1124,10 @@ static int rose_sendmsg(struct kiocb *io/* Build a packet */ SOCK_DEBUG (sk,"ROSE: sendto: building packet.\n" ); +/* Sanity check the packet size */ +if (len >65535 ) +return -EMSGSIZE ; + size = len +AX25_BPQ_HEADER_LEN +AX25_MAX_HEADER_LEN +ROSE_MIN_LEN ;if ((skb =sock_alloc_send_skb (sk, size, msg->msg_flags &MSG_DONTWAIT , &err)) ==NULL )
net/x25/af_x25.c +6 -0
@@ -1037,6 +1037,12 @@ static int x25_sendmsg(struct kiocb *ioc sx25.sx25_addr = x25->dest_addr; } +/* Sanity check the packet size */ +if (len >65535 ) { + rc = -EMSGSIZE ; + goto out; + } +SOCK_DEBUG (sk,"x25_sendmsg: sendto: Addresses built.\n" );/* Build a packet */
PATCH 28/88 kprobes: Fix locking imbalance in kretprobes
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ananth N Mavinakayanahalli <[email protected]>
commit f02b8624fedca39886b0eef770dca70c2f0749b3 upstream.
Fix locking imbalance in kretprobes:
=====================================
[ BUG: bad unlock balance detected! ]
-------------------------------------
kthreadd/2 is trying to release lock (&rp->lock) at:
[<c06b3080>] pre_handler_kretprobe+0xea/0xf4 but there are no more locks to release!
other info that might help us debug this:
1 lock held by kthreadd/2:
#0: (rcu_read_lock){..--}, at: [<c06b2b24>] __atomic_notifier_call_chain+0x0/0x5a
stack backtrace: Pid: 2, comm: kthreadd Not tainted 2.6.29-rc8 #1 Call Trace: [<c06ae498>] ? printk+0xf/0x17 [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4 [<c044ce6c>] print_unlock_inbalance_bug+0xc3/0xce [<c0444d4b>] ? clocksource_read+0x7/0xa [<c04450a4>] ? getnstimeofday+0x5f/0xf6 [<c044a9ca>] ? register_lock_class+0x17/0x293 [<c044b72c>] ? mark_lock+0x1e/0x30b [<c0448956>] ? tick_dev_program_event+0x4a/0xbc [<c0498100>] ? __slab_alloc+0xa5/0x415 [<c06b2fbe>] ? pre_handler_kretprobe+0x28/0xf4 [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4 [<c044cf1b>] lock_release_non_nested+0xa4/0x1a5 [<c06b3080>] ? pre_handler_kretprobe+0xea/0xf4 [<c044d15d>] lock_release+0x141/0x166 [<c06b07dd>] _spin_unlock_irqrestore+0x19/0x50 [<c06b3080>] pre_handler_kretprobe+0xea/0xf4 [<c06b20b5>] kprobe_exceptions_notify+0x1c9/0x43e [<c06b2b02>] notifier_call_chain+0x26/0x48 [<c06b2b5b>] __atomic_notifier_call_chain+0x37/0x5a [<c06b2b24>] ? __atomic_notifier_call_chain+0x0/0x5a [<c06b2b8a>] atomic_notifier_call_chain+0xc/0xe [<c0442d0d>] notify_die+0x2d/0x2f [<c06b0f9c>] do_int3+0x1f/0x71 [<c06b0e84>] int3+0x2c/0x34 [<c042d476>] ? do_fork+0x1/0x288 [<c040221b>] ? kernel_thread+0x71/0x79 [<c043ed1b>] ? kthread+0x0/0x60 [<c043ed1b>] ? kthread+0x0/0x60 [<c04040b8>] ? kernel_thread_helper+0x0/0x10 [<c043ec7f>] kthreadd+0xac/0x148 [<c043ebd3>] ? kthreadd+0x0/0x148 [<c04040bf>] kernel_thread_helper+0x7/0x10
LKML-Reference: <[email protected]>
--- kernel/kprobes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/kprobes.c +1 -3
@@ -901,10 +901,8 @@ static int __kprobes pre_handler_kretpro ri->rp = rp; ri->task = current; -if (rp->entry_handler && rp->entry_handler (ri, regs)) { -spin_unlock_irqrestore (&rp->lock, flags); +if (rp->entry_handler && rp->entry_handler (ri, regs))return 0 ; - }arch_prepare_kretprobe (ri, regs);
PATCH 29/88 netfilter: {ip, ip6, arp}_tables: fix incorrect loop detection
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Patrick McHardy <[email protected]>
upstream commit: 1f9352ae2253a97b07b34dcf16ffa3b4ca12c558
Commit e1b4b9f ([NETFILTER]: {ip,ip6,arp}_tables: fix exponential worst-case search for loops) introduced a regression in the loop detection algorithm, causing sporadic incorrectly detected loops.
When a chain has already been visited during the check, it is treated as having a standard target containing a RETURN verdict directly at the beginning in order to not check it again. The real target of the first rule is then incorrectly treated as STANDARD target and checked not to contain invalid verdicts.
Fix by making sure the rule does actually contain a standard target.
Based on patch by Francis Dupont <[email protected]>
--- net/ipv4/netfilter/arp_tables.c | 4 +++- net/ipv4/netfilter/ip_tables.c | 4 +++- net/ipv6/netfilter/ip6_tables.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
net/ipv4/netfilter/arp_tables.c +3 -1
@@ -374,7 +374,9 @@ static int mark_source_chains(struct xt_ && unconditional(&e->arp)) || visited) {unsigned int oldpos, size; -if (t->verdict < -NF_MAX_VERDICT -1 ) { +if ((strcmp (t->target.u.user.name, +ARPT_STANDARD_TARGET ) ==0 ) && + t->verdict < -NF_MAX_VERDICT -1 ) {duprintf ("mark_source_chains: bad " "negative verdict (%i)\n" , t->verdict);
net/ipv4/netfilter/ip_tables.c +3 -1
@@ -500,7 +500,9 @@ mark_source_chains(struct xt_table_info && unconditional(&e->ip)) || visited) {unsigned int oldpos, size; -if (t->verdict < -NF_MAX_VERDICT -1 ) { +if ((strcmp (t->target.u.user.name, +IPT_STANDARD_TARGET ) ==0 ) && + t->verdict < -NF_MAX_VERDICT -1 ) {duprintf ("mark_source_chains: bad " "negative verdict (%i)\n" , t->verdict);
net/ipv6/netfilter/ip6_tables.c +3 -1
@@ -525,7 +525,9 @@ mark_source_chains(struct xt_table_info && unconditional(&e->ipv6)) || visited) {unsigned int oldpos, size; -if (t->verdict < -NF_MAX_VERDICT -1 ) { +if ((strcmp (t->target.u.user.name, +IP6T_STANDARD_TARGET ) ==0 ) && + t->verdict < -NF_MAX_VERDICT -1 ) {duprintf ("mark_source_chains: bad " "negative verdict (%i)\n" , t->verdict);
PATCH 30/88 splice: fix deadlock in splicing to file
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <[email protected]>
upstream commit: 7bfac9ecf0585962fe13584f5cf526d8c8e76f17
There's a possible deadlock in generic_file_splice_write(), splice_from_pipe() and ocfs2_file_splice_write():
- task A calls generic_file_splice_write()
- this calls inode_double_lock(), which locks i_mutex on both pipe->inode and target inode
- ordering depends on inode pointers, can happen that pipe->inode is locked first
- __splice_from_pipe() needs more data, calls pipe_wait()
- this releases lock on pipe->inode, goes to interruptible sleep
- task B calls generic_file_splice_write(), similarly to the first
- this locks pipe->inode, then tries to lock inode, but that is already held by task A
- task A is interrupted, it tries to lock pipe->inode, but fails, as it is already held by task B
- ABBA deadlock
Fix this by explicitly ordering locks: the outer lock must be on target inode and the inner lock (which is later unlocked and relocked) must be on pipe->inode. This is OK, pipe inodes and target inodes form two nonoverlapping sets, generic_file_splice_write() and friends are not called with a target which is a pipe.
--- fs/ocfs2/file.c | 8 ++++++-- fs/splice.c | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-)
fs/ocfs2/file.c +6 -2
@@ -1943,7 +1943,7 @@ static ssize_t ocfs2_file_splice_write(s out->f_path.dentry->d_name.len, out->f_path.dentry->d_name.name); -inode_double_lock (inode, pipe->inode); +mutex_lock_nested (&inode->i_mutex,I_MUTEX_PARENT ); ret =ocfs2_rw_lock (inode,1 );if (ret <0 ) {
@@ -1958,12 +1958,16 @@ static ssize_t ocfs2_file_splice_write(s goto out_unlock; } +if (pipe->inode) +mutex_lock_nested (&pipe->inode->i_mutex,I_MUTEX_CHILD ); ret =generic_file_splice_write_nolock (pipe, out, ppos, len, flags); +if (pipe->inode) +mutex_unlock (&pipe->inode->i_mutex); out_unlock:ocfs2_rw_unlock (inode,1 ); out: -inode_double_unlock (inode, pipe->inode); +mutex_unlock (&inode->i_mutex);mlog_exit (ret);return ret;
fs/splice.c +20 -5
@@ -735,10 +735,19 @@ ssize_t splice_from_pipe(struct pipe_ino* ->write_end. Most of the time, these expect i_mutex to * be held. Since this may result in an ABBA deadlock with * pipe->inode, we have to order lock acquiry here. +* +* Outer lock must be inode->i_mutex, as pipe_wait() will +* release and reacquire pipe->inode->i_mutex, AND inode must +* never be a pipe. */ -inode_double_lock (inode, pipe->inode); +WARN_ON (S_ISFIFO (inode->i_mode)); +mutex_lock_nested (&inode->i_mutex,I_MUTEX_PARENT ); +if (pipe->inode) +mutex_lock_nested (&pipe->inode->i_mutex,I_MUTEX_CHILD ); ret =__splice_from_pipe (pipe, &sd, actor); -inode_double_unlock (inode, pipe->inode); +if (pipe->inode) +mutex_unlock (&pipe->inode->i_mutex); +mutex_unlock (&inode->i_mutex);return ret; }
@@ -829,11 +838,17 @@ generic_file_splice_write(struct pipe_in };ssize_t ret; -inode_double_lock (inode, pipe->inode); +WARN_ON (S_ISFIFO (inode->i_mode)); +mutex_lock_nested (&inode->i_mutex,I_MUTEX_PARENT ); ret =file_remove_suid (out); -if (likely (!ret)) +if (likely (!ret)) { +if (pipe->inode) +mutex_lock_nested (&pipe->inode->i_mutex,I_MUTEX_CHILD ); ret =__splice_from_pipe (pipe, &sd, pipe_to_file); -inode_double_unlock (inode, pipe->inode); +if (pipe->inode) +mutex_unlock (&pipe->inode->i_mutex); + } +mutex_unlock (&inode->i_mutex);if (ret >0 ) {unsigned long nr_pages;
PATCH 31/88 ALSA: hda - add missing comma in ad1884_slave_vols
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Akinobu Mita <[email protected]>
upstream commit: bca68467b59a24396554d8dd5979ee363c174854
--- sound/pci/hda/patch_analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_analog.c +1 -1
@@ -3233,7 +3233,7 @@ static const char *ad1884_slave_vols[] ="Mic Playback Volume" ,"CD Playback Volume" ,"Internal Mic Playback Volume" , -"Docking Mic Playback Volume" +"Docking Mic Playback Volume" ,"Beep Playback Volume" ,"IEC958 Playback Volume" ,NULL
PATCH 32/88 SCSI: libiscsi: fix iscsi pool error path
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
upstream commit: f474a37bc48667595b5653a983b635c95ed82a3b
Memory freeing in iscsi_pool_free() looks wrong to me. Either q->pool can be NULL and this should be tested before dereferencing it, or it can't be NULL and it shouldn't be tested at all. As far as I can see, the only case where q->pool is NULL is on early error in iscsi_pool_init(). One possible way to fix the bug is thus to not call iscsi_pool_free() in this case (nothing needs to be freed anyway) and then we can get rid of the q->pool check.
--- drivers/scsi/libiscsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/libiscsi.c +2 -3
@@ -1862,7 +1862,7 @@ iscsi_pool_init(struct iscsi_pool *q, in num_arrays++; q->pool =kzalloc (num_arrays * max *sizeof (void *),GFP_KERNEL );if (q->pool ==NULL ) - goto enomem; +return -ENOMEM ; q->queue =kfifo_init ((void *)q->pool, max *sizeof (void *),GFP_KERNEL ,NULL );
@@ -1897,8 +1897,7 @@ void iscsi_pool_free(struct iscsi_pool *for (i =0 ; i < q->max; i++)kfree (q->pool[i]); -if (q->pool) -kfree (q->pool); +kfree (q->pool);kfree (q->queue); }EXPORT_SYMBOL_GPL (iscsi_pool_free);
PATCH 33/88 SCSI: libiscsi: fix iscsi pool error path again
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jean Delvare <[email protected]>
upstream commit: fd6e1c14b73dbab89cb76af895d5612e4a8b5522
Le lundi 30 mars 2009, Chris Wright a écrit :
Quoted 3 lines
q->queuecould beERR_PTR(-ENOMEM)which will break unwinding on error. Makeiscsi_pool_freemore defensive.
Making the freeing of q->queue dependent on q->pool being set looks really weird (although it is correct at the moment. But this seems to be fixable in a much simpler way.
With the benefit that only the error case is slowed down. In both cases we have a problem if q->queue contains an error value but it's not -ENOMEM. Apparently this can't happen today, but it doesn't feel right to assume this will always be true. Maybe it's the right time to fix this as well.
--- drivers/scsi/libiscsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/libiscsi.c +3 -1
@@ -1866,8 +1866,10 @@ iscsi_pool_init(struct iscsi_pool *q, in q->queue =kfifo_init ((void *)q->pool, max *sizeof (void *),GFP_KERNEL ,NULL ); -if (q->queue ==ERR_PTR (-ENOMEM )) +if (IS_ERR (q->queue)) { + q->queue =NULL ; goto enomem; + }for (i =0 ; i < max; i++) { q->pool[i] =kzalloc (item_size,GFP_KERNEL );
PATCH 34/88 posixtimers, sched: Fix posix clock monotonicity
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hidetoshi Seto <[email protected]>
upstream commit: c5f8d99585d7b5b7e857fabf8aefd0174903a98c
Impact: Regression fix (against clock_gettime() backwarding bug)
This patch re-introduces a couple of functions, task_sched_runtime and thread_group_sched_runtime, which was once removed at the time of 2.6.28-rc1.
These functions protect the sampling of thread/process clock with rq lock. This rq lock is required not to update rq->clock during the sampling.
i.e.
The clock_gettime() may return
((accounted runtime before update) + (delta after update))
that is less than what it should be.
v2 -> v3:
- Rename static helper function __task_delta_exec() to do_task_delta_exec() since -tip tree already has a __task_delta_exec() of different version.
v1 -> v2:
- Revises comments of function and patch description.
- Add note about accuracy of thread group's runtime.
LKML-Reference: <[email protected]>
--- kernel/posix-cpu-timers.c | 7 ++-- kernel/sched.c | 65 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 11 deletions(-)
kernel/posix-cpu-timers.c +4 -3
@@ -294,7 +294,7 @@ static int cpu_clock_sample(const clocki cpu->cpu =virt_ticks (p);break ;case CPUCLOCK_SCHED : - cpu->sched = p->se.sum_exec_runtime +task_delta_exec (p); + cpu->sched =task_sched_runtime (p);break ; }return 0 ;
@@ -310,18 +310,19 @@ static int cpu_clock_sample_group(const {struct task_cputime cputime; -thread_group_cputime (p, &cputime);switch (CPUCLOCK_WHICH (which_clock)) {default :return -EINVAL ;case CPUCLOCK_PROF : +thread_group_cputime (p, &cputime); cpu->cpu =cputime_add (cputime.utime, cputime.stime);break ;case CPUCLOCK_VIRT : +thread_group_cputime (p, &cputime); cpu->cpu = cputime.utime;break ;case CPUCLOCK_SCHED : - cpu->sched = cputime.sum_exec_runtime +task_delta_exec (p); + cpu->sched =thread_group_sched_runtime (p);break ; }return 0 ;
kernel/sched.c +57 -8
82 lines not on this page · raw message
PATCH 36/88 add some long-missing capabilities to fs_mask
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Serge E. Hallyn <[email protected]>
upstream commit: 0ad30b8fd5fe798aae80df6344b415d8309342cc
When POSIX capabilities were introduced during the 2.1 Linux cycle, the fs mask, which represents the capabilities which having fsuid==0 is supposed to grant, did not include CAP_MKNOD and CAP_LINUX_IMMUTABLE. However, before capabilities the privilege to call these did in fact depend upon fsuid==0.
This patch introduces those capabilities into the fsmask, restoring the old behavior.
See the thread starting at http://lkml.org/lkml/2009/3/11/157 for reference.
Note that if this fix is deemed valid, then earlier kernel versions (2.4 and 2.2) ought to be fixed too.
Changelog:
[Mar 23] Actually delete old CAP_FS_SET definition... [Mar 20] Updated against J. Bruce Fields's patch
--- include/linux/capability.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
include/linux/capability.h +19 -4
@@ -366,7 +366,21 @@ typedef struct kernel_cap_struct {#define CAP_FOR_EACH_U32 (__capi) \ for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi) +/* +* CAP_FS_MASK and CAP_NFSD_MASKS: +* +* The fs mask is all the privileges that fsuid==0 historically meant. +* At one time in the past, that included CAP_MKNOD and CAP_LINUX_IMMUTABLE. +* +* It has never meant setting security.* and trusted.* xattrs. +* +* We could also define fsmask as follows: +* 1. CAP_FS_MASK is the privilege to bypass all fs-related DAC permissions +* 2. The security.* and trusted.* xattrs are fs-related MAC permissions +*/ +# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \ + | CAP_TO_MASK(CAP_MKNOD) \ | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ | CAP_TO_MASK(CAP_DAC_READ_SEARCH) \ | CAP_TO_MASK(CAP_FOWNER) \
@@ -381,11 +395,12 @@ typedef struct kernel_cap_struct {# define CAP_EMPTY_SET ((kernel_cap_t){{ 0, 0 }})# define CAP_FULL_SET ((kernel_cap_t){{ ~0, ~0 }})# define CAP_INIT_EFF_SET ((kernel_cap_t){{ ~CAP_TO_MASK(CAP_SETPCAP), ~0 }}) -# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0, CAP_FS_MASK_B1 } }) +# define CAP_FS_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ + | CAP_TO_MASK(CAP_LINUX_IMMUTABLE), \ + CAP_FS_MASK_B1 } })# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0 \ - | CAP_TO_MASK(CAP_SYS_RESOURCE) \ - | CAP_TO_MASK(CAP_MKNOD), \ - CAP_FS_MASK_B1 } }) + | CAP_TO_MASK(CAP_SYS_RESOURCE), \ + CAP_FS_MASK_B1 } })#endif /* _KERNEL_CAPABILITY_U32S != 2 */
PATCH 37/88 spi: spi_write_then_read() bugfixes
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Brownell <[email protected]>
upstream commit: bdff549ebeff92b1a6952e5501caf16a6f8898c8
The "simplify spi_write_then_read()" patch included two regressions from the 2.6.27 behaviors:
- The data it wrote out during the (full duplex) read side of the transfer was not zeroed.
- It fails completely on half duplex hardware, such as Microwire and most "3-wire" SPI variants.
So, revert that patch. A revised version should be submitted at some point, which can get the speedup on standard hardware (full duplex) without breaking on less-capable half-duplex stuff.
--- drivers/spi/spi.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/spi/spi.c +14 -8
@@ -660,7 +660,7 @@ int spi_write_then_read(struct spi_devicint status;struct spi_message message; -struct spi_transfer x; +struct spi_transfer x[2 ];u8 *local_buf;/* Use preallocated DMA-safe buffer. We can't avoid copying here,
@@ -671,9 +671,15 @@ int spi_write_then_read(struct spi_devicreturn -EINVAL ;spi_message_init (&message); -memset (&x,0 ,sizeof x); - x.len = n_tx + n_rx; -spi_message_add_tail (&x, &message); +memset (x,0 ,sizeof x); +if (n_tx) { + x[0 ].len = n_tx; +spi_message_add_tail (&x[0 ], &message); + } +if (n_rx) { + x[1 ].len = n_rx; +spi_message_add_tail (&x[1 ], &message); + }/* ... unless someone else is using the pre-allocated buffer */ if (!mutex_trylock (&lock)) {
@@ -684,15 +690,15 @@ int spi_write_then_read(struct spi_devic local_buf = buf;memcpy (local_buf, txbuf, n_tx); - x.tx_buf = local_buf; - x.rx_buf = local_buf; + x[0 ].tx_buf = local_buf; + x[1 ].rx_buf = local_buf + n_tx;/* do the i/o */ status =spi_sync (spi, &message);if (status ==0 ) -memcpy (rxbuf, x.rx_buf + n_tx, n_rx); +memcpy (rxbuf, x[1 ].rx_buf, n_rx); -if (x.tx_buf == buf) +if (x[0 ].tx_buf == buf)mutex_unlock (&lock);else kfree (local_buf);
PATCH 38/88 powerpc: Fix data-corrupting bug in __futex_atomic_op
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Paul Mackerras <[email protected]>
upstream commit: 306a82881b14d950d59e0b59a55093a07d82aa9a
Richard Henderson pointed out that the powerpc __futex_atomic_op has a
bug: it will write the wrong value if the stwcx. fails and it has to retry the lwarx/stwcx. loop, since 'oparg' will have been overwritten by the result from the first time around the loop. This happens because it uses the same register for 'oparg' (an input) as it uses for the result.
This fixes it by using separate registers for 'oparg' and 'ret'.
--- arch/powerpc/include/asm/futex.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/futex.h +6 -6
@@ -27,7 +27,7 @@PPC_LONG "1b,4b,2b,4b\n" \".previous" \ : "=&r" (oldval), "=&r" (ret) \ - : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \ +: " b" (uaddr), " i" (-EFAULT), " r" (oparg) \ : "cr0", "memory") static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
@@ -47,19 +47,19 @@ static inline int futex_atomic_op_inuserswitch (op) {case FUTEX_OP_SET : -__futex_atomic_op ("" , ret, oldval, uaddr, oparg); +__futex_atomic_op ("mr %1,%4\n" , ret, oldval, uaddr, oparg);break ;case FUTEX_OP_ADD : -__futex_atomic_op ("add %1,%0,%1\n" , ret, oldval, uaddr, oparg); +__futex_atomic_op ("add %1,%0,%4\n" , ret, oldval, uaddr, oparg);break ;case FUTEX_OP_OR : -__futex_atomic_op ("or %1,%0,%1\n" , ret, oldval, uaddr, oparg); +__futex_atomic_op ("or %1,%0,%4\n" , ret, oldval, uaddr, oparg);break ;case FUTEX_OP_ANDN : -__futex_atomic_op ("andc %1,%0,%1\n" , ret, oldval, uaddr, oparg); +__futex_atomic_op ("andc %1,%0,%4\n" , ret, oldval, uaddr, oparg);break ;case FUTEX_OP_XOR : -__futex_atomic_op ("xor %1,%0,%1\n" , ret, oldval, uaddr, oparg); +__futex_atomic_op ("xor %1,%0,%4\n" , ret, oldval, uaddr, oparg);break ;default : ret = -ENOSYS ;
PATCH 39/88 hpt366: fix HPT370 DMA timeouts
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sergei Shtylyov <[email protected]>
upstream commit: c018f1ee5cf81e58b93d9e93a2ee39cad13dc1ac
The big driver change in 2.4.19-rc1 introduced a regression for many HPT370[A] chips -- DMA stopped to work completely, only causing endless timeouts...
The culprit has been identified (at last!): it turned to be the code resetting the DMA state machine before each transfer. Stop doing it now as this counter- measure has clearly caused more harm than good.
This should fix the kernel.org bug #7703.
--- drivers/ide/hpt366.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ide/hpt366.c +3 -1
@@ -114,6 +114,8 @@* the register setting lists into the table indexed by the clock selected * - set the correct hwif->ultra_mask for each individual chip * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards +* - stop resetting HPT370's state machine before each DMA transfer as that has +* caused more harm than good * Sergei Shtylyov, <[email protected]> or <[email protected]> */
@@ -133,7 +135,7 @@#define DRV_NAME "hpt366"/* various tuning parameters */ -#define HPT_RESET_STATE_ENGINE +#undef HPT_RESET_STATE_ENGINE#undef HPT_DELAY_INTERRUPT#define HPT_SERIALIZE_IO 0
PATCH 40/88 pata_hpt37x: fix HPT370 DMA timeouts
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sergei Shtylyov <[email protected]>
upstream commit: 265b7215aed36941620b65ecfff516200fb190c1
The libata driver has copied the code from the IDE driver which caused a post 2.4.18 regression on many HPT370[A] chips -- DMA stopped to work completely, only causing timeouts. Now remove hpt370_bmdma_start() for good...
--- drivers/ata/pata_hpt37x.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
drivers/ata/pata_hpt37x.c +2 -20
@@ -8,7 +8,7 @@* Copyright (C) 1999-2003 Andre Hedrick <[email protected]> * Portions Copyright (C) 2001 Sun Microsystems, Inc. * Portions Copyright (C) 2003 Red Hat Inc -* Portions Copyright (C) 2005-2007 MontaVista Software, Inc. +* Portions Copyright (C) 2005-2009 MontaVista Software, Inc. * * TODO * Look into engine reset on timeout errors. Should not be required.
@@ -24,7 +24,7 @@#include <linux/libata.h> #define DRV_NAME "pata_hpt37x" -#define DRV_VERSION "0.6.11" +#define DRV_VERSION "0.6.12"struct hpt_clock {u8 xfer_speed;
@@ -445,23 +445,6 @@ static void hpt370_set_dmamode(struct at }/** -* hpt370_bmdma_start - DMA engine begin -* @qc: ATA command -* -* The 370 and 370A want us to reset the DMA engine each time we -* use it. The 372 and later are fine. -*/ - -static void hpt370_bmdma_start (struct ata_queued_cmd *qc) -{ -struct ata_port *ap = qc->ap; -struct pci_dev *pdev =to_pci_dev (ap->host->dev); -pci_write_config_byte (pdev,0x50 +4 * ap->port_no,0x37 ); -udelay (10 ); -ata_bmdma_start (qc); -} - -/** * hpt370_bmdma_end - DMA engine stop * @qc: ATA command *
@@ -598,7 +581,6 @@ static struct scsi_host_template hpt37x_static struct ata_port_operations hpt370_port_ops = { .inherits = &ata_bmdma_port_ops, - .bmdma_start = hpt370_bmdma_start, .bmdma_stop = hpt370_bmdma_stop, .mode_filter = hpt370_filter,
PATCH 41/88 mm: pass correct mm when growing stack
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
upstream commit: 05fa199d45c54a9bda7aa3ae6537253d6f097aa9
Tetsuo Handa reports seeing the WARN_ON(current->mm == NULL) in security_vm_enough_memory(), when do_execve() is touching the target mm's stack, to set up its args and environment.
Yes, a UMH_NO_WAIT or UMH_WAIT_PROC call_usermodehelper() spawns an mm-less kernel thread to do the exec. And in any case, that vm_enough_memory check when growing stack ought to be done on the target mm, not on the execer's mm (though apart from the warning, it only makes a slight tweak to OVERCOMMIT_NEVER behaviour).
--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -1
@@ -1580,7 +1580,7 @@ static int acct_stack_growth(struct vm_a* Overcommit.. This must be the final test, as it will * update security statistics. */ -if (security_vm_enough_memory (grow)) +if (security_vm_enough_memory_mm (mm, grow))return -ENOMEM ;/* Ok, everything looks good - let it rip */
PATCH 42/88 SCSI: sg: fix races during device removal
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tony Battersby <[email protected]>
upstream commit: c6517b7942fad663cc1cf3235cbe4207cf769332
sg has the following problems related to device removal:
* opening a sg fd races with removing a device
* closing a sg fd races with removing a device
* /proc/scsi/sg/* access races with removing a device
* command completion races with removing a device
* command completion races with closing a sg fd
* can rmmod sg with active commands
These problems can cause kernel oopses, memory-use-after-free, or double-free errors. This patch fixes these problems by using krefs to manage the lifetime of sg_device and sg_fd.
Each command submitted to the midlevel holds a reference to sg_fd until the completion callback. This ensures that sg_fd doesn't go away if the fd is closed with commands still outstanding.
sg_fd gets the reference of sg_device (with scsi_device) and also makes sure that the sg module doesn't go away.
/proc/scsi/sg/* functions don't play nicely with krefs because they give information about sg_fds which have been closed but not yet freed due to still having outstanding commands and sg_devices which have been removed but not yet freed due to still being referenced by one or more sg_fds. To deal with this safely without removing functionality, /proc functions now access sg_device and sg_fd while holding a lock instead of using kref_get()/kref_put().
--- drivers/scsi/sg.c | 418 +++++++++++++++++++++++++----------------------------- 1 file changed, 201 insertions(+), 217 deletions(-)
drivers/scsi/sg.c +201 -217
@@ -101,6 +101,7 @@ static int scatter_elem_sz_prev = SG_SCA#define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)static int sg_add (struct device *,struct class_interface *); +static void sg_device_destroy (struct kref *kref);static void sg_remove (struct device *,struct class_interface *);static DEFINE_IDR (sg_index_idr);
@@ -158,6 +159,8 @@ typedef struct sg_fd { /* holds the stachar next_cmd_len;/* 0 -> automatic (def), >0 -> use on next write() */ char keep_orphan;/* 0 -> drop orphan (def), 1 -> keep for read() */ char mmap_called;/* 0 -> mmap() never called on this fd */ +struct kref f_ref; +struct execute_work ew; } Sg_fd; typedef struct sg_device { /* holds the state of each scsi generic device */
@@ -171,6 +174,7 @@ typedef struct sg_device { /* holds thechar sgdebug;/* 0->off, 1->sense, 9->dump dev, 10-> all devs */ struct gendisk *disk;struct cdev * cdev;/* char_dev [sysfs: /sys/cdev/major/sg<n>] */ +struct kref d_ref; } Sg_device;static int sg_fasync (int fd,struct file *filp,int mode);
@@ -194,13 +198,14 @@ static void sg_build_reserve(Sg_fd * sfpstatic void sg_link_reserve (Sg_fd * sfp,Sg_request * srp,int size);static void sg_unlink_reserve (Sg_fd * sfp,Sg_request * srp);static Sg_fd *sg_add_sfp (Sg_device * sdp,int dev); -static int sg_remove_sfp (Sg_device * sdp,Sg_fd * sfp); -static void __sg_remove_sfp (Sg_device * sdp,Sg_fd * sfp); +static void sg_remove_sfp (struct kref *);static Sg_request *sg_get_rq_mark (Sg_fd * sfp,int pack_id);static Sg_request *sg_add_request (Sg_fd * sfp);static int sg_remove_request (Sg_fd * sfp,Sg_request * srp);static int sg_res_in_use (Sg_fd * sfp); +static Sg_device *sg_lookup_dev (int dev);static Sg_device *sg_get_dev (int dev); +static void sg_put_dev (Sg_device *sdp);#ifdef CONFIG_SCSI_PROC_FS static int sg_last_dev (void );#endif
@@ -237,22 +242,17 @@ sg_open(struct inode *inode, struct filenonseekable_open (inode, filp);SCSI_LOG_TIMEOUT (3 ,printk ("sg_open: dev=%d, flags=0x%x\n" , dev, flags)); sdp =sg_get_dev (dev); -if ((!sdp) || (!sdp->device)) { -unlock_kernel (); -return -ENXIO ; - } -if (sdp->detached) { -unlock_kernel (); -return -ENODEV ; +if (IS_ERR (sdp)) { + retval =PTR_ERR (sdp); + sdp =NULL ; + goto sg_put; }/* This driver's module count bumped by fops_get in <linux/fs.h> */ /* Prevent the device driver from vanishing while we sleep */ retval =scsi_device_get (sdp->device); -if (retval) { -unlock_kernel (); -return retval; - } +if (retval) + goto sg_put;if (!((flags &O_NONBLOCK ) ||scsi_block_when_processing_errors (sdp->device))) {
@@ -303,16 +303,20 @@ sg_open(struct inode *inode, struct fileif ((sfp =sg_add_sfp (sdp, dev))) filp->private_data = sfp;else { -if (flags &O_EXCL ) +if (flags &O_EXCL ) { sdp->exclude =0 ;/* undo if error */ +wake_up_interruptible (&sdp->o_excl_wait); + } retval = -ENOMEM ; goto error_out; } -unlock_kernel (); -return 0 ; - - error_out: -scsi_device_put (sdp->device); + retval =0 ; +error_out: +if (retval) +scsi_device_put (sdp->device); +sg_put: +if (sdp) +sg_put_dev (sdp);unlock_kernel ();return retval; }
@@ -327,13 +331,13 @@ sg_release(struct inode *inode, struct fif ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))return -ENXIO ;SCSI_LOG_TIMEOUT (3 ,printk ("sg_release: %s\n" , sdp->disk->disk_name)); -if (0 ==sg_remove_sfp (sdp, sfp)) {/* Returns 1 when sdp gone */ -if (!sdp->detached) { -scsi_device_put (sdp->device); - } - sdp->exclude =0 ; -wake_up_interruptible (&sdp->o_excl_wait); - } + + sfp->closed =1 ; + + sdp->exclude =0 ; +wake_up_interruptible (&sdp->o_excl_wait); + +kref_put (&sfp->f_ref, sg_remove_sfp);return 0 ; }
@@ -755,6 +759,7 @@ sg_common_write(Sg_fd * sfp, Sg_request hp->duration =jiffies_to_msecs (jiffies); srp->rq->timeout = timeout; +kref_get (&sfp->f_ref);/* sg_rq_end_io() does kref_put(). */ blk_execute_rq_nowait (sdp->device->request_queue, sdp->disk, srp->rq,1 , sg_rq_end_io);return 0 ;
@@ -1247,24 +1252,23 @@ sg_mmap(struct file *filp, struct vm_arestatic void sg_rq_end_io (struct request *rq,int uptodate) {struct sg_request *srp = rq->end_io_data; -Sg_device *sdp =NULL ; +Sg_device *sdp;Sg_fd *sfp;unsigned long iflags;unsigned int ms;char *sense; -int result, resid; +int result, resid, done =1 ; -if (NULL == srp) { -printk (KERN_ERR "sg_cmd_done: NULL request\n" ); +if (WARN_ON (srp->done !=0 ))return ; - } + sfp = srp->parentfp; -if (sfp) - sdp = sfp->parentdp; -if ((NULL == sdp) || sdp->detached) { -printk (KERN_INFO "sg_cmd_done: device detached\n" ); +if (WARN_ON (sfp ==NULL ))return ; - } + + sdp = sfp->parentdp; +if (unlikely (sdp->detached)) +printk (KERN_INFO "sg_rq_end_io: device detached\n" ); sense = rq->sense; result = rq->errors;
@@ -1303,33 +1307,26 @@ static void sg_rq_end_io(struct request }/* Rely on write phase to clean out srp status values, so no "else" */ -if (sfp->closed) {/* whoops this fd already released, cleanup */ -SCSI_LOG_TIMEOUT (1 ,printk ("sg_cmd_done: already closed, freeing ...\n" )); -sg_finish_rem_req (srp); - srp =NULL ; -if (NULL == sfp->headrp) { -SCSI_LOG_TIMEOUT (1 ,printk ("sg_cmd_done: already closed, final cleanup\n" )); -if (0 ==sg_remove_sfp (sdp, sfp)) {/* device still present */ -scsi_device_put (sdp->device); - } - sfp =NULL ; - } - }else if (srp && srp->orphan) { +write_lock_irqsave (&sfp->rq_list_lock, iflags); +if (unlikely (srp->orphan)) {if (sfp->keep_orphan) srp->sg_io_owned =0 ; -else { -sg_finish_rem_req (srp); - srp =NULL ; - } +else + done =0 ; } -if (sfp && srp) { -/* Now wake up any sg_read() that is waiting for this packet. */ -kill_fasync (&sfp->async_qp,SIGPOLL ,POLL_IN ); -write_lock_irqsave (&sfp->rq_list_lock, iflags); - srp->done =1 ; + srp->done = done; +write_unlock_irqrestore (&sfp->rq_list_lock, iflags); + +if (likely (done)) { +/* Now wake up any sg_read() that is waiting for this +* packet. +*/ wake_up_interruptible (&sfp->read_wait); -write_unlock_irqrestore (&sfp->rq_list_lock, iflags); - } +kill_fasync (&sfp->async_qp,SIGPOLL ,POLL_IN ); + }else +sg_finish_rem_req (srp);/* call with srp->done == 0 */ + +kref_put (&sfp->f_ref, sg_remove_sfp); }static struct file_operations sg_fops = {
@@ -1364,17 +1361,18 @@ static Sg_device *sg_alloc(struct gendisprintk (KERN_WARNING "kmalloc Sg_device failure\n" );return ERR_PTR (-ENOMEM ); } - error = -ENOMEM ; +if (!idr_pre_get (&sg_index_idr,GFP_KERNEL )) {printk (KERN_WARNING "idr expansion Sg_device failure\n" ); + error = -ENOMEM ; goto out; }write_lock_irqsave (&sg_index_lock, iflags); - error =idr_get_new (&sg_index_idr, sdp, &k); -write_unlock_irqrestore (&sg_index_lock, iflags); + error =idr_get_new (&sg_index_idr, sdp, &k);if (error) { +write_unlock_irqrestore (&sg_index_lock, iflags);printk (KERN_WARNING "idr allocation Sg_device failure: %d\n" , error); goto out;
@@ -1391,6 +1389,9 @@ static Sg_device *sg_alloc(struct gendisinit_waitqueue_head (&sdp->o_excl_wait); sdp->sg_tablesize =min (q->max_hw_segments, q->max_phys_segments); sdp->index = k; +kref_init (&sdp->d_ref); + +write_unlock_irqrestore (&sg_index_lock, iflags); error =0 ; out:
@@ -1401,6 +1402,8 @@ static Sg_device *sg_alloc(struct gendisreturn sdp; overflow: +idr_remove (&sg_index_idr, k); +write_unlock_irqrestore (&sg_index_lock, iflags);sdev_printk (KERN_WARNING , scsidp,"Unable to attach sg device type=%d, minor " "number exceeds %d\n" , scsidp->type,SG_MAX_DEVS -1 );
@@ -1488,49 +1491,46 @@ out:return error; } -static void -sg_remove (struct device *cl_dev,struct class_interface *cl_intf) +static void sg_device_destroy (struct kref *kref) +{ + struct sg_device *sdp = container_of(kref, struct sg_device, d_ref); +unsigned long flags; + +/* CAUTION! Note that the device can still be found via idr_find() +* even though the refcount is 0. Therefore, do idr_remove() BEFORE +* any other cleanup. +*/ + +write_lock_irqsave (&sg_index_lock, flags); +idr_remove (&sg_index_idr, sdp->index); +write_unlock_irqrestore (&sg_index_lock, flags); + +SCSI_LOG_TIMEOUT (3 , +printk ("sg_device_destroy: %s\n" , + sdp->disk->disk_name)); + +put_disk (sdp->disk); +kfree (sdp); +} + +static void sg_remove (struct device *cl_dev,struct class_interface *cl_intf) {struct scsi_device *scsidp =to_scsi_device (cl_dev->parent);Sg_device *sdp =dev_get_drvdata (cl_dev);unsigned long iflags;Sg_fd *sfp; -Sg_fd *tsfp; -Sg_request *srp; -Sg_request *tsrp; -int delay; -if (!sdp) +if (!sdp || sdp->detached)return ; - delay =0 ; +SCSI_LOG_TIMEOUT (3 ,printk ("sg_remove: %s\n" , sdp->disk->disk_name)); + +/* Need a write lock to set sdp->detached. */ write_lock_irqsave (&sg_index_lock, iflags); -if (sdp->headfp) { - sdp->detached =1 ; -for (sfp = sdp->headfp; sfp; sfp = tsfp) { - tsfp = sfp->nextfp; -for (srp = sfp->headrp; srp; srp = tsrp) { - tsrp = srp->nextrp; -if (sfp->closed || (0 ==sg_srp_done (srp, sfp))) -sg_finish_rem_req (srp); - } -if (sfp->closed) { -scsi_device_put (sdp->device); -__sg_remove_sfp (sdp, sfp); - }else { - delay =1 ; -wake_up_interruptible (&sfp->read_wait); -kill_fasync (&sfp->async_qp,SIGPOLL , -POLL_HUP ); - } - } -SCSI_LOG_TIMEOUT (3 ,printk ("sg_remove: dev=%d, dirty\n" , sdp->index)); -if (NULL == sdp->headfp) { -idr_remove (&sg_index_idr, sdp->index); - } - }else {/* nothing active, simple case */ -SCSI_LOG_TIMEOUT (3 ,printk ("sg_remove: dev=%d\n" , sdp->index)); -idr_remove (&sg_index_idr, sdp->index); + sdp->detached =1 ; +for (sfp = sdp->headfp; sfp; sfp = sfp->nextfp) { +wake_up_interruptible (&sfp->read_wait); +kill_fasync (&sfp->async_qp,SIGPOLL ,POLL_HUP ); }write_unlock_irqrestore (&sg_index_lock, iflags);
@@ -1538,13 +1538,8 @@ sg_remove(struct device *cl_dev, structdevice_destroy (sg_sysfs_class,MKDEV (SCSI_GENERIC_MAJOR , sdp->index));cdev_del (sdp->cdev); sdp->cdev =NULL ; -put_disk (sdp->disk); - sdp->disk =NULL ; -if (NULL == sdp->headfp) -kfree (sdp); -if (delay) -msleep (10 );/* dirty detach so delay device destruction */ +sg_put_dev (sdp); }module_param_named (scatter_elem_sz, scatter_elem_sz, int,S_IRUGO |S_IWUSR );
@@ -1939,22 +1934,6 @@ sg_get_rq_mark(Sg_fd * sfp, int pack_id)return resp; } -#ifdef CONFIG_SCSI_PROC_FS -static Sg_request * -sg_get_nth_request (Sg_fd * sfp,int nth) -{ -Sg_request *resp; -unsigned long iflags; -int k; - -read_lock_irqsave (&sfp->rq_list_lock, iflags); -for (k =0 , resp = sfp->headrp; resp && (k < nth); - ++k, resp = resp->nextrp) ; -read_unlock_irqrestore (&sfp->rq_list_lock, iflags); -return resp; -} -#endif -/* always adds to end of list */ static Sg_request *sg_add_request (Sg_fd * sfp)
@@ -2030,22 +2009,6 @@ sg_remove_request(Sg_fd * sfp, Sg_requesreturn res; } -#ifdef CONFIG_SCSI_PROC_FS -static Sg_fd * -sg_get_nth_sfp (Sg_device * sdp,int nth) -{ -Sg_fd *resp; -unsigned long iflags; -int k; - -read_lock_irqsave (&sg_index_lock, iflags); -for (k =0 , resp = sdp->headfp; resp && (k < nth); - ++k, resp = resp->nextfp) ; -read_unlock_irqrestore (&sg_index_lock, iflags); -return resp; -} -#endif -static Sg_fd *sg_add_sfp (Sg_device * sdp,int dev) {
@@ -2060,6 +2023,7 @@ sg_add_sfp(Sg_device * sdp, int dev)init_waitqueue_head (&sfp->read_wait);rwlock_init (&sfp->rq_list_lock); +kref_init (&sfp->f_ref); sfp->timeout =SG_DEFAULT_TIMEOUT ; sfp->timeout_user =SG_DEFAULT_TIMEOUT_USER ; sfp->force_packid =SG_DEF_FORCE_PACK_ID ;
@@ -2087,15 +2051,54 @@ sg_add_sfp(Sg_device * sdp, int dev)sg_build_reserve (sfp, bufflen);SCSI_LOG_TIMEOUT (3 ,printk ("sg_add_sfp: bufflen=%d, k_use_sg=%d\n" , sfp->reserve.bufflen, sfp->reserve.k_use_sg)); + +kref_get (&sdp->d_ref); +__module_get (THIS_MODULE );return sfp; } -static void -__sg_remove_sfp (Sg_device * sdp,Sg_fd * sfp) +static void sg_remove_sfp_usercontext (struct work_struct *work) +{ + struct sg_fd *sfp = container_of(work, struct sg_fd, ew.work); +struct sg_device *sdp = sfp->parentdp; + +/* Cleanup any responses which were never read(). */ +while (sfp->headrp) +sg_finish_rem_req (sfp->headrp); + +if (sfp->reserve.bufflen >0 ) { +SCSI_LOG_TIMEOUT (6 , +printk ("sg_remove_sfp: bufflen=%d, k_use_sg=%d\n" , + (int ) sfp->reserve.bufflen, + (int ) sfp->reserve.k_use_sg)); +sg_remove_scat (&sfp->reserve); + } + +SCSI_LOG_TIMEOUT (6 , +printk ("sg_remove_sfp: %s, sfp=0x%p\n" , + sdp->disk->disk_name, + sfp)); +kfree (sfp); + +scsi_device_put (sdp->device); +sg_put_dev (sdp); +module_put (THIS_MODULE ); +} + +static void sg_remove_sfp (struct kref *kref) { + struct sg_fd *sfp = container_of(kref, struct sg_fd, f_ref); +struct sg_device *sdp = sfp->parentdp;Sg_fd *fp;Sg_fd *prev_fp; +unsigned long iflags; + +/* CAUTION! Note that sfp can still be found by walking sdp->headfp +* even though the refcount is now 0. Therefore, unlink sfp from +* sdp->headfp BEFORE doing any other cleanup. +*/ +write_lock_irqsave (&sg_index_lock, iflags); prev_fp = sdp->headfp;if (sfp == prev_fp) sdp->headfp = prev_fp->nextfp;
@@ -2108,54 +2111,10 @@ __sg_remove_sfp(Sg_device * sdp, Sg_fd * prev_fp = fp; } } -if (sfp->reserve.bufflen >0 ) { -SCSI_LOG_TIMEOUT (6 , -printk ("__sg_remove_sfp: bufflen=%d, k_use_sg=%d\n" , - (int ) sfp->reserve.bufflen, (int ) sfp->reserve.k_use_sg)); -sg_remove_scat (&sfp->reserve); - } - sfp->parentdp =NULL ; -SCSI_LOG_TIMEOUT (6 ,printk ("__sg_remove_sfp: sfp=0x%p\n" , sfp)); -kfree (sfp); -} - -/* Returns 0 in normal case, 1 when detached and sdp object removed */ -static int -sg_remove_sfp (Sg_device * sdp,Sg_fd * sfp) -{ -Sg_request *srp; -Sg_request *tsrp; -int dirty =0 ; -int res =0 ; - -for (srp = sfp->headrp; srp; srp = tsrp) { - tsrp = srp->nextrp; -if (sg_srp_done (srp, sfp)) -sg_finish_rem_req (srp); -else - ++dirty; - } -if (0 == dirty) { -unsigned long iflags; +write_unlock_irqrestore (&sg_index_lock, iflags); +wake_up_interruptible (&sdp->o_excl_wait); -write_lock_irqsave (&sg_index_lock, iflags); -__sg_remove_sfp (sdp, sfp); -if (sdp->detached && (NULL == sdp->headfp)) { -idr_remove (&sg_index_idr, sdp->index); -kfree (sdp); - res =1 ; - } -write_unlock_irqrestore (&sg_index_lock, iflags); - }else { -/* MOD_INC's to inhibit unloading sg and associated adapter driver */ -/* only bump the access_count if we actually succeeded in -* throwing another counter on the host module */ -scsi_device_get (sdp->device);/* XXX: retval ignored? */ - sfp->closed =1 ;/* flag dirty state on this fd */ -SCSI_LOG_TIMEOUT (1 ,printk ("sg_remove_sfp: worrisome, %d writes pending\n" , - dirty)); - } -return res; +execute_in_process_context (sg_remove_sfp_usercontext, &sfp->ew); } static int
@@ -2197,19 +2156,38 @@ sg_last_dev(void) }#endif -static Sg_device * -sg_get_dev (int dev) +/* must be called with sg_index_lock held */ +static Sg_device *sg_lookup_dev (int dev) { -Sg_device *sdp; -unsigned long iflags; +return idr_find (&sg_index_idr, dev); +} -read_lock_irqsave (&sg_index_lock, iflags); - sdp =idr_find (&sg_index_idr, dev); -read_unlock_irqrestore (&sg_index_lock, iflags); +static Sg_device *sg_get_dev (int dev) +{ +struct sg_device *sdp; +unsigned long flags; + +read_lock_irqsave (&sg_index_lock, flags); + sdp =sg_lookup_dev (dev); +if (!sdp) + sdp =ERR_PTR (-ENXIO ); +else if (sdp->detached) { +/* If sdp->detached, then the refcount may already be 0, in +* which case it would be a bug to do kref_get(). +*/ + sdp =ERR_PTR (-ENODEV ); + }else +kref_get (&sdp->d_ref); +read_unlock_irqrestore (&sg_index_lock, flags);return sdp; } +static void sg_put_dev (struct sg_device *sdp) +{ +kref_put (&sdp->d_ref, sg_device_destroy); +} +#ifdef CONFIG_SCSI_PROC_FS static struct proc_dir_entry *sg_proc_sgp =NULL ;
@@ -2466,8 +2444,10 @@ static int sg_proc_seq_show_dev(struct sstruct sg_proc_deviter * it = (struct sg_proc_deviter *) v;Sg_device *sdp;struct scsi_device *scsidp; +unsigned long iflags; - sdp = it ?sg_get_dev (it->index) :NULL ; +read_lock_irqsave (&sg_index_lock, iflags); + sdp = it ?sg_lookup_dev (it->index) :NULL ;if (sdp && (scsidp = sdp->device) && (!sdp->detached)) seq_printf(s, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", scsidp->host->host_no, scsidp->channel,
@@ -2478,6 +2458,7 @@ static int sg_proc_seq_show_dev(struct s (int) scsi_device_online(scsidp)); else seq_printf(s, "-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\n"); +read_unlock_irqrestore (&sg_index_lock, iflags);return 0 ; }
@@ -2491,16 +2472,20 @@ static int sg_proc_seq_show_devstrs(strustruct sg_proc_deviter * it = (struct sg_proc_deviter *) v;Sg_device *sdp;struct scsi_device *scsidp; +unsigned long iflags; - sdp = it ?sg_get_dev (it->index) :NULL ; +read_lock_irqsave (&sg_index_lock, iflags); + sdp = it ?sg_lookup_dev (it->index) :NULL ;if (sdp && (scsidp = sdp->device) && (!sdp->detached))seq_printf (s,"%8.8s\t%16.16s\t%4.4s\n" , scsidp->vendor, scsidp->model, scsidp->rev);else seq_printf (s,"<no active device>\n" ); +read_unlock_irqrestore (&sg_index_lock, iflags);return 0 ; } +/* must be called while holding sg_index_lock */ static void sg_proc_debug_helper (struct seq_file *s,Sg_device * sdp) {int k, m, new_interface, blen, usg;
@@ -2510,7 +2495,8 @@ static void sg_proc_debug_helper(structconst char * cp;unsigned int ms; -for (k =0 ; (fp =sg_get_nth_sfp (sdp, k)); ++k) { +for (k =0 , fp = sdp->headfp; fp !=NULL ; ++k, fp = fp->nextfp) { +read_lock (&fp->rq_list_lock);/* irqs already disabled */ seq_printf(s, " FD(%d): timeout=%dms bufflen=%d " "(res)sgat=%d low_dma=%d\n", k + 1, jiffies_to_msecs(fp->timeout),
@@ -2520,7 +2506,9 @@ static void sg_proc_debug_helper(structseq_printf (s," cmd_q=%d f_packid=%d k_orphan=%d closed=%d\n" , (int ) fp->cmd_q, (int ) fp->force_packid, (int ) fp->keep_orphan, (int ) fp->closed); -for (m =0 ; (srp =sg_get_nth_request (fp, m)); ++m) { +for (m =0 , srp = fp->headrp; + srp !=NULL ; + ++m, srp = srp->nextrp) { hp = &srp->header; new_interface = (hp->interface_id =='\0' ) ?0 :1 ;if (srp->res_used) {
@@ -2557,6 +2545,7 @@ static void sg_proc_debug_helper(struct }if (0 == m)seq_printf (s," No requests active\n" ); +read_unlock (&fp->rq_list_lock); } }
@@ -2569,39 +2558,34 @@ static int sg_proc_seq_show_debug(struct {struct sg_proc_deviter * it = (struct sg_proc_deviter *) v;Sg_device *sdp; +unsigned long iflags;if (it && (0 == it->index)) {seq_printf (s,"max_active_device=%d(origin 1)\n" , (int )it->max);seq_printf (s," def_reserved_size=%d\n" , sg_big_buff); } - sdp = it ?sg_get_dev (it->index) :NULL ; -if (sdp) { -struct scsi_device *scsidp = sdp->device; -if (NULL == scsidp) { -seq_printf (s,"device %d detached ??\n" , - (int )it->index); -return 0 ; - } +read_lock_irqsave (&sg_index_lock, iflags); + sdp = it ?sg_lookup_dev (it->index) :NULL ; +if (sdp && sdp->headfp) { +struct scsi_device *scsidp = sdp->device; -if (sg_get_nth_sfp (sdp,0 )) { -seq_printf (s," >>> device=%s " , - sdp->disk->disk_name); -if (sdp->detached) -seq_printf (s,"detached pending close " ); -else -seq_printf - (s,"scsi%d chan=%d id=%d lun=%d em=%d" , - scsidp->host->host_no, - scsidp->channel, scsidp->id, - scsidp->lun, - scsidp->host->hostt->emulated); -seq_printf (s," sg_tablesize=%d excl=%d\n" , - sdp->sg_tablesize, sdp->exclude); - } +seq_printf (s," >>> device=%s " , sdp->disk->disk_name); +if (sdp->detached) +seq_printf (s,"detached pending close " ); +else +seq_printf + (s,"scsi%d chan=%d id=%d lun=%d em=%d" , + scsidp->host->host_no, + scsidp->channel, scsidp->id, + scsidp->lun, + scsidp->host->hostt->emulated); +seq_printf (s," sg_tablesize=%d excl=%d\n" , + sdp->sg_tablesize, sdp->exclude);sg_proc_debug_helper (s, sdp); } +read_unlock_irqrestore (&sg_index_lock, iflags);return 0 ; }
PATCH 43/88 SCSI: sg: fix races with ioctl(SG_IO)
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tony Battersby <[email protected]>
upstream commit: a2dd3b4cea335713b58996bb07b3abcde1175f47
sg_io_owned needs to be set before the command is sent to the midlevel; otherwise, a quickly-completing command may cause a different CPU to see "srp->done == 1 && !srp->sg_io_owned", which would lead to incorrect behavior.
Check srp->done and set srp->orphan while holding rq_list_lock to prevent races with sg_rq_end_io().
There is no need to check sfp->closed from read/write/ioctl/poll/etc. since the kernel guarantees that this won't happen.
The usefulness of sg_srp_done() was questionable before; now it is definitely not needed.
--- drivers/scsi/sg.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/scsi/sg.c +14 -25
@@ -189,7 +189,7 @@ static ssize_t sg_new_read(Sg_fd * sfp, Sg_request * srp);static ssize_t sg_new_write (Sg_fd *sfp,struct file *file,const char __user *buf,size_t count,int blocking, -int read_only,Sg_request **o_srp); +int read_only,int sg_io_owned,Sg_request **o_srp);static int sg_common_write (Sg_fd * sfp,Sg_request * srp,unsigned char *cmnd,int timeout,int blocking);static int sg_read_oxfer (Sg_request * srp,char __user *outp,int num_read_xfer);
@@ -561,7 +561,8 @@ sg_write(struct file *filp, const char _return -EFAULT ; blocking = !(filp->f_flags &O_NONBLOCK );if (old_hdr.reply_len <0 ) -return sg_new_write (sfp, filp, buf, count, blocking,0 ,NULL ); +return sg_new_write (sfp, filp, buf, count, + blocking,0 ,0 ,NULL );if (count < (SZ_SG_HEADER +6 ))return -EIO ;/* The minimum scsi command length is 6 bytes. */
@@ -642,7 +643,7 @@ sg_write(struct file *filp, const char _static ssize_t sg_new_write (Sg_fd *sfp,struct file *file,const char __user *buf, -size_t count,int blocking,int read_only, +size_t count,int blocking,int read_only,int sg_io_owned,Sg_request **o_srp) {int k;
@@ -662,6 +663,7 @@ sg_new_write(Sg_fd *sfp, struct file *fiSCSI_LOG_TIMEOUT (1 ,printk ("sg_new_write: queue full\n" ));return -EDOM ; } + srp->sg_io_owned = sg_io_owned; hp = &srp->header;if (__copy_from_user (hp, buf,SZ_SG_IO_HDR )) {sg_remove_request (sfp, srp);
@@ -766,18 +768,6 @@ sg_common_write(Sg_fd * sfp, Sg_request }static int -sg_srp_done (Sg_request *srp,Sg_fd *sfp) -{ -unsigned long iflags; -int done; - -read_lock_irqsave (&sfp->rq_list_lock, iflags); - done = srp->done; -read_unlock_irqrestore (&sfp->rq_list_lock, iflags); -return done; -} - -static int sg_ioctl (struct inode *inode,struct file *filp,unsigned int cmd_in,unsigned long arg) {
@@ -809,27 +799,26 @@ sg_ioctl(struct inode *inode, struct filreturn -EFAULT ; result =sg_new_write (sfp, filp, p,SZ_SG_IO_HDR , - blocking, read_only, &srp); + blocking, read_only,1 , &srp);if (result <0 )return result; - srp->sg_io_owned =1 ;while (1 ) { result =0 ;/* following macro to beat race condition */ __wait_event_interruptible (sfp->read_wait, - (sdp->detached || sfp->closed ||sg_srp_done (srp, sfp)), - result); + (srp->done || sdp->detached), + result);if (sdp->detached)return -ENODEV ; -if (sfp->closed) -return 0 ;/* request packet dropped already */ -if (0 == result) +write_lock_irq (&sfp->rq_list_lock); +if (srp->done) { + srp->done =2 ; +write_unlock_irq (&sfp->rq_list_lock);break ; + } srp->orphan =1 ; +write_unlock_irq (&sfp->rq_list_lock);return result;/* -ERESTARTSYS because signal hit process */ } -write_lock_irqsave (&sfp->rq_list_lock, iflags); - srp->done =2 ; -write_unlock_irqrestore (&sfp->rq_list_lock, iflags); result =sg_new_read (sfp, p,SZ_SG_IO_HDR , srp);return (result <0 ) ? result :0 ; }
PATCH 44/88 SCSI: sg: avoid blk_put_request/blk_rq_unmap_user in interrupt
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: FUJITA Tomonori <[email protected]>
upstream commit: c96952ed7031e7c576ecf90cf95b8ec099d5295a
This fixes the following oops:
http://marc.info/?l=linux-kernel&m=123316111415677&w=2
You can reproduce this bug by interrupting a program before a sg response completes. This leads to the special sg state (the orphan state), then sg calls blk_put_request in interrupt (rq->end_io).
The above bug report shows the recursive lock problem because sg calls blk_put_request in interrupt. We could call __blk_put_request here instead however we also need to handle blk_rq_unmap_user here, which can't be called in interrupt too.
In the orphan state, we don't need to care about the data transfer (the program revoked the command) so adding 'just free the resource' mode to blk_rq_unmap_user is a possible option.
I prefer to avoid complicating the blk mapping API when possible. I change the orphan state to call sg_finish_rem_req via execute_in_process_context. We hold sg_fd->kref so sg_fd doesn't go away until keventd_wq finishes our work. copy_from_user/to_user fails so blk_rq_unmap_user just frees the resource without the data transfer.
--- drivers/scsi/sg.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/scsi/sg.c +12 -3
@@ -138,6 +138,7 @@ typedef struct sg_request { /* SG_MAX_QUvolatile char done;/* 0->before bh, 1->before read, 2->read */ struct request *rq;struct bio *bio; +struct execute_work ew; } Sg_request; typedef struct sg_fd { /* holds the state of a file descriptor */
@@ -1234,6 +1235,15 @@ sg_mmap(struct file *filp, struct vm_arereturn 0 ; } +static void sg_rq_end_io_usercontext (struct work_struct *work) +{ + struct sg_request *srp = container_of(work, struct sg_request, ew.work); +struct sg_fd *sfp = srp->parentfp; + +sg_finish_rem_req (srp); +kref_put (&sfp->f_ref, sg_remove_sfp); +} +/* * This function is a "bottom half" handler that is called by the mid * level when a command is completed (or has failed).
@@ -1312,10 +1322,9 @@ static void sg_rq_end_io(struct request*/ wake_up_interruptible (&sfp->read_wait);kill_fasync (&sfp->async_qp,SIGPOLL ,POLL_IN ); +kref_put (&sfp->f_ref, sg_remove_sfp); }else -sg_finish_rem_req (srp);/* call with srp->done == 0 */ - -kref_put (&sfp->f_ref, sg_remove_sfp); +execute_in_process_context (sg_rq_end_io_usercontext, &srp->ew); }static struct file_operations sg_fops = {
PATCH 45/88 usb gadget: fix ethernet link reports to ethtool
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jonathan McDowell <[email protected]>
upstream commit: 237e75bf1e558f7330f8deb167fa3116405bef2c
The g_ether USB gadget driver currently decides whether or not there's a link to report back for eth_get_link based on if the USB link speed is set. The USB gadget speed is however often set even before the device is enumerated. It seems more sensible to only report a "link" if we're actually connected to a host that wants to talk to us. The patch below does this for me - tested with the PXA27x UDC driver.
--- drivers/usb/gadget/u_ether.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/usb/gadget/u_ether.c +1 -7
@@ -175,12 +175,6 @@ static void eth_get_drvinfo(struct net_dstrlcpy (p->bus_info,dev_name (&dev->gadget->dev),sizeof p->bus_info); } -static u32 eth_get_link (struct net_device *net) -{ -struct eth_dev *dev =netdev_priv (net); -return dev->gadget->speed !=USB_SPEED_UNKNOWN ; -} -/* REVISIT can also support: * - WOL (by tracking suspends and issuing remote wakeup) * - msglevel (implies updated messaging)
@@ -189,7 +183,7 @@ static u32 eth_get_link(struct net_devicstatic struct ethtool_ops ops = { .get_drvinfo = eth_get_drvinfo, - .get_link = eth_get_link + .get_link = ethtool_op_get_link, };static void defer_kevent (struct eth_dev *dev,int flag)
PATCH 46/88 USB: ftdi_sio: add vendor/project id for JETI specbos 1201 spectrometer
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Peter Korsgaard <[email protected]>
upstream commit: ae27d84351f1f3568118318a8c40ff3a154bd629
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio.h | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -665,6 +665,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(DE_VID, WHT_PID) }, { USB_DEVICE(ADI_VID, ADI_GNICE_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio.h +7 -0
@@ -901,6 +901,13 @@#define ADI_GNICE_PID 0xF000/* +* JETI SPECTROMETER SPECBOS 1201 +* http://www.jeti.com/products/sys/scb/scb1201.php +*/ +#define JETI_VID 0x0c6c +#define JETI_SPC1201_PID 0x04b2 + +/* * BmRequestType: 1100 0000b * bRequest: FTDI_E2_READ * wValue: 0
PATCH 47/88 USB: fix oops in cdc-wdm in case of malformed descriptors
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oliver Neukum <[email protected]>
upstream commit: e13c594f3a1fc2c78e7a20d1a07974f71e4b448f
cdc-wdm needs to ignore extremely malformed descriptors.
--- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +1 -1
@@ -652,7 +652,7 @@ next_desc: iface = &intf->altsetting[0 ]; ep = &iface->endpoint[0 ].desc; -if (!usb_endpoint_is_int_in (ep)) { +if (!ep || !usb_endpoint_is_int_in (ep)) { rv = -EINVAL ; goto err; }
PATCH 48/88 USB: usb-storage: augment unusual_devs entry for Simple Tech/Datafab
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
upstream commit: e4813eec8d47c8299d968bd5349dc881fa481c26
This patch (as1227) adds the MAX_SECTORS_64 flag to the unusual_devs entry for the Simple Tech/Datafab controller. This fixes Bugzilla #12882.
--- drivers/usb/storage/unusual_devs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/storage/unusual_devs.h +4 -2
@@ -1164,12 +1164,14 @@ UNUSUAL_DEV( 0x07c4, 0xa400, 0x0000, 0x US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY ), -/* Reported by Rauch Wolke <[email protected]> */ +/* Reported by Rauch Wolke <[email protected]> +* and augmented by binbin <[email protected]> (Bugzilla #12882) +*/ UNUSUAL_DEV (0x07c4 ,0xa4a5 ,0x0000 ,0xffff ,"Simple Tech/Datafab" ,"CF+SM Reader" ,US_SC_DEVICE ,US_PR_DEVICE ,NULL , - US_FL_IGNORE_RESIDUE ), + US_FL_IGNORE_RESIDUE | US_FL_MAX_SECTORS_64 ),/* Casio QV 2x00/3x00/4000/8000 digital still cameras are not conformant * to the USB storage specification in two ways:
PATCH 49/88 Input: gameport - fix attach driver code
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dmitry Torokhov <[email protected]>
upstream commit: 4ced8e7cb990a2c3bbf0ac7f27b35c890e7ce895
The commit 6902c0bead4ce266226fc0c5b3828b850bdc884a that moved driver registration out of kgameportd thread was incomplete and did not add the code necessary to actually attach driver to already registered devices, rectify that.
--- drivers/input/gameport/gameport.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/input/gameport/gameport.c +6 -8
@@ -50,9 +50,8 @@ static LIST_HEAD(gameport_list);static struct bus_type gameport_bus; -static void gameport_add_driver (struct gameport_driver *drv);static void gameport_add_port (struct gameport *gameport); -static void gameport_destroy_port (struct gameport *gameport); +static void gameport_attach_driver (struct gameport_driver *drv);static void gameport_reconnect_port (struct gameport *gameport);static void gameport_disconnect_port (struct gameport *gameport);
@@ -230,7 +229,6 @@ static void gameport_find_driver(structenum gameport_event_type {GAMEPORT_REGISTER_PORT , -GAMEPORT_REGISTER_DRIVER ,GAMEPORT_ATTACH_DRIVER , };
@@ -374,8 +372,8 @@ static void gameport_handle_event(void)gameport_add_port (event->object);break ; -case GAMEPORT_REGISTER_DRIVER : -gameport_add_driver (event->object); +case GAMEPORT_ATTACH_DRIVER : +gameport_attach_driver (event->object);break ;default :
@@ -707,14 +705,14 @@ static int gameport_driver_remove(structreturn 0 ; } -static void gameport_add_driver (struct gameport_driver *drv) +static void gameport_attach_driver (struct gameport_driver *drv) {int error; - error =driver_register (&drv->driver); + error =driver_attach (&drv->driver);if (error)printk (KERN_ERR -"gameport: driver_register() failed for %s, error: %d\n" , +"gameport: driver_attach() failed for %s, error: %d\n" , drv->driver.name, error); }
PATCH 50/88 r8169: Reset IntrStatus after chip reset
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Francois Romieu <[email protected]>
upstream commit: d78ad8cbfe73ad568de38814a75e9c92ad0a907c
Original comment (Karsten):
On a MSI MS-6702E mainboard, when in rtl8169_init_one() for the first time after BIOS has run, IntrStatus reads 5 after chip has been reset. IntrStatus should equal 0 there, so patch changes IntrStatus reset to happen after chip reset instead of before.
Remark (Francois):
Assuming that the loglevel of the driver is increased above NETIF_MSG_INTR, the bug reveals itself with a typical "interrupt 0025 in poll" message at startup. In retrospect, the message should had been read as an hint of an unexpected hardware state several months ago :o(
Fixes (at least part of) https://bugzilla.redhat.com/show_bug.cgi?id=460747
--- drivers/net/r8169.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/r8169.c +3 -2
@@ -2026,8 +2026,7 @@ rtl8169_init_one(struct pci_dev *pdev, cif (!tp->pcie_cap &&netif_msg_probe (tp))dev_info (&pdev->dev,"no PCI Express capability\n" ); -/* Unneeded ? Don't mess with Mrs. Murphy. */ -rtl8169_irq_mask_and_ack (ioaddr); +RTL_W16 (IntrMask,0x0000 );/* Soft reset the chip. */ RTL_W8 (ChipCmd, CmdReset);
@@ -2039,6 +2038,8 @@ rtl8169_init_one(struct pci_dev *pdev, cmsleep_interruptible (1 ); } +RTL_W16 (IntrStatus,0xffff ); +/* Identify chip attached to board */ rtl8169_get_mac_version (tp, ioaddr);
PATCH 51/88 agp: zero pages before sending to userspace
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Shaohua Li <[email protected]>
upstream commit: 59de2bebabc5027f93df999d59cc65df591c3e6e
CVE-2009-1192
AGP pages might be mapped into userspace finally, so the pages should be set to zero before userspace can use it. Otherwise there is potential information leakage.
--- drivers/char/agp/generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/agp/generic.c +2 -2
@@ -1226,7 +1226,7 @@ int agp_generic_alloc_pages(struct agp_bint i, ret = -ENOMEM ;for (i =0 ; i < num_pages; i++) { - page =alloc_page (GFP_KERNEL |GFP_DMA32 ); + page =alloc_page (GFP_KERNEL |GFP_DMA32 | __GFP_ZERO);/* agp_free_memory() needs gart address */ if (page ==NULL ) goto out;
@@ -1257,7 +1257,7 @@ void *agp_generic_alloc_page(struct agp_ {struct page * page; - page =alloc_page (GFP_KERNEL |GFP_DMA32 ); + page =alloc_page (GFP_KERNEL |GFP_DMA32 | __GFP_ZERO);if (page ==NULL )return NULL ;
PATCH 52/88 hugetlbfs: return negative error code for bad mount option
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Akinobu Mita <[email protected]>
upstream commit: c12ddba09394c60e1120e6997794fa6ed52da884
This fixes the following BUG:
# mount -o size=MM -t hugetlbfs none /huge hugetlbfs: Bad value 'MM' for mount option 'size=MM' ------------[ cut here ]------------ kernel BUG at fs/super.c:996!
Due to
BUG_ON(!mnt->mnt_sb);
in vfs_kern_mount().
Also, remove unused #include <linux/quotaops.h>
--- fs/hugetlbfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/hugetlbfs/inode.c +1 -2
@@ -26,7 +26,6 @@#include <linux/pagevec.h> #include <linux/parser.h> #include <linux/mman.h> -#include <linux/quotaops.h> #include <linux/slab.h> #include <linux/dnotify.h> #include <linux/statfs.h>
@@ -838,7 +837,7 @@ hugetlbfs_parse_options(char *options, s bad_val:printk (KERN_ERR "hugetlbfs: Bad value '%s' for mount option '%s'\n" , args[0 ].from, p); -return 1 ; +return -EINVAL ; } static int
PATCH 53/88 block: revert part of 18ce3751ccd488c78d3827e9f6bf54e6322676fb
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jens Axboe <[email protected]>
commit 78f707bfc723552e8309b7c38a8d0cc51012e813 upstream.
The above commit added WRITE_SYNC and switched various places to using that for committing writes that will be waited upon immediately after submission. However, this causes a performance regression with AS and CFQ for ext3 at least, since sync_dirty_buffer() will submit some writes with WRITE_SYNC while ext3 has sumitted others dependent writes without the sync flag set. This causes excessive anticipation/idling in the IO scheduler because sync and async writes get interleaved, causing a big performance regression for the below test case (which is meant to simulate sqlite like behaviour).
---- test case ----
int main(int argc, char **argv)
{
int fdes, i;
FILE *fp;
struct timeval start;
struct timeval end;
struct timeval res;
gettimeofday(&start, NULL);
for (i=0; i<ROWS; i++) {
fp = fopen("test_file", "a");
fprintf(fp, "Some Text Data\n");
fdes = fileno(fp);
fsync(fdes);
fclose(fp);
}
gettimeofday(&end, NULL);
timersub(&end, &start, &res);
fprintf(stdout, "time to write %d lines is %ld(msec)\n", ROWS,
(res.tv_sec*1000000 + res.tv_usec)/1000);
return 0;
}-------------------
Thanks to [email protected] for tracking down this performance regression and providing a test case.
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/buffer.c +1 -1
@@ -3042,7 +3042,7 @@ int sync_dirty_buffer(struct buffer_headif (test_clear_buffer_dirty (bh)) {get_bh (bh); bh->b_end_io = end_buffer_write_sync; - ret =submit_bh (WRITE_SYNC , bh); + ret =submit_bh (WRITE , bh);wait_on_buffer (bh);if (buffer_eopnotsupp (bh)) {clear_buffer_eopnotsupp (bh);
PATCH 54/88 anon_inodes: use fops->owner for module refcount
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Borntraeger <[email protected]>
There is an imbalance for anonymous inodes. If the fops->owner field is set, the module reference count of owner is decreases on release. ("filp_close" --> "__fput" ---> "fops_put")
On the other hand, anon_inode_getfd does not increase the module reference count of owner. This causes two problems:
- if owner is set, the module refcount goes negative
- if owner is not set, the module can be unloaded while code is running
This patch changes anon_inode_getfd to be symmetric regarding fops->owner handling.
I have checked all existing users of anon_inode_getfd. Noone sets fops->owner, thats why nobody has seen the module refcount negative. The refcounting was tested with a patched and unpatched KVM module.(see patch 2/2) I also did an epoll_open/close test.
--- fs/anon_inodes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/anon_inodes.c +6 -1
@@ -79,9 +79,12 @@ int anon_inode_getfd(const char *name, cif (IS_ERR (anon_inode_inode))return -ENODEV ; +if (fops->owner && !try_module_get (fops->owner)) +return -ENOENT ; + error =get_unused_fd_flags (flags);if (error <0 ) -return error; + goto err_module; fd = error;/*
@@ -128,6 +131,8 @@ err_dput:dput (dentry); err_put_unused_fd:put_unused_fd (fd); +err_module: +module_put (fops->owner);return error; }EXPORT_SYMBOL_GPL (anon_inode_getfd);
PATCH 55/88 KVM: x86: Reset pending/inject NMI state on CPU reset
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kiszka <[email protected]>
(cherry picked from 448fa4a9c5dbc6941dd19ed09692c588d815bb06)
CPU reset invalidates pending or already injected NMIs, therefore reset the related state variables.
Based on original patch by Gleb Natapov.
--- arch/x86/kvm/x86.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/x86.c +3 -0
@@ -3925,6 +3925,9 @@ void kvm_arch_vcpu_destroy(struct kvm_vcint kvm_arch_vcpu_reset (struct kvm_vcpu *vcpu) { + vcpu->arch.nmi_pending = false; + vcpu->arch.nmi_injected = false; +return kvm_x86_ops->vcpu_reset (vcpu); }
PATCH 56/88 KVM: call kvm_arch_vcpu_reset() instead of the kvm_x86_ops callback
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Gleb Natapov <[email protected]>
(cherry picked from 5f179287fa02723215eecf681d812b303c243973)
Call kvm_arch_vcpu_reset() instead of directly using arch callback. The function does additional things.
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -2973,7 +2973,7 @@ static int __vcpu_run(struct kvm_vcpu *vpr_debug ("vcpu %d received sipi with vector # %x\n" , vcpu->vcpu_id, vcpu->arch.sipi_vector);kvm_lapic_reset (vcpu); - r = kvm_x86_ops->vcpu_reset (vcpu); + r =kvm_arch_vcpu_reset (vcpu);if (r)return r; vcpu->arch.mp_state =KVM_MP_STATE_RUNNABLE ;
PATCH 57/88 KVM: MMU: Extend kvm_mmu_page->slot_bitmap size
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sheng Yang <[email protected]>
(cherry picked from 291f26bc0f89518ad7ee3207c09eb8a743ac8fcc)
Otherwise set_bit() for private memory slot(above KVM_MEMORY_SLOTS) would corrupted memory in 32bit host.
--- arch/x86/include/asm/kvm_host.h | 8 +++++--- arch/x86/kvm/mmu.c | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/include/asm/kvm_host.h +5 -3
@@ -190,9 +190,11 @@ struct kvm_mmu_page {u64 *spt;/* hold the gfn of each spte inside spt */ gfn_t *gfns; -unsigned long slot_bitmap;/* One bit set per slot which has memory -* in this shadow page. -*/ +/* +* One bit set per slot which has memory +* in this shadow page. +*/ +DECLARE_BITMAP (slot_bitmap,KVM_MEMORY_SLOTS +KVM_PRIVATE_MEM_SLOTS );int multimapped;/* More than one parent_pte? */ int root_count;/* Currently serving as active root */ bool unsync;
arch/x86/kvm/mmu.c +3 -3
@@ -787,7 +787,7 @@ static struct kvm_mmu_page *kvm_mmu_alloset_page_private (virt_to_page (sp->spt), (unsigned long )sp);list_add (&sp->link, &vcpu->kvm->arch.active_mmu_pages);ASSERT (is_empty_shadow_page (sp->spt)); - sp->slot_bitmap =0 ; +bitmap_zero (sp->slot_bitmap,KVM_MEMORY_SLOTS +KVM_PRIVATE_MEM_SLOTS ); sp->multimapped =0 ; sp->parent_pte = parent_pte; --vcpu->kvm->arch.n_free_mmu_pages;
@@ -1362,7 +1362,7 @@ static void page_header_update_slot(struint slot =memslot_id (kvm,gfn_to_memslot (kvm, gfn));struct kvm_mmu_page *sp =page_header (__pa (pte)); -__set_bit (slot, &sp->slot_bitmap); +__set_bit (slot, sp->slot_bitmap); }static void mmu_convert_notrap (struct kvm_mmu_page *sp)
@@ -2451,7 +2451,7 @@ void kvm_mmu_slot_remove_write_access(stint i;u64 *pt; -if (!test_bit (slot, &sp->slot_bitmap)) +if (!test_bit (slot, sp->slot_bitmap))continue ; pt = sp->spt;
PATCH 58/88 KVM: VMX: Move private memory slot position
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sheng Yang <[email protected]>
(cherry picked from 6fe639792c7b8e462baeaac39ecc33541fd5da6e)
PCI device assignment would map guest MMIO spaces as separate slot, so it is possible that the device has more than 2 MMIO spaces and overwrite current private memslot.
The patch move private memory slot to the top of userspace visible memory slots.
--- arch/x86/kvm/vmx.c | 2 +- arch/x86/kvm/vmx.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/kvm/vmx.c +1 -1
@@ -2407,7 +2407,7 @@ static int vmx_set_tss_addr(struct kvm * {int ret;struct kvm_userspace_memory_region tss_mem = { - .slot =8 , + .slot =TSS_PRIVATE_MEMSLOT , .guest_phys_addr = addr, .memory_size =PAGE_SIZE *3 , .flags =0 ,
arch/x86/kvm/vmx.h +3 -2
@@ -331,8 +331,9 @@ enum vmcs_field {#define AR_RESERVD_MASK 0xfffe0f00 -#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT 9 -#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT 10 +#define TSS_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 0) +#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 1) +#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_MEMORY_SLOTS + 2)#define VMX_NR_VPIDS (1 << 16)#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
PATCH 59/88 KVM: SVM: Set the g bit of the cs selector for cross-vendor migration
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Amit Shah <[email protected]>
(cherry picked from 25022acc3dd5f0b54071c7ba7c371860f2971b52)
The hardware does not set the 'g' bit of the cs selector and this breaks migration from amd hosts to intel hosts. Set this bit if the segment limit is beyond 1 MB.
--- arch/x86/kvm/svm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/kvm/svm.c +9 -0
@@ -772,6 +772,15 @@ static void svm_get_segment(struct kvm_v var->l = (s->attrib >>SVM_SELECTOR_L_SHIFT ) &1 ; var->db = (s->attrib >>SVM_SELECTOR_DB_SHIFT ) &1 ; var->g = (s->attrib >>SVM_SELECTOR_G_SHIFT ) &1 ; + +/* +* SVM always stores 0 for the 'G' bit in the CS selector in +* the VMCB on a VMEXIT. This hurts cross-vendor migration: +* Intel's VMENTRY has a check on the 'G' bit. +*/ +if (seg ==VCPU_SREG_CS ) + var->g = s->limit >0xfffff ; + var->unusable = !var->present; }
PATCH 60/88 KVM: SVM: Set the busy flag of the TR selector
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Amit Shah <[email protected]>
(cherry picked from c0d09828c870f90c6bc72070ada281568f89c63b)
The busy flag of the TR selector is not set by the hardware. This breaks migration from amd hosts to intel hosts.
--- arch/x86/kvm/svm.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kvm/svm.c +7 -0
@@ -781,6 +781,13 @@ static void svm_get_segment(struct kvm_vif (seg ==VCPU_SREG_CS ) var->g = s->limit >0xfffff ; +/* +* Work around a bug where the busy flag in the tr selector +* isn't exposed +*/ +if (seg ==VCPU_SREG_TR ) + var->type |=0x2 ; + var->unusable = !var->present; }
PATCH 61/88 KVM: MMU: Fix aliased gfns treated as unaliased
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Izik Eidus <[email protected]>
(cherry picked from 2843099fee32a6020e1caa95c6026f28b5d43bff)
Some areas of kvm x86 mmu are using gfn offset inside a slot without unaliasing the gfn first. This patch makes sure that the gfn will be unaliased and add gfn_to_memslot_unaliased() to save the calculating of the gfn unaliasing in case we have it unaliased already.
--- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/mmu.c | 14 ++++++++++---- virt/kvm/kvm_main.c | 9 +++++---- 3 files changed, 17 insertions(+), 8 deletions(-)
arch/x86/include/asm/kvm_host.h +2 -0
@@ -609,6 +609,8 @@ void kvm_disable_tdp(void);int load_pdptrs (struct kvm_vcpu *vcpu,unsigned long cr3);int complete_pio (struct kvm_vcpu *vcpu); +struct kvm_memory_slot *gfn_to_memslot_unaliased (struct kvm *kvm,gfn_t gfn); +static inline struct kvm_mmu_page *page_header (hpa_t shadow_page) {struct page *page =pfn_to_page (shadow_page >>PAGE_SHIFT );
arch/x86/kvm/mmu.c +10 -4
@@ -384,7 +384,9 @@ static void account_shadowed(struct kvm {int *write_count; - write_count =slot_largepage_idx (gfn,gfn_to_memslot (kvm, gfn)); + gfn =unalias_gfn (kvm, gfn); + write_count =slot_largepage_idx (gfn, +gfn_to_memslot_unaliased (kvm, gfn)); *write_count +=1 ; }
@@ -392,16 +394,20 @@ static void unaccount_shadowed(struct kv {int *write_count; - write_count =slot_largepage_idx (gfn,gfn_to_memslot (kvm, gfn)); + gfn =unalias_gfn (kvm, gfn); + write_count =slot_largepage_idx (gfn, +gfn_to_memslot_unaliased (kvm, gfn)); *write_count -=1 ;WARN_ON (*write_count <0 ); }static int has_wrprotected_page (struct kvm *kvm,gfn_t gfn) { -struct kvm_memory_slot *slot =gfn_to_memslot (kvm, gfn); +struct kvm_memory_slot *slot;int *largepage_idx; + gfn =unalias_gfn (kvm, gfn); + slot =gfn_to_memslot_unaliased (kvm, gfn);if (slot) { largepage_idx =slot_largepage_idx (gfn, slot);return *largepage_idx;
@@ -2860,8 +2866,8 @@ static void audit_write_protection(strucif (sp->role.metaphysical)continue ; - slot =gfn_to_memslot (vcpu->kvm, sp->gfn); gfn =unalias_gfn (vcpu->kvm, sp->gfn); + slot =gfn_to_memslot_unaliased (vcpu->kvm, sp->gfn); rmapp = &slot->rmap[gfn - slot->base_gfn];if (*rmapp) printk(KERN_ERR "%s: (%s) shadow page has writable"
virt/kvm/kvm_main.c +5 -4
@@ -918,7 +918,7 @@ int kvm_is_error_hva(unsigned long addr) }EXPORT_SYMBOL_GPL (kvm_is_error_hva); -static struct kvm_memory_slot *__gfn_to_memslot (struct kvm *kvm,gfn_t gfn) +struct kvm_memory_slot *gfn_to_memslot_unaliased (struct kvm *kvm,gfn_t gfn) {int i;
@@ -931,11 +931,12 @@ static struct kvm_memory_slot *__gfn_to_ }return NULL ; } +EXPORT_SYMBOL_GPL (gfn_to_memslot_unaliased);struct kvm_memory_slot *gfn_to_memslot (struct kvm *kvm,gfn_t gfn) { gfn =unalias_gfn (kvm, gfn); -return __gfn_to_memslot (kvm, gfn); +return gfn_to_memslot_unaliased (kvm, gfn); }int kvm_is_visible_gfn (struct kvm *kvm,gfn_t gfn)
@@ -959,7 +960,7 @@ unsigned long gfn_to_hva(struct kvm *kvmstruct kvm_memory_slot *slot; gfn =unalias_gfn (kvm, gfn); - slot =__gfn_to_memslot (kvm, gfn); + slot =gfn_to_memslot_unaliased (kvm, gfn);if (!slot)return bad_hva ();return (slot->userspace_addr + (gfn - slot->base_gfn) *PAGE_SIZE );
@@ -1210,7 +1211,7 @@ void mark_page_dirty(struct kvm *kvm, gfstruct kvm_memory_slot *memslot; gfn =unalias_gfn (kvm, gfn); - memslot =__gfn_to_memslot (kvm, gfn); + memslot =gfn_to_memslot_unaliased (kvm, gfn);if (memslot && memslot->dirty_bitmap) {unsigned long rel_gfn = gfn - memslot->base_gfn;
PATCH 63/88 KVM: Fix cpuid iteration on multiple leaves per eac
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nitin A Kamble <[email protected]>
(cherry picked from 0fdf8e59faa5c60e9d77c8e14abe3a0f8bfcf586)
The code to traverse the cpuid data array list for counting type of leaves is currently broken.
This patches fixes the 2 things in it.
1. Set the 1st counting entry's flag KVM_CPUID_FLAG_STATE_READ_NEXT. Without it the code will never find a valid entry.
2. Also the stop condition in the for loop while looking for the next unflaged entry is broken. It needs to stop when it find one matching entry; and in the case of count of 1, it will be the same entry found in this iteration.
--- arch/x86/kvm/x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +2 -1
@@ -1188,6 +1188,7 @@ static void do_cpuid_ent(struct kvm_cpuiint t, times = entry->eax &0xff ; entry->flags |=KVM_CPUID_FLAG_STATEFUL_FUNC ; + entry->flags |=KVM_CPUID_FLAG_STATE_READ_NEXT ;for (t =1 ; t < times && *nent < maxnent; ++t) {do_cpuid_1_ent (&entry[t], function,0 ); entry[t].flags |=KVM_CPUID_FLAG_STATEFUL_FUNC ;
@@ -2729,7 +2730,7 @@ static int move_to_next_stateful_cpuid_e e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT ;/* when no next entry is found, the current entry[i] is reselected */ -for (j = i +1 ; j == i; j = (j +1 ) % nent) { +for (j = i +1 ; ; j = (j +1 ) % nent) {struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j];if (ej->function == e->function) { ej->flags |=KVM_CPUID_FLAG_STATE_READ_NEXT ;
PATCH 64/88 KVM: Prevent trace call into unloaded module text
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Wu Fengguang <[email protected]>
(cherry picked from b82091824ee4970adf92d5cd6d57b12273171625)
Add marker_synchronize_unregister() before module unloading. This prevents possible trace calls into unloaded module text.
--- virt/kvm/kvm_trace.c | 1 + 1 file changed, 1 insertion(+)
virt/kvm/kvm_trace.c +1 -0
@@ -252,6 +252,7 @@ void kvm_trace_cleanup(void)struct kvm_trace_probe *p = &kvm_trace_probes[i];marker_probe_unregister (p->name, p->probe_func, p); } +marker_synchronize_unregister ();relay_close (kt->rchan);debugfs_remove (kt->lost_file);
PATCH 65/88 KVM: Really remove a slot when a user ask us so
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Glauber Costa <[email protected]>
(cherry picked from 6f89724829cfd4ad6771a92fd4b8d59c90c7220c)
Right now, KVM does not remove a slot when we do a register ioctl for size 0 (would be the expected behaviour).
Instead, we only mark it as empty, but keep all bitmaps and allocated data structures present. It completely nullifies our chances of reusing that same slot again for mapping a different piece of memory.
In this patch, we destroy rmaps, and vfree() the pointers that used to hold the dirty bitmap, rmap and lpage_info structures.
--- virt/kvm/kvm_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
virt/kvm/kvm_main.c +4 -1
@@ -821,7 +821,10 @@ int __kvm_set_memory_region(struct kvm * goto out_free; } -kvm_free_physmem_slot (&old, &new); +kvm_free_physmem_slot (&old, npages ? &new :NULL ); +/* Slot deletion case: we have to update the current slot */ +if (!npages) + *memslot = old;#ifdef CONFIG_DMAR /* map the pages in iommu page table */ r =kvm_iommu_map_pages (kvm, base_gfn, npages);
PATCH 66/88 KVM: x86 emulator: Fix handling of VMMCALL instruction
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Amit Shah <[email protected]>
(cherry picked from fbce554e940a983d005e29849636d0ef54b3eb18)
The VMMCALL instruction doesn't get recognised and isn't processed by the emulator.
This is seen on an Intel host that tries to execute the VMMCALL instruction after a guest live migrates from an AMD host.
--- arch/x86/kvm/x86_emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86_emulate.c +1 -1
@@ -299,7 +299,7 @@ static u16 group_table[] = {static u16 group2_table[] = { [Group7*8 ] = - SrcNone | ModRM,0 ,0 ,0 , + SrcNone | ModRM,0 ,0 , SrcNone | ModRM, SrcNone | ModRM | DstMem | Mov,0 , SrcMem16 | ModRM | Mov,0 , };
PATCH 62/88 KVM: Fix cpuid leaf 0xb loop termination
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Nitin A Kamble <[email protected]>
(cherry picked from 0853d2c1d849ef69884d2447d90d04007590b72b)
For cpuid leaf 0xb the bits 8-15 in ECX register define the end of counting
leaf. The previous code was using bits 0-7 for this purpose, which is
a bug.
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -1218,7 +1218,7 @@ static void do_cpuid_ent(struct kvm_cpui entry->flags |=KVM_CPUID_FLAG_SIGNIFCANT_INDEX ;/* read more entries until level_type is zero */ for (i =1 ; *nent < maxnent; ++i) { - level_type = entry[i -1 ].ecx &0xff ; + level_type = entry[i -1 ].ecx &0xff00 ;if (!level_type)break ;do_cpuid_1_ent (&entry[i], function, i);
PATCH 67/88 KVM: set owner of cpu and vm file operations
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Borntraeger <[email protected]>
(cherry picked from 3d3aab1b973b01bd2a1aa46307e94a1380b1d802)
There is a race between a "close of the file descriptors" and module unload in the kvm module.
You can easily trigger this problem by applying this debug patch:
Quoted 7 lines
virt/kvm/kvm_main.c +1
-0@@ -648,10 +648,14 @@ void kvm_free_physmem(struct kvm *kvm)kvm_free_physmem_slot (&kvm->memslots[i],NULL ); } +#include <linux/delay.h>
virt/kvm/kvm_main.c void kvm_free_physmem(struct kvm *kvm) · line 661
Quoted 10 lines
virt/kvm/kvm_main.c +3
-0static void kvm_destroy_vm (struct kvm *kvm) {struct mm_struct *mm = kvm->mm; +printk ("off1\n" ); +msleep (5000 ); +printk ("off2\n" );spin_lock (&kvm_lock);list_del (&kvm->vm_list);spin_unlock (&kvm_lock);
and killing the userspace, followed by an rmmod.
The problem is that kvm_destroy_vm can run while the module count is 0. That means, you can remove the module while kvm_destroy_vm is running. But kvm_destroy_vm is part of the module text. This causes a kerneloops. The race exists without the msleep but is much harder to trigger.
This patch requires the fix for anon_inodes (anon_inodes: use fops->owner for module refcount).
With this patch, we can set the owner of all anonymous KVM inodes file operations. The VFS will then control the KVM module refcount as long as there is an open file. kvm_destroy_vm will be called by the release function of the last closed file - before the VFS drops the module refcount.
--- virt/kvm/kvm_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
virt/kvm/kvm_main.c +4 -2
@@ -1299,7 +1299,7 @@ static int kvm_vcpu_release(struct inodereturn 0 ; } -static const struct file_operations kvm_vcpu_fops = { +static struct file_operations kvm_vcpu_fops = { .release = kvm_vcpu_release, .unlocked_ioctl = kvm_vcpu_ioctl, .compat_ioctl = kvm_vcpu_ioctl,
@@ -1693,7 +1693,7 @@ static int kvm_vm_mmap(struct file *filereturn 0 ; } -static const struct file_operations kvm_vm_fops = { +static struct file_operations kvm_vm_fops = { .release = kvm_vm_release, .unlocked_ioctl = kvm_vm_ioctl, .compat_ioctl = kvm_vm_ioctl,
@@ -2057,6 +2057,8 @@ int kvm_init(void *opaque, unsigned int } kvm_chardev_ops.owner = module; + kvm_vm_fops.owner = module; + kvm_vcpu_fops.owner = module; r =misc_register (&kvm_dev);if (r) {
PATCH 68/88 KVM: Advertise the bug in memory region destruction as fixed
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
(cherry picked from 1a811b6167089bcdb84284f2dc9fd0b4d0f1899d)
Userspace might need to act differently.
--- include/linux/kvm.h | 2 ++ virt/kvm/kvm_main.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
include/linux/kvm.h +2 -0
@@ -387,6 +387,8 @@ struct kvm_trace_rec {#define KVM_CAP_DEVICE_ASSIGNMENT 17#endif #define KVM_CAP_IOMMU 18 +/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ +#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21/* * ioctls for VM fds
virt/kvm/kvm_main.c +12 -1
@@ -1715,6 +1715,17 @@ static int kvm_dev_ioctl_create_vm(void)return fd; } +static long kvm_dev_ioctl_check_extension_generic (long arg) +{ +switch (arg) { +case KVM_CAP_DESTROY_MEMORY_REGION_WORKS : +return 1 ; +default : +break ; + } +return kvm_dev_ioctl_check_extension (arg); +} +static long kvm_dev_ioctl (struct file *filp,unsigned int ioctl,unsigned long arg) {
@@ -1734,7 +1745,7 @@ static long kvm_dev_ioctl(struct file *f r =kvm_dev_ioctl_create_vm ();break ;case KVM_CHECK_EXTENSION : - r =kvm_dev_ioctl_check_extension (arg); + r =kvm_dev_ioctl_check_extension_generic (arg);break ;case KVM_GET_VCPU_MMAP_SIZE : r = -EINVAL ;
PATCH 69/88 KVM: MMU: check for present pdptr shadow page in walk_shadow
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from eb64f1e8cd5c3cae912db30a77d062367f7a11a6)
walk_shadow assumes the caller verified validity of the pdptr pointer in question, which is not the case for the invlpg handler.
Fixes oops during Solaris 10 install.
--- arch/x86/kvm/mmu.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/mmu.c +2 -0
@@ -1159,6 +1159,8 @@ static int walk_shadow(struct kvm_shadowif (level ==PT32E_ROOT_LEVEL ) { shadow_addr = vcpu->arch.mmu.pae_root[(addr >>30 ) &3 ]; shadow_addr &=PT64_BASE_ADDR_MASK ; +if (!shadow_addr) +return 1 ; --level; }
PATCH 70/88 KVM: MMU: handle large host sptes on invlpg/resync
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from 87917239204d67a316cb89751750f86c9ed3640b)
The invlpg and sync walkers lack knowledge of large host sptes, descending to non-existant pagetable level.
Stop at directory level in such case.
Fixes SMP Windows XP with hugepages.
--- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/paging_tmpl.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
arch/x86/kvm/mmu.c +1 -1
@@ -981,7 +981,7 @@ static int mmu_unsync_walk(struct kvm_mmfor_each_unsync_children (sp->unsync_child_bitmap, i) {u64 ent = sp->spt[i]; -if (is_shadow_present_pte (ent)) { +if (is_shadow_present_pte (ent) && !is_large_pte (ent)) {struct kvm_mmu_page *child; child =page_header (ent &PT64_BASE_ADDR_MASK );
arch/x86/kvm/paging_tmpl.h +6 -2
@@ -467,9 +467,13 @@ static int FNAME(shadow_invlpg_entry)(st u64 *sptep, int level) { -if (level ==PT_PAGE_TABLE_LEVEL ) { -if (is_shadow_present_pte (*sptep)) +if (level ==PT_PAGE_TABLE_LEVEL || + ((level ==PT_DIRECTORY_LEVEL ) &&is_large_pte (*sptep))) { +if (is_shadow_present_pte (*sptep)) {rmap_remove (vcpu->kvm, sptep); +if (is_large_pte (*sptep)) + --vcpu->kvm->stat.lpages; + }set_shadow_pte (sptep, shadow_trap_nonpresent_pte);return 1 ; }
PATCH 71/88 KVM: mmu_notifiers release method
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from 85db06e514422ae429b5f85742d8111b70bd56f3)
The destructor for huge pages uses the backing inode for adjusting hugetlbfs accounting.
Hugepage mappings are destroyed by exit_mmap, after mmu_notifier_release, so there are no notifications through unmap_hugepage_range at this point.
The hugetlbfs inode can be freed with pages backed by it referenced by the shadow. When the shadow releases its reference, the huge page destructor will access a now freed inode.
Implement the release operation for kvm mmu notifiers to release page refs before the hugetlbfs inode is gone.
--- virt/kvm/kvm_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
virt/kvm/kvm_main.c +8 -0
@@ -553,11 +553,19 @@ static int kvm_mmu_notifier_clear_flush_ return young; } +static void kvm_mmu_notifier_release (struct mmu_notifier *mn, +struct mm_struct *mm) +{ +struct kvm *kvm =mmu_notifier_to_kvm (mn); +kvm_arch_flush_shadow (kvm); +} +static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { .invalidate_page = kvm_mmu_notifier_invalidate_page, .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, .clear_flush_young = kvm_mmu_notifier_clear_flush_young, + .release = kvm_mmu_notifier_release, };#endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
PATCH 72/88 KVM: PIT: fix i8254 pending count read
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from d2a8284e8fca9e2a938bee6cd074064d23864886)
count_load_time assignment is bogus: its supposed to contain what it means, not the expiration time.
--- arch/x86/kvm/i8254.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/i8254.c +1 -1
@@ -207,7 +207,7 @@ static int __pit_timer_fn(struct kvm_kpihrtimer_add_expires_ns (&pt->timer, pt->period); pt->scheduled =hrtimer_get_expires_ns (&pt->timer);if (pt->period) - ps->channels[0 ].count_load_time =hrtimer_get_expires (&pt->timer); + ps->channels[0 ].count_load_time =ktime_get ();return (pt->period ==0 ?0 :1 ); }
PATCH 73/88 KVM: x86: disable kvmclock on non constant TSC hosts
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from abe6655dd699069b53bcccbc65b2717f60203b12)
This is better.
Currently, this code path is posing us big troubles, and we won't have a decent patch in time. So, temporarily disable it.
--- arch/x86/kvm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kvm/x86.c +3 -1
@@ -906,7 +906,6 @@ int kvm_dev_ioctl_check_extension(long ecase KVM_CAP_USER_MEMORY :case KVM_CAP_SET_TSS_ADDR :case KVM_CAP_EXT_CPUID : -case KVM_CAP_CLOCKSOURCE :case KVM_CAP_PIT :case KVM_CAP_NOP_IO_DELAY :case KVM_CAP_MP_STATE :
@@ -931,6 +930,9 @@ int kvm_dev_ioctl_check_extension(long ecase KVM_CAP_IOMMU : r =intel_iommu_found ();break ; +case KVM_CAP_CLOCKSOURCE : + r =boot_cpu_has (X86_FEATURE_CONSTANT_TSC ); +break ;default : r =0 ;break ;
PATCH 74/88 KVM: x86: fix LAPIC pending count calculation
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
(cherry picked from b682b814e3cc340f905c14dff87ce8bdba7c5eba)
Simplify LAPIC TMCCT calculation by using hrtimer provided function to query remaining time until expiration.
Fixes host hang with nested ESX.
--- arch/x86/kvm/irq.c | 7 ----- arch/x86/kvm/irq.h | 1 arch/x86/kvm/lapic.c | 66 +++++++++++---------------------------------------- arch/x86/kvm/lapic.h | 2 - arch/x86/kvm/svm.c | 1 arch/x86/kvm/vmx.c | 4 --- 6 files changed, 16 insertions(+), 65 deletions(-)
arch/x86/kvm/irq.c +0 -7
@@ -87,13 +87,6 @@ void kvm_inject_pending_timer_irqs(struc }EXPORT_SYMBOL_GPL (kvm_inject_pending_timer_irqs); -void kvm_timer_intr_post (struct kvm_vcpu *vcpu,int vec) -{ -kvm_apic_timer_intr_post (vcpu, vec); -/* TODO: PIT, RTC etc. */ -} -EXPORT_SYMBOL_GPL (kvm_timer_intr_post); -void __kvm_migrate_timers (struct kvm_vcpu *vcpu) {__kvm_migrate_apic_timer (vcpu);
arch/x86/kvm/irq.h +0 -1
@@ -84,7 +84,6 @@ static inline int irqchip_in_kernel(struvoid kvm_pic_reset (struct kvm_kpic_state *s); -void kvm_timer_intr_post (struct kvm_vcpu *vcpu,int vec);void kvm_inject_pending_timer_irqs (struct kvm_vcpu *vcpu);void kvm_inject_apic_timer_irqs (struct kvm_vcpu *vcpu);void __kvm_migrate_apic_timer (struct kvm_vcpu *vcpu);
arch/x86/kvm/lapic.c +15 -51
97 lines not on this page · raw message
arch/x86/kvm/lapic.h +0 -2
@@ -12,7 +12,6 @@ struct kvm_lapic {atomic_t pending;s64 period;/* unit: ns */ u32 divide_count; -ktime_t last_update;struct hrtimer dev; } timer;struct kvm_vcpu *vcpu;
@@ -42,7 +41,6 @@ void kvm_set_apic_base(struct kvm_vcpu *void kvm_apic_post_state_restore (struct kvm_vcpu *vcpu);int kvm_lapic_enabled (struct kvm_vcpu *vcpu);int kvm_lapic_find_highest_irr (struct kvm_vcpu *vcpu); -void kvm_apic_timer_intr_post (struct kvm_vcpu *vcpu,int vec);void kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu,gpa_t vapic_addr);void kvm_lapic_sync_from_vapic (struct kvm_vcpu *vcpu);
arch/x86/kvm/svm.c +0 -1
@@ -1612,7 +1612,6 @@ static void svm_intr_assist(struct kvm_v/* Okay, we can deliver the interrupt: grab it and update PIC state. */ intr_vector =kvm_cpu_get_interrupt (vcpu);svm_inject_irq (svm, intr_vector); -kvm_timer_intr_post (vcpu, intr_vector); out:update_cr8_intercept (vcpu); }
arch/x86/kvm/vmx.c +1 -3
@@ -3171,10 +3171,8 @@ static void vmx_intr_assist(struct kvm_velse enable_irq_window (vcpu); } -if (vcpu->arch.interrupt.pending) { +if (vcpu->arch.interrupt.pending)vmx_inject_irq (vcpu, vcpu->arch.interrupt.nr); -kvm_timer_intr_post (vcpu, vcpu->arch.interrupt.nr); - } }/*
PATCH 75/88 KVM: VMX: Flush volatile msrs before emulating rdmsr
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
(cherry picked from 516a1a7e9dc80358030fe01aabb3bedf882db9e2)
Some msrs (notable MSR_KERNEL_GS_BASE) are held in the processor registers and need to be flushed to the vcpu struture before they can be read.
This fixes cygwin longjmp() failure on Windows x64.
--- arch/x86/kvm/vmx.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kvm/vmx.c +1 -0
@@ -897,6 +897,7 @@ static int vmx_get_msr(struct kvm_vcpu * data =vmcs_readl (GUEST_SYSENTER_ESP );break ;default : +vmx_load_host_state (to_vmx (vcpu)); msr =find_msr_entry (to_vmx (vcpu), msr_index);if (msr) { data = msr->data;
PATCH 78/88 md: fix deadlock when stopping arrays
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Williams <[email protected]>
[backport of 5fd3a17ed456637a224cf4ca82b9ad9d005bc8d4]
Resolve a deadlock when stopping redundant arrays, i.e. ones that require a call to sysfs_remove_group when shutdown. The deadlock is summarized below:
Thread1 Thread2 ------- ------- read sysfs attribute stop array
take mddev lock
sysfs_remove_groupsysfs_get_active
wait for mddev lock
wait for active
Sysrq-w:
--------
mdmon S 00000017 2212 4163 1
f1982ea8 00000046 2dcf6b85 00000017 c0b23100 f2f83ed0 c0b23100 f2f8413c c0b23100 c0b23100 c0b1fb98 f2f8413c 00000000 f2f8413c c0b23100 f2291ecc 00000002 c0b23100 00000000 00000017 f2f83ed0 f1982eac 00000046 c044d9dd
Call Trace: [<c044d9dd>] ? debug_mutex_add_waiter+0x1d/0x58 [<c06ef451>] __mutex_lock_common+0x1d9/0x338 [<c06ef451>] ? __mutex_lock_common+0x1d9/0x338 [<c06ef5e3>] mutex_lock_interruptible_nested+0x33/0x3a [<c0634553>] ? mddev_lock+0x14/0x16 [<c0634553>] mddev_lock+0x14/0x16 [<c0634eda>] md_attr_show+0x2a/0x49 [<c04e9997>] sysfs_read_file+0x93/0xf9
mdadm D 00000017 2812 4177 1
f0401d78 00000046 430456f8 00000017 f0401d58 f0401d20 c0b23100 f2da2c4c c0b23100 c0b23100 c0b1fb98 f2da2c4c 0a10fc36 00000000 c0b23100 f0401d70 00000003 c0b23100 00000000 00000017 f2da29e0 00000001 00000002 00000000
Call Trace: [<c06eed1b>] schedule_timeout+0x1b/0x95 [<c06eed1b>] ? schedule_timeout+0x1b/0x95 [<c06eeb97>] ? wait_for_common+0x34/0xdc [<c044fa8a>] ? trace_hardirqs_on_caller+0x18/0x145 [<c044fbc2>] ? trace_hardirqs_on+0xb/0xd [<c06eec03>] wait_for_common+0xa0/0xdc [<c0428c7c>] ? default_wake_function+0x0/0x12 [<c06eeccc>] wait_for_completion+0x17/0x19 [<c04ea620>] sysfs_addrm_finish+0x19f/0x1d1 [<c04e920e>] sysfs_hash_and_remove+0x42/0x55 [<c04eb4db>] sysfs_remove_group+0x57/0x86 [<c0638086>] do_md_stop+0x13a/0x499
This has been there for a while, but is easier to trigger now that mdmon is closely watching sysfs.
---
drivers/md/md.c | 27 ++++++++++++++++++++++++--- include/linux/raid/md_k.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-)
drivers/md/md.c +24 -3
@@ -3694,6 +3694,10 @@ static int do_md_run(mddev_t * mddev)return err; }if (mddev->pers->sync_request) { +/* wait for any previously scheduled redundancy groups +* to be removed +*/ +flush_scheduled_work ();if (sysfs_create_group (&mddev->kobj, &md_redundancy_group)) printk(KERN_WARNING "md: cannot register extra attributes for %s\n",
@@ -3824,6 +3828,14 @@ static void restore_bitmap_write_access(spin_unlock (&inode->i_lock); } + +static void sysfs_delayed_rm (struct work_struct *ws) +{ +mddev_t *mddev =container_of (ws, mddev_t, del_work); + +sysfs_remove_group (&mddev->kobj, &md_redundancy_group); +} +/* mode: * 0 - completely stop and dis-assemble array * 1 - switch to readonly
@@ -3833,6 +3845,7 @@ static int do_md_stop(mddev_t * mddev, i {int err =0 ;struct gendisk *disk = mddev->gendisk; +int remove_group =0 ;if (atomic_read (&mddev->openers) > is_open) {printk ("md: %s still in use.\n" ,mdname (mddev));
@@ -3868,10 +3881,9 @@ static int do_md_stop(mddev_t * mddev, i mddev->queue->merge_bvec_fn =NULL ; mddev->queue->unplug_fn =NULL ; mddev->queue->backing_dev_info.congested_fn =NULL ; -if (mddev->pers->sync_request) -sysfs_remove_group (&mddev->kobj, &md_redundancy_group); -module_put (mddev->pers->owner); +if (mddev->pers->sync_request) + remove_group =1 ; mddev->pers =NULL ;/* tell userspace to handle 'inactive' */ sysfs_notify_dirent (mddev->sysfs_state);
@@ -3919,6 +3931,15 @@ static int do_md_stop(mddev_t * mddev, i/* make sure all md_delayed_delete calls have finished */ flush_scheduled_work (); +/* we can't wait for group removal under mddev_lock as +* threads holding the group 'active' need to acquire +* mddev_lock before going inactive +*/ +if (remove_group) { +INIT_WORK (&mddev->del_work, sysfs_delayed_rm); +schedule_work (&mddev->del_work); + } +export_array (mddev); mddev->array_sectors =0 ;
include/linux/raid/md_k.h +2 -0
@@ -245,6 +245,8 @@ struct mddev_s* file in sysfs. */ +struct work_struct del_work;/* used for delayed sysfs removal */ +spinlock_t write_lock;wait_queue_head_t sb_wait;/* for waiting on superblock updates */ atomic_t pending_writes;/* number of active superblock writes */
PATCH 79/88 block: include empty disks in /proc/diskstats
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Tejun Heo <[email protected]>
commit 71982a409f12c50d011325a4471aa20666bb908d upstream.
/proc/diskstats used to show stats for all disks whether they're zero-sized or not and their non-zero partitions. Commit 074a7aca7afa6f230104e8e65eba3420263714a5 accidentally changed the behavior such that it doesn't print out zero sized disks. This patch implements DISK_PITER_INCL_EMPTY_PART0 flag to partition iterator and uses it in diskstats_show() such that empty part0 is shown in /proc/diskstats.
Reported and bisectd by Dianel Collins.
--- block/genhd.c | 12 ++++++++---- include/linux/genhd.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-)
block/genhd.c +8 -4
@@ -98,7 +98,7 @@ void disk_part_iter_init(struct disk_parif (flags &DISK_PITER_REVERSE ) piter->idx = ptbl->len -1 ; -else if (flags &DISK_PITER_INCL_PART0 ) +else if (flags & (DISK_PITER_INCL_PART0 |DISK_PITER_INCL_EMPTY_PART0 )) piter->idx =0 ;else piter->idx =1 ;
@@ -134,7 +134,8 @@ struct hd_struct *disk_part_iter_next(st/* determine iteration parameters */ if (piter->flags &DISK_PITER_REVERSE ) { inc =-1 ; -if (piter->flags &DISK_PITER_INCL_PART0 ) +if (piter->flags & (DISK_PITER_INCL_PART0 | +DISK_PITER_INCL_EMPTY_PART0 )) end =-1 ;else end =0 ;
@@ -150,7 +151,10 @@ struct hd_struct *disk_part_iter_next(st part =rcu_dereference (ptbl->part[piter->idx]);if (!part)continue ; -if (!(piter->flags &DISK_PITER_INCL_EMPTY ) && !part->nr_sects) +if (!part->nr_sects && + !(piter->flags &DISK_PITER_INCL_EMPTY ) && + !(piter->flags &DISK_PITER_INCL_EMPTY_PART0 && + piter->idx ==0 ))continue ;get_device (part_to_dev (part));
@@ -980,7 +984,7 @@ static int diskstats_show(struct seq_fil"\n\n"); */ -disk_part_iter_init (&piter, gp,DISK_PITER_INCL_PART0 ); +disk_part_iter_init (&piter, gp,DISK_PITER_INCL_EMPTY_PART0 );while ((hd =disk_part_iter_next (&piter))) { cpu =part_stat_lock ();part_round_stats (cpu, hd);
include/linux/genhd.h +1 -0
@@ -213,6 +213,7 @@ static inline void disk_put_part(struct#define DISK_PITER_REVERSE (1 << 0)/* iterate in the reverse direction */ #define DISK_PITER_INCL_EMPTY (1 << 1)/* include 0-sized parts */ #define DISK_PITER_INCL_PART0 (1 << 2)/* include partition 0 */ +#define DISK_PITER_INCL_EMPTY_PART0 (1 << 3)/* include empty partition 0 */ struct disk_part_iter {struct gendisk *disk;
PATCH 80/88 powerpc: Sanitize stack pointer in signal handling code
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Josh Boyer <[email protected]>
This has been backported to 2.6.28.x from commit efbda86098 in Linus' tree
On powerpc64 machines running 32-bit userspace, we can get garbage bits in the stack pointer passed into the kernel. Most places handle this correctly, but the signal handling code uses the passed value directly for allocating signal stack frames.
This fixes the issue by introducing a get_clean_sp function that returns a sanitized stack pointer. For 32-bit tasks on a 64-bit kernel, the stack pointer is masked correctly. In all other cases, the stack pointer is simply returned.
Additionally, we pass an 'is_32' parameter to get_sigframe now in order to get the properly sanitized stack. The callers are know to be 32 or 64-bit statically.
--- arch/powerpc/include/asm/processor.h | 19 +++++++++++++++++++ arch/powerpc/kernel/signal.c | 4 ++-- arch/powerpc/kernel/signal.h | 2 +- arch/powerpc/kernel/signal_32.c | 4 ++-- arch/powerpc/kernel/signal_64.c | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/processor.h +19 -0
@@ -309,6 +309,25 @@ static inline void prefetchw(const void#define HAVE_ARCH_PICK_MMAP_LAYOUT #endif +#ifdef CONFIG_PPC64 +static inline unsigned long get_clean_sp (struct pt_regs *regs,int is_32) +{ +unsigned long sp; + +if (is_32) + sp = regs->gpr[1 ] &0x0ffffffffUL ; +else + sp = regs->gpr[1 ]; + +return sp; +} +#else +static inline unsigned long get_clean_sp (struct pt_regs *regs,int is_32) +{ +return regs->gpr[1 ]; +} +#endif +#endif /* __KERNEL__ */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_PROCESSOR_H */
arch/powerpc/kernel/signal_32.c +2 -2
@@ -836,7 +836,7 @@ int handle_rt_signal32(unsigned long sig/* Set up Signal Frame */ /* Put a Real Time Context onto stack */ - rt_sf =get_sigframe (ka, regs,sizeof (*rt_sf)); + rt_sf =get_sigframe (ka, regs,sizeof (*rt_sf),1 ); addr = rt_sf;if (unlikely (rt_sf ==NULL )) goto badframe;
@@ -1182,7 +1182,7 @@ int handle_signal32(unsigned long sig, sunsigned long newsp =0 ;/* Set up Signal Frame */ - frame =get_sigframe (ka, regs,sizeof (*frame)); + frame =get_sigframe (ka, regs,sizeof (*frame),1 );if (unlikely (frame ==NULL )) goto badframe; sc = (struct sigcontext __user *) &frame->sctx;
arch/powerpc/kernel/signal_64.c +1 -1
@@ -402,7 +402,7 @@ int handle_rt_signal64(int signr, structunsigned long newsp =0 ;long err =0 ; - frame =get_sigframe (ka, regs,sizeof (*frame)); + frame =get_sigframe (ka, regs,sizeof (*frame),0 );if (unlikely (frame ==NULL )) goto badframe;
arch/powerpc/kernel/signal.c +2 -2
@@ -26,12 +26,12 @@ int show_unhandled_signals = 0;* Allocate space for the signal frame */ void __user *get_sigframe (struct k_sigaction *ka,struct pt_regs *regs, -size_t frame_size) +size_t frame_size,int is_32) {unsigned long oldsp, newsp;/* Default to using normal stack */ - oldsp = regs->gpr[1 ]; + oldsp =get_clean_sp (regs, is_32);/* Check for alt stack */ if ((ka->sa.sa_flags & SA_ONSTACK) &&
arch/powerpc/kernel/signal.h +1 -1
@@ -15,7 +15,7 @@extern void do_signal (struct pt_regs *regs,unsigned long thread_info_flags);extern void __user *get_sigframe (struct k_sigaction *ka,struct pt_regs *regs, -size_t frame_size); +size_t frame_size,int is_32);extern void restore_sigmask (sigset_t *set); extern int handle_signal32(unsigned long sig, struct k_sigaction *ka,
PATCH 81/88 fs core fixes
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
Please add the following 4 commits to 2.6.27-stable and 2.6.28-stable. However, there has been a lot of change here between 2.6.28 and 2.6.29:
in particular, fs/exec.c's unsafe_exec() grew into the more complicated check_unsafe_exec(). So applying the original patches gives too many
rejects: at the bottom is the diffstat and the combined patch required.
1
Commit: 53e9309e01277ec99c38e84e0ca16921287cf470
Author: Hugh Dickins <[email protected]>
Date: Sat, 28 Mar 2009 23:16:03 +0000 (+0000)
Subject: [patch 81/88] compat_do_execve should unshare_files
2
Commit: e426b64c412aaa3e9eb3e4b261dc5be0d5a83e78
Author: Hugh Dickins <[email protected]>
Date: Sat, 28 Mar 2009 23:20:19 +0000 (+0000)
Subject: [patch 81/88] fix setuid sometimes doesn't
3
Commit: 7c2c7d993044cddc5010f6f429b100c63bc7dffb
Author: Hugh Dickins <[email protected]>
Date: Sat, 28 Mar 2009 23:21:27 +0000 (+0000)
Subject: [patch 81/88] fix setuid sometimes wouldn't
4
Commit: f1191b50ec11c8e2ca766d6d99eb5bb9d2c084a3
Author: Al Viro <[email protected]>
Date: Mon, 30 Mar 2009 11:35:18 +0000 (-0400)
Subject: [patch 81/88] check_unsafe_exec() doesn't care about signal handlers sharing
--- fs/compat.c | 12 +++++++++++- fs/exec.c | 4 +--- fs/proc/base.c | 50 ++++++++++++++++---------------------------------- 3 files changed, 28 insertions(+), 38 deletions(-)
fs/compat.c +11 -1
@@ -1386,12 +1386,17 @@ int compat_do_execve(char * filename, {struct linux_binprm *bprm;struct file *file; +struct files_struct *displaced;int retval; + retval =unshare_files (&displaced); +if (retval) + goto out_ret; + retval = -ENOMEM ; bprm =kzalloc (sizeof (*bprm),GFP_KERNEL );if (!bprm) - goto out_ret; + goto out_files; file =open_exec (filename); retval =PTR_ERR (file);
@@ -1443,6 +1448,8 @@ int compat_do_execve(char * filename,security_bprm_free (bprm);acct_update_integrals (current);free_bprm (bprm); +if (displaced) +put_files_struct (displaced);return retval; }
@@ -1463,6 +1470,9 @@ out_file: out_kfree:free_bprm (bprm); +out_files: +if (displaced) +reset_files_struct (displaced); out_ret:return retval; }
fs/exec.c +1 -3
@@ -1084,9 +1084,7 @@ static int unsafe_exec(struct task_struc {int unsafe =tracehook_unsafe_exec (p); -if (atomic_read (&p->fs->count) >1 || -atomic_read (&p->files->count) >1 || -atomic_read (&p->sighand->count) >1 ) +if (atomic_read (&p->fs->count) >1 ) unsafe |=LSM_UNSAFE_SHARE ;return unsafe;
fs/proc/base.c +16 -34
102 lines not on this page · raw message
PATCH 82/88 fix ptrace slowness
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <[email protected]>
commit 53da1d9456fe7f87a920a78fdbdcf1225d197cb7 upstream.
This patch fixes bug #12208:
Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=12208
Subject : uml is very slow on 2.6.28 host
This turned out to be not a scheduler regression, but an already existing problem in ptrace being triggered by subtle scheduler changes.
The problem is this:
- task A is ptracing task B
- task B stops on a trace event
- task A is woken up and preempts task B
- task A calls ptrace on task B, which does ptrace_check_attach()
- this calls wait_task_inactive(), which sees that task B is still on the runq
- task A goes to sleep for a jiffy
- ...
Since UML does lots of the above sequences, those jiffies quickly add up to make it slow as hell.
This patch solves this by not rescheduling in read_unlock() after ptrace_stop() has woken up the tracer.
Thanks to Oleg Nesterov and Ingo Molnar for the feedback.
--- kernel/signal.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/signal.c +8 -0
@@ -1552,7 +1552,15 @@ static void ptrace_stop(int exit_code, iread_lock (&tasklist_lock);if (may_ptrace_stop ()) {do_notify_parent_cldstop (current,CLD_TRAPPED ); +/* +* Don't want to allow preemption here, because +* sys_ptrace() needs this task to be inactive. +* +* XXX: implement read_unlock_no_resched(). +*/ +preempt_disable ();read_unlock (&tasklist_lock); +preempt_enable_no_resched ();schedule (); }else {/*
PATCH 83/88 crypto: ixp4xx - Fix handling of chained sg buffers
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Hohnstaedt <[email protected]>
commit 0d44dc59b2b434b29aafeae581d06f81efac7c83 upstream.
- keep dma functions away from chained scatterlists. Use the existing scatterlist iteration inside the driver to call dma_map_single() for each chunk and avoid dma_map_sg().
--- drivers/crypto/ixp4xx_crypto.c | 184 ++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 120 deletions(-)
drivers/crypto/ixp4xx_crypto.c +64 -120
@@ -101,6 +101,7 @@ struct buffer_desc {u32 phys_addr;u32 __reserved[4 ];struct buffer_desc *next; +enum dma_data_direction dir; };struct crypt_ctl {
@@ -132,14 +133,10 @@ struct crypt_ctl {struct ablk_ctx {struct buffer_desc *src;struct buffer_desc *dst; -unsigned src_nents; -unsigned dst_nents; };struct aead_ctx {struct buffer_desc *buffer; -unsigned short assoc_nents; -unsigned short src_nents;struct scatterlist ivlist;/* used when the hmac is not on one sg entry */ u8 *hmac_virt;
@@ -312,7 +309,7 @@ static struct crypt_ctl *get_crypt_desc_ } } -static void free_buf_chain (struct buffer_desc *buf,u32 phys) +static void free_buf_chain (struct device *dev,struct buffer_desc *buf,u32 phys) {while (buf) {struct buffer_desc *buf1;
@@ -320,6 +317,7 @@ static void free_buf_chain(struct buffer buf1 = buf->next; phys1 = buf->phys_next; +dma_unmap_single (dev, buf->phys_next, buf->buf_len, buf->dir);dma_pool_free (buffer_pool, buf, phys); buf = buf1; phys = phys1;
@@ -348,7 +346,6 @@ static void one_packet(dma_addr_t phys)struct crypt_ctl *crypt;struct ixp_ctx *ctx;int failed; -enum dma_data_direction src_direction =DMA_BIDIRECTIONAL ; failed = phys &0x1 ? -EBADMSG :0 ; phys &= ~0x3 ;
@@ -358,13 +355,8 @@ static void one_packet(dma_addr_t phys)case CTL_FLAG_PERFORM_AEAD : {struct aead_request *req = crypt->data.aead_req;struct aead_ctx *req_ctx =aead_request_ctx (req); -dma_unmap_sg (dev, req->assoc, req_ctx->assoc_nents, -DMA_TO_DEVICE ); -dma_unmap_sg (dev, &req_ctx->ivlist,1 ,DMA_BIDIRECTIONAL ); -dma_unmap_sg (dev, req->src, req_ctx->src_nents, -DMA_BIDIRECTIONAL ); -free_buf_chain (req_ctx->buffer, crypt->src_buf); +free_buf_chain (dev, req_ctx->buffer, crypt->src_buf);if (req_ctx->hmac_virt) {finish_scattered_hmac (crypt); }
@@ -374,16 +366,11 @@ static void one_packet(dma_addr_t phys)case CTL_FLAG_PERFORM_ABLK : {struct ablkcipher_request *req = crypt->data.ablk_req;struct ablk_ctx *req_ctx =ablkcipher_request_ctx (req); -int nents; +if (req_ctx->dst) { - nents = req_ctx->dst_nents; -dma_unmap_sg (dev, req->dst, nents,DMA_FROM_DEVICE ); -free_buf_chain (req_ctx->dst, crypt->dst_buf); - src_direction =DMA_TO_DEVICE ; - } - nents = req_ctx->src_nents; -dma_unmap_sg (dev, req->src, nents, src_direction); -free_buf_chain (req_ctx->src, crypt->src_buf); +free_buf_chain (dev, req_ctx->dst, crypt->dst_buf); + } +free_buf_chain (dev, req_ctx->src, crypt->src_buf); req->base.complete (&req->base, failed);break ; }
@@ -748,56 +735,35 @@ static int setup_cipher(struct crypto_tfreturn 0 ; } -static int count_sg (struct scatterlist *sg,int nbytes) -{ -int i; -for (i =0 ; nbytes >0 ; i++, sg =sg_next (sg)) - nbytes -= sg->length; -return i; -} - -static struct buffer_desc *chainup_buffers (struct scatterlist *sg, -unsigned nbytes,struct buffer_desc *buf,gfp_t flags) +static struct buffer_desc *chainup_buffers (struct device *dev, +struct scatterlist *sg,unsigned nbytes, +struct buffer_desc *buf,gfp_t flags, +enum dma_data_direction dir) { -int nents =0 ; - -while (nbytes >0 ) { +for (;nbytes >0 ; sg =scatterwalk_sg_next (sg)) { +unsigned len =min (nbytes, sg->length);struct buffer_desc *next_buf;u32 next_buf_phys; -unsigned len =min (nbytes,sg_dma_len (sg)); +void *ptr; - nents++; nbytes -= len; -if (!buf->phys_addr) { - buf->phys_addr =sg_dma_address (sg); - buf->buf_len = len; - buf->next =NULL ; - buf->phys_next =0 ; - goto next; - } -/* Two consecutive chunks on one page may be handled by the old -* buffer descriptor, increased by the length of the new one -*/ -if (sg_dma_address (sg) == buf->phys_addr + buf->buf_len) { - buf->buf_len += len; - goto next; - } + ptr =page_address (sg_page (sg)) + sg->offset; next_buf =dma_pool_alloc (buffer_pool, flags, &next_buf_phys); -if (!next_buf) -return NULL ; +if (!next_buf) { + buf =NULL ; +break ; + } +sg_dma_address (sg) =dma_map_single (dev, ptr, len, dir); buf->next = next_buf; buf->phys_next = next_buf_phys; - buf = next_buf; - buf->next =NULL ; - buf->phys_next =0 ; + buf->phys_addr =sg_dma_address (sg); buf->buf_len = len; -next: -if (nbytes >0 ) { - sg =sg_next (sg); - } + buf->dir = dir; } + buf->next =NULL ; + buf->phys_next =0 ;return buf; }
@@ -858,12 +824,12 @@ static int ablk_perform(struct ablkciphestruct crypto_ablkcipher *tfm =crypto_ablkcipher_reqtfm (req);struct ixp_ctx *ctx =crypto_ablkcipher_ctx (tfm);unsigned ivsize =crypto_ablkcipher_ivsize (tfm); -int ret = -ENOMEM ;struct ix_sa_dir *dir;struct crypt_ctl *crypt; -unsigned int nbytes = req->nbytes, nents; +unsigned int nbytes = req->nbytes;enum dma_data_direction src_direction =DMA_BIDIRECTIONAL ;struct ablk_ctx *req_ctx =ablkcipher_request_ctx (req); +struct buffer_desc src_hook;gfp_t flags = req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ?GFP_KERNEL :GFP_ATOMIC ;
@@ -876,7 +842,7 @@ static int ablk_perform(struct ablkciphe crypt =get_crypt_desc ();if (!crypt) -return ret; +return -ENOMEM ; crypt->data.ablk_req = req; crypt->crypto_ctx = dir->npe_ctx_phys;
@@ -889,53 +855,41 @@ static int ablk_perform(struct ablkcipheBUG_ON (ivsize && !req->info);memcpy (crypt->iv, req->info, ivsize);if (req->src != req->dst) { +struct buffer_desc dst_hook; crypt->mode |=NPE_OP_NOT_IN_PLACE ; - nents =count_sg (req->dst, nbytes);/* This was never tested by Intel * for more than one dst buffer, I think. */ -BUG_ON (nents !=1 ); - req_ctx->dst_nents = nents; -dma_map_sg (dev, req->dst, nents,DMA_FROM_DEVICE ); - req_ctx->dst =dma_pool_alloc (buffer_pool, flags,&crypt->dst_buf); -if (!req_ctx->dst) - goto unmap_sg_dest; - req_ctx->dst->phys_addr =0 ; -if (!chainup_buffers (req->dst, nbytes, req_ctx->dst, flags)) +BUG_ON (req->dst->length < nbytes); + req_ctx->dst =NULL ; +if (!chainup_buffers (dev, req->dst, nbytes, &dst_hook, + flags,DMA_FROM_DEVICE )) goto free_buf_dest; src_direction =DMA_TO_DEVICE ; + req_ctx->dst = dst_hook.next; + crypt->dst_buf = dst_hook.phys_next; }else { req_ctx->dst =NULL ; - req_ctx->dst_nents =0 ; } - nents =count_sg (req->src, nbytes); - req_ctx->src_nents = nents; -dma_map_sg (dev, req->src, nents, src_direction); - - req_ctx->src =dma_pool_alloc (buffer_pool, flags, &crypt->src_buf); -if (!req_ctx->src) - goto unmap_sg_src; - req_ctx->src->phys_addr =0 ; -if (!chainup_buffers (req->src, nbytes, req_ctx->src, flags)) + req_ctx->src =NULL ; +if (!chainup_buffers (dev, req->src, nbytes, &src_hook, + flags, src_direction)) goto free_buf_src; + req_ctx->src = src_hook.next; + crypt->src_buf = src_hook.phys_next; crypt->ctl_flags |=CTL_FLAG_PERFORM_ABLK ;qmgr_put_entry (SEND_QID ,crypt_virt2phys (crypt));BUG_ON (qmgr_stat_overflow (SEND_QID ));return -EINPROGRESS ; free_buf_src: -free_buf_chain (req_ctx->src, crypt->src_buf); -unmap_sg_src: -dma_unmap_sg (dev, req->src, req_ctx->src_nents, src_direction); +free_buf_chain (dev, req_ctx->src, crypt->src_buf); free_buf_dest:if (req->src != req->dst) { -free_buf_chain (req_ctx->dst, crypt->dst_buf); -unmap_sg_dest: -dma_unmap_sg (dev, req->src, req_ctx->dst_nents, -DMA_FROM_DEVICE ); +free_buf_chain (dev, req_ctx->dst, crypt->dst_buf); } crypt->ctl_flags =CTL_FLAG_UNUSED ; -return ret; +return -ENOMEM ; }static int ablk_encrypt (struct ablkcipher_request *req)
@@ -983,7 +937,7 @@ static int hmac_inconsistent(struct scatbreak ; offset += sg->length; - sg =sg_next (sg); + sg =scatterwalk_sg_next (sg); }return (start + nbytes > offset + sg->length); }
@@ -995,11 +949,10 @@ static int aead_perform(struct aead_requstruct ixp_ctx *ctx =crypto_aead_ctx (tfm);unsigned ivsize =crypto_aead_ivsize (tfm);unsigned authsize =crypto_aead_authsize (tfm); -int ret = -ENOMEM ;struct ix_sa_dir *dir;struct crypt_ctl *crypt; -unsigned int cryptlen, nents; -struct buffer_desc *buf; +unsigned int cryptlen; +struct buffer_desc *buf, src_hook;struct aead_ctx *req_ctx =aead_request_ctx (req);gfp_t flags = req->base.flags &CRYPTO_TFM_REQ_MAY_SLEEP ?GFP_KERNEL :GFP_ATOMIC ;
@@ -1020,7 +973,7 @@ static int aead_perform(struct aead_requ } crypt =get_crypt_desc ();if (!crypt) -return ret; +return -ENOMEM ; crypt->data.aead_req = req; crypt->crypto_ctx = dir->npe_ctx_phys;
@@ -1039,31 +992,27 @@ static int aead_perform(struct aead_requBUG ();/* -ENOTSUP because of my lazyness */ } - req_ctx->buffer =dma_pool_alloc (buffer_pool, flags, &crypt->src_buf); -if (!req_ctx->buffer) - goto out; - req_ctx->buffer->phys_addr =0 ;/* ASSOC data */ - nents =count_sg (req->assoc, req->assoclen); - req_ctx->assoc_nents = nents; -dma_map_sg (dev, req->assoc, nents,DMA_TO_DEVICE ); - buf =chainup_buffers (req->assoc, req->assoclen, req_ctx->buffer,flags); + buf =chainup_buffers (dev, req->assoc, req->assoclen, &src_hook, + flags,DMA_TO_DEVICE ); + req_ctx->buffer = src_hook.next; + crypt->src_buf = src_hook.phys_next;if (!buf) - goto unmap_sg_assoc; + goto out;/* IV */ sg_init_table (&req_ctx->ivlist,1 );sg_set_buf (&req_ctx->ivlist, iv, ivsize); -dma_map_sg (dev, &req_ctx->ivlist,1 ,DMA_BIDIRECTIONAL ); - buf =chainup_buffers (&req_ctx->ivlist, ivsize, buf, flags); + buf =chainup_buffers (dev, &req_ctx->ivlist, ivsize, buf, flags, +DMA_BIDIRECTIONAL );if (!buf) - goto unmap_sg_iv; + goto free_chain;if (unlikely (hmac_inconsistent (req->src, cryptlen, authsize))) {/* The 12 hmac bytes are scattered, * we need to copy them into a safe buffer */ req_ctx->hmac_virt =dma_pool_alloc (buffer_pool, flags, &crypt->icv_rev_aes);if (unlikely (!req_ctx->hmac_virt)) - goto unmap_sg_iv; + goto free_chain;if (!encrypt) {scatterwalk_map_and_copy (req_ctx->hmac_virt, req->src, cryptlen, authsize,0 );
@@ -1073,33 +1022,28 @@ static int aead_perform(struct aead_requ req_ctx->hmac_virt =NULL ; }/* Crypt */ - nents =count_sg (req->src, cryptlen + authsize); - req_ctx->src_nents = nents; -dma_map_sg (dev, req->src, nents,DMA_BIDIRECTIONAL ); - buf =chainup_buffers (req->src, cryptlen + authsize, buf, flags); + buf =chainup_buffers (dev, req->src, cryptlen + authsize, buf, flags, +DMA_BIDIRECTIONAL );if (!buf) - goto unmap_sg_src; + goto free_hmac_virt;if (!req_ctx->hmac_virt) { crypt->icv_rev_aes = buf->phys_addr + buf->buf_len - authsize; } + crypt->ctl_flags |=CTL_FLAG_PERFORM_AEAD ;qmgr_put_entry (SEND_QID ,crypt_virt2phys (crypt));BUG_ON (qmgr_stat_overflow (SEND_QID ));return -EINPROGRESS ; -unmap_sg_src: -dma_unmap_sg (dev, req->src, req_ctx->src_nents,DMA_BIDIRECTIONAL ); +free_hmac_virt:if (req_ctx->hmac_virt) {dma_pool_free (buffer_pool, req_ctx->hmac_virt, crypt->icv_rev_aes); } -unmap_sg_iv: -dma_unmap_sg (dev, &req_ctx->ivlist,1 ,DMA_BIDIRECTIONAL ); -unmap_sg_assoc: -dma_unmap_sg (dev, req->assoc, req_ctx->assoc_nents,DMA_TO_DEVICE ); -free_buf_chain (req_ctx->buffer, crypt->src_buf); +free_chain: +free_buf_chain (dev, req_ctx->buffer, crypt->src_buf); out: crypt->ctl_flags =CTL_FLAG_UNUSED ; -return ret; +return -ENOMEM ; }static int aead_setup (struct crypto_aead *tfm,unsigned int authsize)
PATCH 84/88 PCI: fix incorrect mask of PM No_Soft_Reset bit
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Yu Zhao <[email protected]>
commit 998dd7c719f62dcfa91d7bf7f4eb9c160e03d817 upstream.
--- include/linux/pci_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pci_regs.h +1 -1
@@ -234,7 +234,7 @@#define PCI_PM_CAP_PME_SHIFT 11/* Start of the PME Mask in PMC */ #define PCI_PM_CTRL 4/* PM control and status register */ #define PCI_PM_CTRL_STATE_MASK 0x0003/* Current power state (D0 to D3) */ -#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004/* No reset for D3hot->D0 */ +#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008/* No reset for D3hot->D0 */ #define PCI_PM_CTRL_PME_ENABLE 0x0100/* PME pin enable */ #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00/* Data select (??) */ #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000/* Data scale (??) */
PATCH 85/88 exit_notify: kill the wrong capable(CAP_KILL) check (CVE-2009-1337)
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
CVE-2009-1337
commit 432870dab85a2f69dc417022646cb9a70acf7f94 upstream.
The CAP_KILL check in exit_notify() looks just wrong, kill it.
Whatever logic we have to reset ->exit_signal, the malicious user can bypass it if it execs the setuid application before exiting.
--- kernel/exit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/exit.c +1 -2
@@ -942,8 +942,7 @@ static void exit_notify(struct task_stru*/ if (tsk->exit_signal !=SIGCHLD && !task_detached (tsk) && (tsk->parent_exec_id != tsk->real_parent->self_exec_id || - tsk->self_exec_id != tsk->parent_exec_id) && - !capable (CAP_KILL )) + tsk->self_exec_id != tsk->parent_exec_id)) tsk->exit_signal =SIGCHLD ; signal =tracehook_notify_death (tsk, &cookie, group_dead);
PATCH 86/88 b44: Use kernel DMA addresses for the kernel DMA API
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Buesch <[email protected]>
commit 37efa239901493694a48f1d6f59f8de17c2c4509 upstream.
We must not use the device DMA addresses for the kernel DMA API, because device DMA addresses have an additional offset added for the SSB translation.
Use the original dma_addr_t for the sync operation.
--- drivers/net/b44.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/b44.c +1 -1
@@ -750,7 +750,7 @@ static void b44_recycle_rx(struct b44 *b dest_idx * sizeof(dest_desc), DMA_BIDIRECTIONAL); -ssb_dma_sync_single_for_device (bp->sdev,le32_to_cpu (src_desc->addr), +ssb_dma_sync_single_for_device (bp->sdev, dest_map->mapping,RX_PKT_BUF_SZ ,DMA_FROM_DEVICE ); }
PATCH 87/88 thinkpad-acpi: fix LED blinking through timer trigger
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Henrique de Moraes Holschuh <[email protected]>
commit 75bd3bf2ade9d548be0d2bde60b5ee0fdce0b127 upstream.
The set_blink hook code in the LED subdriver would never manage to get a LED to blink, and instead it would just turn it on. The consequence of this is that the "timer" trigger would not cause the LED to blink if given default parameters.
This problem exists since 2.6.26-rc1.
To fix it, switch the deferred LED work handling to use the thinkpad-acpi-specific LED status (off/on/blink) directly.
This also makes the code easier to read, and to extend later.
--- drivers/misc/thinkpad_acpi.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/misc/thinkpad_acpi.c +19 -22
@@ -281,11 +281,17 @@ static u32 dbg_level;static struct workqueue_struct *tpacpi_wq; +enum led_status_t { +TPACPI_LED_OFF =0 , +TPACPI_LED_ON , +TPACPI_LED_BLINK , +}; +/* Special LED class that can defer work */ struct tpacpi_led_classdev {struct led_classdev led_classdev;struct work_struct work; -enum led_brightness new_brightness; +enum led_status_t new_state;unsigned int led; };
@@ -3489,7 +3495,7 @@ static void light_set_status_worker(stru container_of(work, struct tpacpi_led_classdev, work);if (likely (tpacpi_lifecycle ==TPACPI_LIFE_RUNNING )) -light_set_status ((data->new_brightness !=LED_OFF )); +light_set_status ((data->new_state !=TPACPI_LED_OFF )); } static void light_sysfs_set(struct led_classdev *led_cdev,
@@ -3499,7 +3505,8 @@ static void light_sysfs_set(struct led_ccontainer_of (led_cdev, struct tpacpi_led_classdev, led_classdev); - data->new_brightness = brightness; + data->new_state = (brightness !=LED_OFF ) ? +TPACPI_LED_ON :TPACPI_LED_OFF ;queue_work (tpacpi_wq, &data->work); }
@@ -4006,12 +4013,6 @@ enum { /* For TPACPI_LED_OLD */ TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ }; -enum led_status_t { -TPACPI_LED_OFF =0 , -TPACPI_LED_ON , -TPACPI_LED_BLINK , -}; -static enum led_access_mode led_supported; TPACPI_HANDLE(led, ec, "SLED", /* 570 */
@@ -4105,23 +4106,13 @@ static int led_set_status(const unsignedreturn rc; } -static void led_sysfs_set_status (unsigned int led, -enum led_brightness brightness) -{ -led_set_status (led, - (brightness ==LED_OFF ) ? -TPACPI_LED_OFF : - (tpacpi_led_state_cache[led] ==TPACPI_LED_BLINK ) ? -TPACPI_LED_BLINK :TPACPI_LED_ON ); -} -static void led_set_status_worker (struct work_struct *work) {struct tpacpi_led_classdev *data = container_of(work, struct tpacpi_led_classdev, work);if (likely (tpacpi_lifecycle ==TPACPI_LIFE_RUNNING )) -led_sysfs_set_status (data->led, data->new_brightness); +led_set_status (data->led, data->new_state); } static void led_sysfs_set(struct led_classdev *led_cdev,
@@ -4130,7 +4121,13 @@ static void led_sysfs_set(struct led_clastruct tpacpi_led_classdev *data =container_of (led_cdev, struct tpacpi_led_classdev, led_classdev); - data->new_brightness = brightness; +if (brightness ==LED_OFF ) + data->new_state =TPACPI_LED_OFF ; +else if (tpacpi_led_state_cache[data->led] !=TPACPI_LED_BLINK ) + data->new_state =TPACPI_LED_ON ; +else + data->new_state =TPACPI_LED_BLINK ; +queue_work (tpacpi_wq, &data->work); }
@@ -4148,7 +4145,7 @@ static int led_sysfs_blink_set(struct le }else if ((*delay_on !=500 ) || (*delay_off !=500 ))return -EINVAL ; - data->new_brightness =TPACPI_LED_BLINK ; + data->new_state =TPACPI_LED_BLINK ;queue_work (tpacpi_wq, &data->work);return 0 ;
PATCH 88/88 unreached code in selinux_ip_postroute_iptables_compat() (CVE-2009-1184)
In reply to Greg KH2.6.28-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eugene Teo <[email protected]>
Not upstream in 2.6.30, as the function was removed there, making this a non-issue.
Node and port send checks can skip in the compat_net=1 case. This bug was introduced in commit effad8d.
--- security/selinux/hooks.c | 1 + 1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
@@ -4550,6 +4550,7 @@ static int selinux_ip_postroute_iptablesif (err)return err; err =avc_has_perm (sk_sid, if_sid,SECCLASS_NETIF , netif_perm, ad); +if (err)return err; err =sel_netnode_sid (addrp, family, &node_sid);
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.28.10 release.
NOTE! This is going to be the last release in the 2.6.28-stable series!
Could you be convinced to keep 2.6.28-stable around for a little longer?
2.6.29 is still much too young, as one can see from the size of 2.6.29.2, and the fact that the queue for 2.6.29 isn't even empty yet and there are already more patches waiting to get queued...
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 10 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.28.10 release.
NOTE! This is going to be the last release in the 2.6.28-stable series!
Could you be convinced to keep 2.6.28-stable around for a little longer?
2.6.29 is still much too young, as one can see from the size of 2.6.29.2, and the fact that the queue for 2.6.29 isn't even empty yet and there are already more patches waiting to get queued...
Why not stay on 2.6.27 if you need longer support ? I you really need some 2.6.28-specific features, it should not be *that* hard to incrementally apply next 2.6.27.X patchsets to your latest 2.6.28.Y, and this will leave you with some time to see 2.6.29 getting ready for your usage.
Just my 2 cents,
Willy
Quoted 6 lines · Henrique de Moraes Holschuh
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.28.10 release.
NOTE! This is going to be the last release in the 2.6.28-stable series!
Could you be convinced to keep 2.6.28-stable around for a little longer?
Not really.
Quoted 1 line
2.6.29 is still much too young, as one can see from the size of 2.6.29.2,
That is mostly because people are learning to submit more patches to the -stable queue, not because of any implicit problems with the 2.6.29 kernel series that I have seen.
Quoted 2 lines
and the fact that the queue for 2.6.29 isn't even empty yet and there are already more patches waiting to get queued...
Yes there are, I will work on that next. But I don't see anything "serious" in there that should be in the .28 kernel, do you?
Traditionally we've dropped the last -stable after the .2 release of the new series, why would we change that now? We only have so much time to do this kind of work, and maintaining 3 -stable trees is a major pain, trust me...
However, if you wish to take over 2.6.28 and maintain it after this release, I have no objection, just let me know.
thanks,
greg k-h
Quoted 5 lines · Greg KH
Quoted 2 lines
and the fact that the queue for 2.6.29 isn't even empty yet and there are already more patches waiting to get queued...
Yes there are, I will work on that next. But I don't see anything "serious" in there that should be in the .28 kernel, do you?
No.
Quoted 4 lines
Traditionally we've dropped the last -stable after the .2 release of the new series, why would we change that now? We only have so much time to do this kind of work, and maintaining 3 -stable trees is a major pain, trust me...
I can imagine, and I have send you "your work is much appreciated mails" before ;-)
Quoted 2 lines
However, if you wish to take over 2.6.28 and maintain it after this release, I have no objection, just let me know.
No time :( I wish I could, but I can't do it on paid time, and my hobby time is already streched way too thin...
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 1 line · Willy Tarreau
Why not stay on 2.6.27 if you need longer support ? I you really need some
I need something stable enough to not cause problems, and close enough to latest mainline to not make backporting whatever I need for thinkpad-acpi development a major chore.
Home server is already locked to 2.6.27.
Quoted 3 lines
2.6.28-specific features, it should not be *that* hard to incrementally apply next 2.6.27.X patchsets to your latest 2.6.28.Y, and this will leave you with some time to see 2.6.29 getting ready for your usage.
I think that's exactly what I will do, if needed. Thanks for the idea.
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh