2.6.29.3-stable review
Subsystems (39)
cover 2.6.29.3-stable review
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 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 Friday, May 8, 20: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.29.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- 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/kernel/xsave.c | 4 +- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.c | 5 + arch/x86/mm/kmmio.c | 2 +- arch/x86/pci/mmconfig-shared.c | 6 +- block/genhd.c | 12 ++- drivers/acpi/acpica/rscreate.c | 27 +----- drivers/char/hw_random/virtio-rng.c | 4 +- drivers/crypto/ixp4xx_crypto.c | 182 ++++++++++++---------------------- drivers/gpu/drm/i915/i915_drv.h | 4 +- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 9 ++ drivers/ide/cs5536.c | 1 + drivers/net/b44.c | 2 +- drivers/net/forcedeth.c | 3 + drivers/net/mv643xx_eth.c | 24 +++-- drivers/net/wireless/ath5k/debug.c | 2 +- drivers/net/wireless/ath9k/main.c | 5 - drivers/net/wireless/b43/dma.c | 50 ++++++++-- drivers/net/wireless/rndis_wlan.c | 14 ++- drivers/pci/dmar.c | 11 ++- drivers/pci/intel-iommu.c | 8 ++- drivers/pci/quirks.c | 1 + drivers/platform/x86/thinkpad_acpi.c | 41 ++++---- drivers/usb/serial/usb-serial.c | 99 +++++++++++++------ drivers/usb/storage/unusual_devs.h | 6 + fs/Makefile | 2 +- fs/bio.c | 3 + fs/compat.c | 27 +++++- fs/exec.c | 43 +++++--- fs/fs_struct.c | 170 +++++++++++++++++++++++++++++++ fs/internal.h | 8 ++- fs/namei.c | 7 -- fs/namespace.c | 60 ----------- fs/nfsd/nfssvc.c | 7 +- fs/proc/array.c | 13 ++- fs/proc/base.c | 55 ++++------- fs/proc/meminfo.c | 2 +- fs/proc/task_mmu.c | 4 + fs/proc/task_nommu.c | 2 +- include/drm/drm_pciids.h | 1 + include/linux/fs_struct.h | 7 +- include/linux/genhd.h | 1 + include/linux/kvm.h | 2 + include/linux/mman.h | 9 +- include/linux/pci_regs.h | 2 +- kernel/exec_domain.c | 22 ---- kernel/exit.c | 34 +------ kernel/fork.c | 62 +++++------- kernel/ptrace.c | 4 +- kernel/sched.c | 2 +- kernel/time/tick-common.c | 12 ++- mm/madvise.c | 8 ++ mm/mmap.c | 12 +- mm/nommu.c | 13 ++- mm/swap.c | 46 --------- net/mac80211/mlme.c | 2 +- net/mac80211/rx.c | 13 ++- scripts/mod/modpost.c | 1 + security/selinux/hooks.c | 1 + sound/soc/codecs/wm8580.c | 2 +- sound/usb/usx2y/us122l.c | 12 ++- virt/kvm/kvm_main.c | 11 +- 69 files changed, 682 insertions(+), 558 deletions(-)
PATCH 1/58 forcedeth: Fix resume from hibernation regression.
2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Ed Swierk <[email protected]>
upstream commit: 35a7433c789ba6df6d96b70fa745ae9e6cac0038
Reset phy state on resume, fixing a regression caused by powering down the phy on hibernate.
--- drivers/net/forcedeth.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/forcedeth.c +3 -0
@@ -5995,6 +5995,9 @@ static int nv_resume(struct pci_dev *pdefor (i =0 ;i <= np->register_size/sizeof (u32); i++)writel (np->saved_config_space[i], base+i*sizeof (u32)); +/* restore phy state, including autoneg */ +phy_init (dev); +netif_device_attach (dev);if (netif_running (dev)) { rc =nv_open (dev);
PATCH 2/58 mac80211: Fix bug in getting rx status for frames pending in reorder buffer
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vasanthakumar Thiagarajan <[email protected]>
upstream commit: b3631286aca3f54427ca0eb950981e9753866f6c
Currently rx status for frames which are completed from reorder buffer is taken from it's cb area which is not always right, cb is not holding the rx status when driver uses mac80211's non-irq rx handler to pass it's received frames. This results in dropping almost all frames from reorder buffer when security is enabled by doing double decryption (first in hw, second in sw because of wrong rx status). This patch copies rx status into cb area before the frame is put into reorder buffer. After this patch, there is a significant improvement in throughput with ath9k + WPA2(AES).
--- net/mac80211/rx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/mac80211/rx.c +9 -4
@@ -29,6 +29,7 @@static u8 ieee80211_sta_manage_reorder_buf (struct ieee80211_hw *hw,struct tid_ampdu_rx *tid_agg_rx,struct sk_buff *skb, +struct ieee80211_rx_status *status,u16 mpdu_seq_num,int bar_req);/*
@@ -1538,7 +1539,7 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_/* manage reordering buffer according to requested */ /* sequence number */ rcu_read_lock (); -ieee80211_sta_manage_reorder_buf (hw, tid_agg_rx,NULL , +ieee80211_sta_manage_reorder_buf (hw, tid_agg_rx,NULL ,NULL , start_seq_num,1 );rcu_read_unlock ();return RX_DROP_UNUSABLE ;
@@ -2034,6 +2035,7 @@ static inline u16 seq_sub(u16 sq1, u16 sstatic u8 ieee80211_sta_manage_reorder_buf (struct ieee80211_hw *hw,struct tid_ampdu_rx *tid_agg_rx,struct sk_buff *skb, +struct ieee80211_rx_status *rxstatus,u16 mpdu_seq_num,int bar_req) {
@@ -2115,6 +2117,8 @@ static u8 ieee80211_sta_manage_reorder_b/* put the frame in the reordering buffer */ tid_agg_rx->reorder_buf[index] = skb; +memcpy (tid_agg_rx->reorder_buf[index]->cb, rxstatus, +sizeof (*rxstatus)); tid_agg_rx->stored_mpdu_num++;/* release the buffer until next missing frame */ index =seq_sub (tid_agg_rx->head_seq_num, tid_agg_rx->ssn)
@@ -2140,7 +2144,8 @@ static u8 ieee80211_sta_manage_reorder_b }static u8 ieee80211_rx_reorder_ampdu (struct ieee80211_local *local, -struct sk_buff *skb) +struct sk_buff *skb, +struct ieee80211_rx_status *status) {struct ieee80211_hw *hw = &local->hw;struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -2191,7 +2196,7 @@ static u8 ieee80211_rx_reorder_ampdu(str/* according to mpdu sequence number deal with reordering buffer */ mpdu_seq_num = (sc &IEEE80211_SCTL_SEQ ) >>4 ; - ret =ieee80211_sta_manage_reorder_buf (hw, tid_agg_rx, skb, + ret =ieee80211_sta_manage_reorder_buf (hw, tid_agg_rx, skb, status, mpdu_seq_num,0 ); end_reorder:return ret;
@@ -2255,7 +2260,7 @@ void __ieee80211_rx(struct ieee80211_hwreturn ; } -if (!ieee80211_rx_reorder_ampdu (local, skb)) +if (!ieee80211_rx_reorder_ampdu (local, skb, status))__ieee80211_rx_handle_packet (hw, skb, status, rate);rcu_read_unlock ();
PATCH 3/58 b43: Poison RX buffers
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Buesch <[email protected]>
upstream commit: ec9a1d8c13e36440eda0f3c79b8149080e3ab5ba
This patch adds poisoning and sanity checking to the RX DMA buffers. This is used for protection against buggy hardware/firmware that raises RX interrupts without doing an actual DMA transfer.
This mechanism protects against rare "bad packets" (due to uninitialized skb data) and rare kernel crashes due to uninitialized RX headers.
The poison is selected to not match on valid frames and to be cheap for checking.
The poison check mechanism _might_ trigger incorrectly, if we are voluntarily receiving frames with bad PLCP headers. However, this is nonfatal, because the chance of such a match is basically zero and in case it happens it just results in dropping the packet.
Bad-PLCP RX defaults to off, and you should leave it off unless you want to listen to the latest news broadcasted by your microwave oven.
This patch also moves the initialization of the RX-header "length" field in front of the mapping of the DMA buffer. The CPU should not touch the buffer after we mapped it.
--- drivers/net/wireless/b43/dma.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-)
drivers/net/wireless/b43/dma.c +33 -4
@@ -551,11 +551,32 @@ address_error:return 1 ; } +static bool b43_rx_buffer_is_poisoned (struct b43_dmaring *ring,struct sk_buff *skb) +{ +unsigned char *f = skb->data + ring->frameoffset; + +return ((f[0 ] & f[1 ] & f[2 ] & f[3 ] & f[4 ] & f[5 ] & f[6 ] & f[7 ]) ==0xFF ); +} + +static void b43_poison_rx_buffer (struct b43_dmaring *ring,struct sk_buff *skb) +{ +struct b43_rxhdr_fw4 *rxhdr; +unsigned char *frame; + +/* This poisons the RX buffer to detect DMA failures. */ + + rxhdr = (struct b43_rxhdr_fw4 *)(skb->data); + rxhdr->frame_len =0 ; + +B43_WARN_ON (ring->rx_buffersize < ring->frameoffset +sizeof (struct b43_plcp_hdr6 ) +2 ); + frame = skb->data + ring->frameoffset; +memset (frame,0xFF ,sizeof (struct b43_plcp_hdr6 ) +2 /* padding */ ); +} +static int setup_rx_descbuffer (struct b43_dmaring *ring,struct b43_dmadesc_generic *desc,struct b43_dmadesc_meta *meta,gfp_t gfp_flags) { -struct b43_rxhdr_fw4 *rxhdr;dma_addr_t dmaaddr;struct sk_buff *skb;
@@ -564,6 +585,7 @@ static int setup_rx_descbuffer(struct b4 skb =__dev_alloc_skb (ring->rx_buffersize, gfp_flags);if (unlikely (!skb))return -ENOMEM ; +b43_poison_rx_buffer (ring, skb); dmaaddr =map_descbuffer (ring, skb->data, ring->rx_buffersize,0 );if (b43_dma_mapping_error (ring, dmaaddr, ring->rx_buffersize,0 )) {/* ugh. try to realloc in zone_dma */
@@ -574,6 +596,7 @@ static int setup_rx_descbuffer(struct b4 skb =__dev_alloc_skb (ring->rx_buffersize, gfp_flags);if (unlikely (!skb))return -ENOMEM ; +b43_poison_rx_buffer (ring, skb); dmaaddr =map_descbuffer (ring, skb->data, ring->rx_buffersize,0 ); }
@@ -589,9 +612,6 @@ static int setup_rx_descbuffer(struct b4 ring->ops->fill_descriptor (ring, desc, dmaaddr, ring->rx_buffersize,0 ,0 ,0 ); - rxhdr = (struct b43_rxhdr_fw4 *)(skb->data); - rxhdr->frame_len =0 ; -return 0 ; }
@@ -1482,6 +1502,15 @@ static void dma_rx(struct b43_dmaring *r goto drop; } } +if (unlikely (b43_rx_buffer_is_poisoned (ring, skb))) { +/* Something went wrong with the DMA. +* The device did not touch the buffer and did not overwrite the poison. */ +b43dbg (ring->dev->wl,"DMA RX: Dropping poisoned buffer.\n" ); +/* recycle the descriptor buffer. */ +sync_descbuffer_for_device (ring, meta->dmaaddr, + ring->rx_buffersize); + goto drop; + }if (unlikely (len > ring->rx_buffersize)) {/* The data did not fit into one descriptor buffer * and is split over multiple buffers.
PATCH 4/58 b43: Refresh RX poison on buffer recycling
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Michael Buesch <[email protected]>
upstream commit: cf68636a9773aa97915497fe54fa4a51e3f08f3a
The RX buffer poison needs to be refreshed, if we recycle an RX buffer, because it might be (partially) overwritten by some DMA operations.
--- drivers/net/wireless/b43/dma.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/b43/dma.c +11 -10
@@ -1496,20 +1496,16 @@ static void dma_rx(struct b43_dmaring *r len =le16_to_cpu (rxhdr->frame_len); }while (len ==0 && i++ <5 );if (unlikely (len ==0 )) { -/* recycle the descriptor buffer. */ -sync_descbuffer_for_device (ring, meta->dmaaddr, - ring->rx_buffersize); - goto drop; + dmaaddr = meta->dmaaddr; + goto drop_recycle_buffer; } }if (unlikely (b43_rx_buffer_is_poisoned (ring, skb))) {/* Something went wrong with the DMA. * The device did not touch the buffer and did not overwrite the poison. */ b43dbg (ring->dev->wl,"DMA RX: Dropping poisoned buffer.\n" ); -/* recycle the descriptor buffer. */ -sync_descbuffer_for_device (ring, meta->dmaaddr, - ring->rx_buffersize); - goto drop; + dmaaddr = meta->dmaaddr; + goto drop_recycle_buffer; }if (unlikely (len > ring->rx_buffersize)) {/* The data did not fit into one descriptor buffer
@@ -1523,6 +1519,7 @@ static void dma_rx(struct b43_dmaring *rwhile (1 ) { desc = ops->idx2desc (ring, *slot, &meta);/* recycle the descriptor buffer. */ +b43_poison_rx_buffer (ring, meta->skb);sync_descbuffer_for_device (ring, meta->dmaaddr, ring->rx_buffersize); *slot =next_slot (ring, *slot);
@@ -1541,8 +1538,7 @@ static void dma_rx(struct b43_dmaring *r err =setup_rx_descbuffer (ring, desc, meta,GFP_ATOMIC );if (unlikely (err)) {b43dbg (ring->dev->wl,"DMA RX: setup_rx_descbuffer() failed\n" ); -sync_descbuffer_for_device (ring, dmaaddr, ring->rx_buffersize); - goto drop; + goto drop_recycle_buffer; }unmap_descbuffer (ring, dmaaddr, ring->rx_buffersize,0 );
@@ -1552,6 +1548,11 @@ static void dma_rx(struct b43_dmaring *rb43_rx (ring->dev, skb, rxhdr); drop:return ; + +drop_recycle_buffer: +/* Poison and recycle the RX buffer. */ +b43_poison_rx_buffer (ring, skb); +sync_descbuffer_for_device (ring, dmaaddr, ring->rx_buffersize); }void b43_dma_rx (struct b43_dmaring *ring)
PATCH 5/58 thinkpad-acpi: fix LED blinking through timer trigger
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Henrique de Moraes Holschuh <[email protected]>
upstream commit: 75bd3bf2ade9d548be0d2bde60b5ee0fdce0b127
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/platform/x86/thinkpad_acpi.c | 41 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 22 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +19 -22
@@ -306,11 +306,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; };
@@ -4057,7 +4063,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,
@@ -4067,7 +4073,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); }
@@ -4574,12 +4581,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 */
@@ -4673,23 +4674,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,
@@ -4698,7 +4689,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); }
@@ -4716,7 +4713,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 6/58 ALSA: us122l: add snd_us122l_free()
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Karsten Wiese <[email protected]>
upstream commit: 5d4af1be06affa2b42cdf59cd376752be1f934b3
Use it to clean up snd_us122l_card_used[].
Without patch unplugging of an US122L soundcard didn't reset the corresponding element of snd_us122l_card_used[] to 0.
The (SNDRV_CARDS + 1)th plugging in did not result in creating the soundcard device anymore.
Index values supplied with the modprobe command line were not used correctly anymore after the first unplugging of an US122L.
--- sound/usb/usx2y/us122l.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
sound/usb/usx2y/us122l.c +10 -2
@@ -478,6 +478,14 @@ static bool us122l_create_card(struct snreturn true; } +static void snd_us122l_free (struct snd_card *card) +{ +struct us122l *us122l =US122L (card); +int index = us122l->chip.index; +if (index >=0 && index <SNDRV_CARDS ) + snd_us122l_card_used[index] =0 ; +} +static struct snd_card *usx2y_create_card (struct usb_device *device) {int dev;
@@ -492,7 +500,7 @@ static struct snd_card *usx2y_create_carif (!card)return NULL ; snd_us122l_card_used[US122L (card)->chip.index = dev] =1 ; - + card->private_free = snd_us122l_free;US122L (card)->chip.dev = device;US122L (card)->chip.card = card;mutex_init (&US122L (card)->mutex);
@@ -575,7 +583,7 @@ static void snd_us122l_disconnect(struct }usb_put_intf (intf); -usb_put_dev (US122L (card)->chip.dev); +usb_put_dev (us122l->chip.dev);while (atomic_read (&us122l->mmap_count))msleep (500 );
PATCH 7/58 mac80211: fix basic rate bitmap calculation
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Johannes Berg <[email protected]>
upstream commit: 7e0986c17f695952ce5d61ed793ce048ba90a661
"mac80211: fix basic rates setting from association response" introduced a copy/paste error.
Unfortunately, this not just leads to wrong data being passed to the driver but is remotely exploitable for some hardware or driver combinations.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -1342,7 +1342,7 @@ static void ieee80211_rx_mgmt_assoc_respfor (i =0 ; i < elems.ext_supp_rates_len; i++) {int rate = (elems.ext_supp_rates[i] &0x7f ) *5 ; -bool is_basic = !!(elems.supp_rates[i] &0x80 ); +bool is_basic = !!(elems.ext_supp_rates[i] &0x80 );if (rate >110 ) have_higher_than_11mbit = true;
PATCH 8/58 KVM: MMU: Fix off-by-one calculating large page count
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Avi Kivity <[email protected]>
upstream commit: 99894a799f09cf9e28296bb16e75bd5830fd2c4e
The large page initialization code concludes there are two large pages spanned by a slot covering 1 (small) page starting at gfn 1. This is incorrect, and also results in incorrect write_count initialization in some cases (base = 1, npages = 513 for example).
--- virt/kvm/kvm_main.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
virt/kvm/kvm_main.c +3 -5
@@ -964,6 +964,7 @@ int __kvm_set_memory_region(struct kvm *int r;gfn_t base_gfn;unsigned long npages; +int largepages;unsigned long i;struct kvm_memory_slot *memslot;struct kvm_memory_slot old, new;
@@ -1039,11 +1040,8 @@ int __kvm_set_memory_region(struct kvm * new.userspace_addr =0 ; }if (npages && !new.lpage_info) { -int largepages = npages /KVM_PAGES_PER_HPAGE ; -if (npages %KVM_PAGES_PER_HPAGE ) - largepages++; -if (base_gfn %KVM_PAGES_PER_HPAGE ) - largepages++; + largepages =1 + (base_gfn + npages -1 ) /KVM_PAGES_PER_HPAGE ; + largepages -= base_gfn /KVM_PAGES_PER_HPAGE ; new.lpage_info =vmalloc (largepages *sizeof (*new.lpage_info));
PATCH 9/58 KVM: MMU: disable global page optimization
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Marcelo Tosatti <[email protected]>
upstream commit: bf47a760f66add7870fba33ab50f58b550d6bbd1
Complexity to fix it not worthwhile the gains, as discussed in http://article.gmane.org/gmane.comp.emulators.kvm.devel/28649.
--- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu.c +1 -1
@@ -797,7 +797,7 @@ static struct kvm_mmu_page *kvm_mmu_alloASSERT (is_empty_shadow_page (sp->spt));bitmap_zero (sp->slot_bitmap,KVM_MEMORY_SLOTS +KVM_PRIVATE_MEM_SLOTS ); sp->multimapped =0 ; - sp->global =1 ; + sp->global =0 ; sp->parent_pte = parent_pte; --vcpu->kvm->arch.n_free_mmu_pages;return sp;
PATCH 10/58 KVM: Fix overlapping check for memory slots
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jan Kiszka <[email protected]>
upstream commit: 4cd481f68dde99ac416003b825c835f71e364393
When checking for overlapping slots on registration of a new one, kvm currently also considers zero-length (ie. deleted) slots and rejects requests incorrectly. This finally denies user space from joining slots. Fix the check by skipping deleted slots and advertise this via a KVM_CAP_JOIN_MEMORY_REGIONS_WORKS.
--- include/linux/kvm.h | 2 ++ virt/kvm/kvm_main.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/linux/kvm.h +2 -0
@@ -396,6 +396,8 @@ struct kvm_trace_rec {#ifdef __KVM_HAVE_USER_NMI#define KVM_CAP_USER_NMI 22#endif +/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ +#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30/* * ioctls for VM fds
virt/kvm/kvm_main.c +2 -1
@@ -1005,7 +1005,7 @@ int __kvm_set_memory_region(struct kvm *for (i =0 ; i <KVM_MEMORY_SLOTS ; ++i) {struct kvm_memory_slot *s = &kvm->memslots[i]; -if (s == memslot) +if (s == memslot || !s->npages)continue ;if (!((base_gfn + npages <= s->base_gfn) || (base_gfn >= s->base_gfn + s->npages)))
@@ -1997,6 +1997,7 @@ static long kvm_dev_ioctl_check_extensioswitch (arg) {case KVM_CAP_USER_MEMORY :case KVM_CAP_DESTROY_MEMORY_REGION_WORKS : +case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS :return 1 ;default :break ;
PATCH 11/58 KVM: x86: release time_page on vcpu destruction
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Joerg Roedel <[email protected]>
upstream commit: 7f1ea208968f021943d4103ba59e06bb6d8239cb
Not releasing the time_page causes a leak of that page or the compound page it is situated in.
--- arch/x86/kvm/x86.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/kvm/x86.c +5 -0
@@ -3962,6 +3962,11 @@ EXPORT_SYMBOL_GPL(kvm_put_guest_fpu);void kvm_arch_vcpu_free (struct kvm_vcpu *vcpu) { +if (vcpu->arch.time_page) { +kvm_release_page_dirty (vcpu->arch.time_page); + vcpu->arch.time_page =NULL ; + } + kvm_x86_ops->vcpu_free (vcpu); }
PATCH 12/58 USB: Unusual Device support for Gold MP3 Player Energy
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Chuck Short <[email protected]>
upstream commit: 46c6e93faa85d1362e1d127dc28cf9d0b304a6f1
Reported by Alessio Treglia on
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/125250
User was getting the following errors in dmesg:
[ 2158.139386] sd 5:0:0:1: ioctl_internal_command return code = 8000002 [ 2158.139390] : Current: sense key: No Sense [ 2158.139393] Additional sense: No additional sense information
Adds unusual device support.
modified: drivers/usb/storage/unusual_devs.h
--- drivers/usb/storage/unusual_devs.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/storage/unusual_devs.h +6 -0
@@ -2134,6 +2134,12 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_CAPACITY_HEURISTICS), +/* Reported by Alessio Treglia <[email protected]> */ +UNUSUAL_DEV (0xed10 ,0x7636 ,0x0001 ,0x0001 , +"TGE" , +"Digital MP3 Audio Player" , +US_SC_DEVICE ,US_PR_DEVICE ,NULL ,US_FL_NOT_LOCKABLE ), +/* Control/Bulk transport for all SubClass values */ USUAL_DEV (US_SC_RBC ,US_PR_CB ,USB_US_TYPE_STOR ), USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR),
PATCH 13/58 virtio-rng: Remove false BUG for spurious callbacks
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Christian Borntraeger <[email protected]>
upstream commit: e5b89542ea18020961882228c26db3ba87f6e608
The virtio-rng drivers checks for spurious callbacks. Since callbacks can be implemented via shared interrupts (e.g. PCI) this could lead to guest kernel oopses with lots of virtio devices.
--- drivers/char/hw_random/virtio-rng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/hw_random/virtio-rng.c +2 -2
@@ -37,9 +37,9 @@ static void random_recv_done(struct virt {int len; -/* We never get spurious callbacks. */ +/* We can get spurious callbacks, e.g. shared IRQs + virtio_pci. */ if (!vq->vq_ops->get_buf (vq, &len)) -BUG (); +return ; data_left = len /sizeof (random_data[0 ]);complete (&have_data);
PATCH 14/58 b44: Use kernel DMA addresses for the kernel DMA API
In reply to Greg KH2.6.29-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 15/58 block: include empty disks in /proc/diskstats
In reply to Greg KH2.6.29-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));
@@ -1011,7 +1015,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
@@ -214,6 +214,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 16/58 crypto: ixp4xx - Fix handling of chained sg buffers
In reply to Greg KH2.6.29-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 ; }
@@ -750,56 +737,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; }
@@ -860,12 +826,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 ;
@@ -878,7 +844,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;
@@ -891,53 +857,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)
@@ -985,7 +939,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); }
@@ -997,11 +951,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 ;
@@ -1022,7 +975,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;
@@ -1041,31 +994,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 );
@@ -1075,33 +1024,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 17/58 exit_notify: kill the wrong capable(CAP_KILL) check (CVE-2009-1337)
In reply to Greg KH2.6.29-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
@@ -950,8 +950,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 18/58 PCI: fix incorrect mask of PM No_Soft_Reset bit
In reply to Greg KH2.6.29-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
@@ -235,7 +235,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 19/58 unreached code in selinux_ip_postroute_iptables_compat() (CVE-2009-1184)
In reply to Greg KH2.6.29-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
@@ -4661,6 +4661,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);
PATCH 20/58 drm/i915: add support for G41 chipset
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhenyu Wang <[email protected]>
commit 72021788678523047161e97b3dfed695e802a5fd upstream.
This had been delayed for some time due to failure to work on the one piece of G41 hardware we had, and lack of success reports from anybody else. Current hardware appears to be OK.
--- drivers/gpu/drm/i915/i915_drv.h | 4 +++- include/drm/drm_pciids.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +3 -1
@@ -773,7 +773,8 @@ extern int i915_wait_ring(struct drm_dev (dev)->pci_device == 0x2A42 || \ (dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ - (dev)->pci_device == 0x2E22) + (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32)#define IS_I965GM (dev) ((dev)->pci_device == 0x2A02)
@@ -782,6 +783,7 @@ extern int i915_wait_ring(struct drm_dev#define IS_G4X (dev) ((dev)->pci_device == 0x2E02 || \ (dev)->pci_device == 0x2E12 || \ (dev)->pci_device == 0x2E22 || \ + (dev)->pci_device == 0x2E32 || \ IS_GM45(dev))#define IS_G33 (dev) ((dev)->pci_device == 0x29C2 || \
include/drm/drm_pciids.h +1 -0
@@ -418,4 +418,5 @@ {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ + {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ {0, 0, 0}
PATCH 21/58 x86-64: fix FPU corruption with signals and preemption
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Suresh Siddha <[email protected]>
commit 06c38d5e36b12d040839ff224e805146c0368556 upstream.
In 64bit signal delivery path, clear_used_math() was happening before saving the current active FPU state on to the user stack for signal handling. Between clear_used_math() and the state store on to the user stack, potentially we can get a page fault for the user address and can block. Infact, while testing we were hitting the might_fault() in __clear_user() which can do a schedule().
At a later point in time, we will schedule back into this process and resume the save state (using "xsave/fxsave" instruction) which can lead to DNA fault. And as used_math was cleared before, we will reinit the FP state in the DNA fault and continue. This reinit will result in loosing the FPU state of the process.
Move clear_used_math() to a point after the FPU state has been stored onto the user stack.
This issue is present from a long time (even before the xsave changes and the x86 merge). But it can easily be exposed in 2.6.28.x and 2.6.29.x series because of the __clear_user() in this path, which has an explicit __cond_resched() leading to a context switch with CONFIG_PREEMPT_VOLUNTARY.
[ Impact: fix FPU state corruption ]
--- arch/x86/kernel/xsave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/xsave.c +3 -1
@@ -89,7 +89,7 @@ int save_i387_xstate(void __user *buf)if (!used_math ())return 0 ; -clear_used_math ();/* trigger finit */ +if (task_thread_info (tsk)->status &TS_USEDFPU ) {/* * Start with clearing the user buffer. This will present a
@@ -114,6 +114,8 @@ int save_i387_xstate(void __user *buf)return -1 ; } +clear_used_math ();/* trigger finit */ +if (task_thread_info (tsk)->status &TS_XSAVE ) {struct _fpstate __user *fx = buf;struct _xstate __user *x = buf;
PATCH 22/58 x86/PCI: dont call e820_all_mapped with -1 in the mmconfig case
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Yinghai Lu <[email protected]>
commit 044cd80942e47b9de0915b627902adf05c52377f upstream.
e820_all_mapped need end is (addr + size) instead of (addr + size - 1)
--- arch/x86/pci/mmconfig-shared.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/pci/mmconfig-shared.c +3 -3
@@ -254,7 +254,7 @@ static acpi_status __init check_mcfg_resif (!fixmem32)return AE_OK ;if ((mcfg_res->start >= fixmem32->address) && - (mcfg_res->end < (fixmem32->address + + (mcfg_res->end <= (fixmem32->address + fixmem32->address_length))) { mcfg_res->flags =1 ;return AE_CTRL_TERMINATE ;
@@ -271,7 +271,7 @@ static acpi_status __init check_mcfg_resreturn AE_OK ;if ((mcfg_res->start >= address.minimum) && - (mcfg_res->end < (address.minimum + address.address_length))) { + (mcfg_res->end <= (address.minimum + address.address_length))) { mcfg_res->flags =1 ;return AE_CTRL_TERMINATE ; }
@@ -318,7 +318,7 @@ static int __init is_mmconf_reserved(cheu64 old_size = size;int valid =0 ; -while (!is_reserved (addr, addr + size -1 ,E820_RESERVED )) { +while (!is_reserved (addr, addr + size,E820_RESERVED )) { size >>=1 ;if (size < (16UL <<20 ))break ;
PATCH 23/58 ASoC: Fix offset of freqmode in WM8580 PLL configuration
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mark Brown <[email protected]>
commit ce88168f5b5eca7f40394fa6b05ae29f4b685569 upstream.
--- sound/soc/codecs/wm8580.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8580.c +1 -1
@@ -533,7 +533,7 @@ static int wm8580_set_dai_pll(struct snd reg =wm8580_read (codec,WM8580_PLLA4 + offset); reg &= ~0x3f ; reg |= pll_div.prescale | pll_div.postscale <<1 | - pll_div.freqmode <<4 ; + pll_div.freqmode <<3 ;wm8580_write (codec,WM8580_PLLA4 + offset, reg);
PATCH 24/58 PCI quirk: disable MSI on VIA VT3364 chipsets
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Thomas Renninger <[email protected]>
commit 162dedd39dcc6eca3fc0d29cf19658c6c13b840e upstream.
Without this patch, Broadcom BCM5906 Ethernet controllers set up via MSI cause the machine to hang. Tejun agreed that the best is to blacklist the whole chipset and after adding it, seeing the other VIA quirks disabling MSI, this very much looks like the right way.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -1960,6 +1960,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,PCI_DEVICE_ID_ATI_RS480 , quirk_disable_all_msi);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_VT3336 , quirk_disable_all_msi);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_VT3351 , quirk_disable_all_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_VT3364 , quirk_disable_all_msi);/* Disable MSI on chipsets that are known to not support it */ static void __devinit quirk_disable_msi (struct pci_dev *dev)
PATCH 25/58 bio: fix memcpy corruption in bio_copy_user_iov()
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: FUJITA Tomonori <[email protected]>
commit 69838727bcd819a8fd73a88447801221788b0c6d upstream.
st driver uses blk_rq_map_user() in order to just build a request out of page frames. In this case, map_data->offset is a non zero value and iov[0].iov_base is NULL. We need to increase nr_pages for that.
--- fs/bio.c | 3 +++ 1 file changed, 3 insertions(+)
fs/bio.c +3 -0
@@ -806,6 +806,9 @@ struct bio *bio_copy_user_iov(struct req len += iov[i].iov_len; } +if (offset) + nr_pages++; + bmd =bio_alloc_map_data (nr_pages, iov_count, gfp_mask);if (!bmd)return ERR_PTR (-ENOMEM );
PATCH 26/58 drm/i915: allow tiled front buffers on 965+
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jesse Barnes <[email protected]>
commit f544847fbaf099278343f875987a983f2b913134 upstream.
This patch corrects a pretty big oversight in the KMS code for 965+ chips. The current code is missing tiled surface register programming, so userland can allocate a tiled surface and use it for mode setting, resulting in corruption. This patch fixes that, allowing for tiled front buffers on 965+.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 9 +++++++++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -1431,6 +1431,7 @@#define DISPPLANE_NO_LINE_DOUBLE 0#define DISPPLANE_STEREO_POLARITY_FIRST 0#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) +#define DISPPLANE_TILED (1<<10)#define DSPAADDR 0x70184#define DSPASTRIDE 0x70188#define DSPAPOS 0x7018C/* reserved */
drivers/gpu/drm/i915/intel_display.c +9 -0
@@ -338,6 +338,7 @@ intel_pipe_set_base(struct drm_crtc *crtint dspbase = (pipe ==0 ?DSPAADDR :DSPBADDR );int dspsurf = (pipe ==0 ?DSPASURF :DSPBSURF );int dspstride = (pipe ==0 ) ?DSPASTRIDE :DSPBSTRIDE ; +int dsptileoff = (pipe ==0 ?DSPATILEOFF :DSPBTILEOFF );int dspcntr_reg = (pipe ==0 ) ?DSPACNTR :DSPBCNTR ;u32 dspcntr, alignment;int ret;
@@ -414,6 +415,13 @@ intel_pipe_set_base(struct drm_crtc *crtmutex_unlock (&dev->struct_mutex);return -EINVAL ; } +if (IS_I965G (dev)) { +if (obj_priv->tiling_mode !=I915_TILING_NONE ) + dspcntr |=DISPPLANE_TILED ; +else + dspcntr &= ~DISPPLANE_TILED ; + } +I915_WRITE (dspcntr_reg, dspcntr); Start = obj_priv->gtt_offset;
@@ -426,6 +434,7 @@ intel_pipe_set_base(struct drm_crtc *crtI915_READ (dspbase);I915_WRITE (dspsurf, Start);I915_READ (dspsurf); +I915_WRITE (dsptileoff, (y <<16 ) | x); }else {I915_WRITE (dspbase, Start + Offset);I915_READ (dspbase);
PATCH 27/58 pagemap: require aligned-length, non-null reads of /proc/pid/pagemap
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Vitaly Mayatskikh <[email protected]>
commit 0816178638c15ce5472d39d771a96860dff4141a upstream.
The intention of commit aae8679b0ebcaa92f99c1c3cb0cd651594a43915 ("pagemap: fix bug in add_to_pagemap, require aligned-length reads of /proc/pid/pagemap") was to force reads of /proc/pid/pagemap to be a multiple of 8 bytes, but now it allows to read 0 bytes, which actually puts some data to user's buffer. According to POSIX, if count is zero, read() should return zero and has no other results.
--- fs/proc/task_mmu.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/proc/task_mmu.c +4 -0
@@ -663,6 +663,10 @@ static ssize_t pagemap_read(struct file goto out_task; ret =0 ; + +if (!count) + goto out_task; + mm =get_task_mm (task);if (!mm) goto out_task;
PATCH 28/58 kbuild: fix Module.markers permission error under cygwin
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Cedric Hombourger <[email protected]>
commit 99e3a1eb3c22bb671c6f3d22d8244bfc9fad8185 upstream.
While building the kernel, we end-up calling modpost with -K and -M options for the same file (Modules.markers). This is resulting in modpost's main function calling read_markers() and then write_markers() on the same file.
We then have read_markers() mmap'ing the file, and writer_markers() opening that same file for writing.
The issue is that read_markers() exits without munmap'ing the file and is as a matter holding a reference on Modules.markers. When write_markers() is opening that very same file for writing, we still have a reference on it and cygwin (Windows?) is then making fopen() fail with EPERM.
Calling release_file() before exiting read_markers() clears that reference (and memory leak) and fopen() then succeeds.
Tested on both cygwin (1.3.22) and Linux. Also ran modpost within valgrind on Linux to make sure that the munmap'ed file was not accessed after read_markers()
--- scripts/mod/modpost.c | 1 + 1 file changed, 1 insertion(+)
scripts/mod/modpost.c +1 -0
@@ -2005,6 +2005,7 @@ static void read_markers(const char *fnaif (!mod->skip)add_marker (mod, marker, fmt); } +release_file (file, size);return ; fail:fatal ("parse error in markers list file\n" );
PATCH 29/58 ptrace: ptrace_attach: fix the usage of ->cred_exec_mutex
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit cad81bc2529ab8c62b6fdc83a1c0c7f4a87209eb upstream.
ptrace_attach() needs task->cred_exec_mutex, not current->cred_exec_mutex.
--- kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/ptrace.c +2 -2
@@ -186,7 +186,7 @@ int ptrace_attach(struct task_struct *ta/* Protect exec's credential calculations against our interference; * SUID, SGID and LSM creds get determined differently under ptrace. */ - retval =mutex_lock_interruptible (¤t->cred_exec_mutex); + retval =mutex_lock_interruptible (&task->cred_exec_mutex);if (retval <0 ) goto out;
@@ -230,7 +230,7 @@ repeat: bad:write_unlock_irqrestore (&tasklist_lock, flags);task_unlock (task); -mutex_unlock (¤t->cred_exec_mutex); +mutex_unlock (&task->cred_exec_mutex); out:return retval; }
PATCH 30/58 USB: serial: fix lifetime and locking problems
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Alan Stern <[email protected]>
This is commit 2d93148ab6988cad872e65d694c95e8944e1b626 back-ported to 2.6.29.
This patch (as1229-3) fixes a few lifetime and locking problems in the usb-serial driver. The main symptom is that an invalid kevent is created when the serial device is unplugged while a connection is active.
Ports should be unregistered when device is disconnected, not when the parent usb_serial structure is deallocated.
Each open file should hold a reference to the corresponding port structure, and the reference should be released when the file is closed.
serial->disc_mutex should be acquired in serial_open(), to resolve the classic race between open and disconnect.
serial_close() doesn't need to hold both serial->disc_mutex and port->mutex at the same time.
Release the subdriver's module reference only after releasing all the other references, in case one of the release routines needs to invoke some code in the subdriver module.
Replace a call to flush_scheduled_work() (which is prone to deadlocks) with cancel_work_sync(). Also, add a call to cancel_work_sync() in the disconnect routine.
Reduce the scope of serial->disc_mutex in serial_disconnect(). The only place it really needs to protect is where the "disconnected" flag is set.
Call the shutdown method from within serial_disconnect() instead of destroy_serial(), because some subdrivers expect the port data structures still to be in existence when their shutdown method runs.
This fixes the bug reported in
http://bugs.freedesktop.org/show_bug.cgi?id=20703
--- drivers/usb/serial/usb-serial.c | 99 +++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 31 deletions(-)
drivers/usb/serial/usb-serial.c +68 -31
@@ -136,22 +136,10 @@ static void destroy_serial(struct kref *dbg ("%s - %s" , __func__, serial->type->description); - serial->type->shutdown (serial); -/* return the minor range that this device had */ if (serial->minor !=SERIAL_TTY_NO_MINOR )return_serial (serial); -for (i =0 ; i < serial->num_ports; ++i) - serial->port[i]->port.count =0 ; - -/* the ports are cleaned up and released in port_release() */ -for (i =0 ; i < serial->num_ports; ++i) -if (serial->port[i]->dev.parent !=NULL ) { -device_unregister (&serial->port[i]->dev); - serial->port[i] =NULL ; - } -/* If this is a "fake" port, we have to clean it up here, as it will * not get cleaned up in port_release() as it was never registered with * the driver core */
@@ -186,7 +174,7 @@ static int serial_open (struct tty_strucstruct usb_serial *serial;struct usb_serial_port *port;unsigned int portNumber; -int retval; +int retval =0 ;dbg ("%s" , __func__);
@@ -197,16 +185,24 @@ static int serial_open (struct tty_strucreturn -ENODEV ; } +mutex_lock (&serial->disc_mutex); portNumber = tty->index - serial->minor; port = serial->port[portNumber]; -if (!port) { +if (!port || serial->disconnected) retval = -ENODEV ; - goto bailout_kref_put; - } +else +get_device (&port->dev); +/* +* Note: Our locking order requirement does not allow port->mutex +* to be acquired while serial->disc_mutex is held. +*/ +mutex_unlock (&serial->disc_mutex); +if (retval) + goto bailout_serial_put;if (mutex_lock_interruptible (&port->mutex)) { retval = -ERESTARTSYS ; - goto bailout_kref_put; + goto bailout_port_put; } ++port->port.count;
@@ -226,14 +222,20 @@ static int serial_open (struct tty_struc goto bailout_mutex_unlock; } - retval =usb_autopm_get_interface (serial->interface); +mutex_lock (&serial->disc_mutex); +if (serial->disconnected) + retval = -ENODEV ; +else + retval =usb_autopm_get_interface (serial->interface);if (retval) goto bailout_module_put; +/* only call the device specific open if this * is the first time the port is opened */ retval = serial->type->open (tty, port, filp);if (retval) goto bailout_interface_put; +mutex_unlock (&serial->disc_mutex); }mutex_unlock (&port->mutex);
@@ -242,13 +244,16 @@ static int serial_open (struct tty_struc bailout_interface_put:usb_autopm_put_interface (serial->interface); bailout_module_put: +mutex_unlock (&serial->disc_mutex);module_put (serial->type->driver.owner); bailout_mutex_unlock: port->port.count =0 ; tty->driver_data =NULL ;tty_port_tty_set (&port->port,NULL );mutex_unlock (&port->mutex); -bailout_kref_put: +bailout_port_put: +put_device (&port->dev); +bailout_serial_put:usb_serial_put (serial);return retval; }
@@ -256,6 +261,9 @@ bailout_kref_put:static void serial_close (struct tty_struct *tty,struct file *filp) {struct usb_serial_port *port = tty->driver_data; +struct usb_serial *serial; +struct module *owner; +int count;if (!port)return ;
@@ -263,6 +271,8 @@ static void serial_close(struct tty_strudbg ("%s - port %d" , __func__, port->number);mutex_lock (&port->mutex); + serial = port->serial; + owner = serial->type->driver.owner;if (port->port.count ==0 ) {mutex_unlock (&port->mutex);
@@ -275,7 +285,7 @@ static void serial_close(struct tty_stru* this before we drop the port count. The call is protected * by the port mutex */ - port->serial->type->close (tty, port, filp); + serial->type->close (tty, port, filp);if (port->port.count == (port->console ?2 :1 )) {struct tty_struct *tty =tty_port_tty_get (&port->port);
@@ -289,17 +299,23 @@ static void serial_close(struct tty_stru } } -if (port->port.count ==1 ) { -mutex_lock (&port->serial->disc_mutex); -if (!port->serial->disconnected) -usb_autopm_put_interface (port->serial->interface); -mutex_unlock (&port->serial->disc_mutex); -module_put (port->serial->type->driver.owner); - } --port->port.count; - + count = port->port.count;mutex_unlock (&port->mutex); -usb_serial_put (port->serial); +put_device (&port->dev); + +/* Mustn't dereference port any more */ +if (count ==0 ) { +mutex_lock (&serial->disc_mutex); +if (!serial->disconnected) +usb_autopm_put_interface (serial->interface); +mutex_unlock (&serial->disc_mutex); + } +usb_serial_put (serial); + +/* Mustn't dereference serial any more */ +if (count ==0 ) +module_put (owner); } static int serial_write(struct tty_struct *tty, const unsigned char *buf,
@@ -548,7 +564,13 @@ static void kill_traffic(struct usb_seristatic void port_free (struct usb_serial_port *port) { +/* +* Stop all the traffic before cancelling the work, so that +* nobody will restart it by calling usb_serial_port_softint. +*/ kill_traffic (port); +cancel_work_sync (&port->work); +usb_free_urb (port->read_urb);usb_free_urb (port->write_urb);usb_free_urb (port->interrupt_in_urb);
@@ -557,7 +579,6 @@ static void port_free(struct usb_serial_kfree (port->bulk_out_buffer);kfree (port->interrupt_in_buffer);kfree (port->interrupt_out_buffer); -flush_scheduled_work ();/* port->work */ kfree (port); }
@@ -1042,6 +1063,12 @@ void usb_serial_disconnect(struct usb_inusb_set_intfdata (interface,NULL );/* must set a flag, to signal subdrivers */ serial->disconnected =1 ; +mutex_unlock (&serial->disc_mutex); + +/* Unfortunately, many of the sub-drivers expect the port structures +* to exist when their shutdown method is called, so we have to go +* through this awkward two-step unregistration procedure. +*/ for (i =0 ; i < serial->num_ports; ++i) { port = serial->port[i];if (port) {
@@ -1051,11 +1078,21 @@ void usb_serial_disconnect(struct usb_intty_kref_put (tty); }kill_traffic (port); +cancel_work_sync (&port->work); +device_del (&port->dev); } } + serial->type->shutdown (serial); +for (i =0 ; i < serial->num_ports; ++i) { + port = serial->port[i]; +if (port) { +put_device (&port->dev); + serial->port[i] =NULL ; + } + } +/* let the last holder of this object * cause it to be cleaned up */ -mutex_unlock (&serial->disc_mutex);usb_serial_put (serial);dev_info (dev,"device disconnected\n" ); }
PATCH 31/58 ACPI: Revert conflicting workaround for BIOS w/ mangled PRT entries
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Zhang Rui <[email protected]>
upstream 82babbb3887e234c995626e4121d411ea9070ca5
backported to 2.6.29.2
2f894ef9c8b36a35d80709bedca276d2fc691941
in Linux-2.6.21 worked around BIOS with mangled _PRT entries:
http://bugzilla.kernel.org/show_bug.cgi?id=6859
d0e184abc5983281ef189db2c759d65d56eb1b80
worked around the same issue via ACPICA, and shipped in 2.6.27.
Unfortunately the two workarounds conflict:
http://bugzilla.kernel.org/show_bug.cgi?id=12270
So revert the Linux specific one.
--- drivers/acpi/acpica/rscreate.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-)
drivers/acpi/acpica/rscreate.c +2 -25
@@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union a user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);for (index =0 ; index < number_of_elements; index++) { -int source_name_index =2 ; -int source_index_index =3 ;/* * Point user_prt past this current structure
@@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union areturn_ACPI_STATUS (AE_BAD_DATA ); } -/* -* If BIOS erroneously reversed the _PRT source_name and source_index, -* then reverse them back. -*/ -if (ACPI_GET_OBJECT_TYPE (sub_object_list[3 ]) != -ACPI_TYPE_INTEGER ) { -if (acpi_gbl_enable_interpreter_slack) { - source_name_index =3 ; - source_index_index =2 ; -printk (KERN_WARNING -"ACPI: Handling Garbled _PRT entry\n" ); - }else { -ACPI_ERROR ((AE_INFO , -"(PRT[%X].source_index) Need Integer, found %s" , - index, -acpi_ut_get_object_type_name - (sub_object_list[3 ]))); -return_ACPI_STATUS (AE_BAD_DATA ); - } - } - user_prt->pin = (u32 ) obj_desc->integer.value;/*
@@ -305,7 +282,7 @@ acpi_rs_create_pci_routing_table(union a* 3) Third subobject: Dereference the PRT.source_name * The name may be unresolved (slack mode), so allow a null object */ - obj_desc = sub_object_list[source_name_index]; + obj_desc = sub_object_list[2 ];if (obj_desc) {switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {case ACPI_TYPE_LOCAL_REFERENCE :
@@ -379,7 +356,7 @@ acpi_rs_create_pci_routing_table(union a/* 4) Fourth subobject: Dereference the PRT.source_index */ - obj_desc = sub_object_list[source_index_index]; + obj_desc = sub_object_list[3 ];if (ACPI_GET_OBJECT_TYPE (obj_desc) !=ACPI_TYPE_INTEGER ) { ACPI_ERROR((AE_INFO, "(PRT[%X].SourceIndex) Need Integer, found %s",
PATCH 32/58 powerpc: Sanitize stack pointer in signal handling code
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Josh Boyer <[email protected]>
This has been backported to 2.6.29.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
@@ -313,6 +313,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 33/58 compat_do_execve should unshare_files
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
commit 53e9309e01277ec99c38e84e0ca16921287cf470 upstream.
2.6.26's commit fd8328be874f4190a811c58cd4778ec2c74d2c05 "sanitize handling of shared descriptor tables in failing execve()" moved the unshare_files() from flush_old_exec() and several binfmts to the head of do_execve(); but forgot to make the same change to compat_do_execve(), leaving a CLONE_FILES files_struct shared across exec from a 32-bit process on a 64-bit kernel.
It's arguable whether the files_struct really ought to be unshared across exec; but 2.6.1 made that so to stop the loading binary's fd leaking into other threads, and a 32-bit process on a 64-bit kernel ought to behave in the same way as 32 on 32 and 64 on 64.
--- fs/compat.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/compat.c +11 -1
@@ -1392,12 +1392,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; retval =mutex_lock_interruptible (¤t->cred_exec_mutex);if (retval <0 )
@@ -1457,6 +1462,8 @@ int compat_do_execve(char * filename,mutex_unlock (¤t->cred_exec_mutex);acct_update_integrals (current);free_bprm (bprm); +if (displaced) +put_files_struct (displaced);return retval; out:
@@ -1475,6 +1482,9 @@ out_unlock: out_free:free_bprm (bprm); +out_files: +if (displaced) +reset_files_struct (displaced); out_ret:return retval; }
PATCH 34/58 fix setuid sometimes doesnt
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
commit e426b64c412aaa3e9eb3e4b261dc5be0d5a83e78 upstream.
Joe Malicki reports that setuid sometimes doesn't: very rarely, a setuid root program does not get root euid; and, by the way, they have a health check running lsof every few minutes.
Right, check_unsafe_exec() notes whether the files_struct is being shared by more threads than will get killed by the exec, and if so sets LSM_UNSAFE_SHARE to make bprm_set_creds() careful about euid. But /proc/<pid>/fd and /proc/<pid>/fdinfo lookups make transient use of get_files_struct(), which also raises that sharing count.
There's a rather simple fix for this: exec's check on files->count has been redundant ever since 2.6.1 made it unshare_files() (except while compat_do_execve() omitted to do so) - just remove that check.
[Note to -stable: this patch will not apply before 2.6.29: earlier releases should just remove the files->count line from unsafe_exec().]
--- fs/compat.c | 2 +- fs/exec.c | 10 +++------- fs/internal.h | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-)
fs/compat.c +1 -1
@@ -1412,7 +1412,7 @@ int compat_do_execve(char * filename, bprm->cred =prepare_exec_creds ();if (!bprm->cred) goto out_unlock; -check_unsafe_exec (bprm, current->files); +check_unsafe_exec (bprm); file =open_exec (filename); retval =PTR_ERR (file);
fs/exec.c +3 -7
@@ -1049,28 +1049,24 @@ EXPORT_SYMBOL(install_exec_creds);* - the caller must hold current->cred_exec_mutex to protect against * PTRACE_ATTACH */ -void check_unsafe_exec (struct linux_binprm *bprm,struct files_struct *files) +void check_unsafe_exec (struct linux_binprm *bprm) {struct task_struct *p = current, *t;unsigned long flags; -unsigned n_fs, n_files, n_sighand; +unsigned n_fs, n_sighand; bprm->unsafe =tracehook_unsafe_exec (p); n_fs =1 ; - n_files =1 ; n_sighand =1 ;lock_task_sighand (p, &flags);for (t =next_thread (p); t != p; t =next_thread (t)) {if (t->fs == p->fs) n_fs++; -if (t->files == files) - n_files++; n_sighand++; }if (atomic_read (&p->fs->count) > n_fs || -atomic_read (&p->files->count) > n_files ||atomic_read (&p->sighand->count) > n_sighand) bprm->unsafe |=LSM_UNSAFE_SHARE ;
@@ -1289,7 +1285,7 @@ int do_execve(char * filename, bprm->cred =prepare_exec_creds ();if (!bprm->cred) goto out_unlock; -check_unsafe_exec (bprm, displaced); +check_unsafe_exec (bprm); file =open_exec (filename); retval =PTR_ERR (file);
fs/internal.h +1 -1
@@ -43,7 +43,7 @@ extern void __init chrdev_init(void);/* * exec.c */ -extern void check_unsafe_exec (struct linux_binprm *,struct files_struct *); +extern void check_unsafe_exec (struct linux_binprm *);/* * namespace.c
PATCH 35/58 fix setuid sometimes wouldnt
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Hugh Dickins <[email protected]>
commit 7c2c7d993044cddc5010f6f429b100c63bc7dffb upstream.
check_unsafe_exec() also notes whether the fs_struct is being shared by more threads than will get killed by the exec, and if so sets LSM_UNSAFE_SHARE to make bprm_set_creds() careful about euid. But /proc/<pid>/cwd and /proc/<pid>/root lookups make transient use of get_fs_struct(), which also raises that sharing count.
This might occasionally cause a setuid program not to change euid, in the same way as happened with files->count (check_unsafe_exec also looks at sighand->count, but /proc doesn't raise that one).
We'd prefer exec not to unshare fs_struct: so fix this in procfs, replacing get_fs_struct() by get_fs_path(), which does path_get while still holding task_lock, instead of raising fs->count.
--- fs/proc/base.c | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-)
fs/proc/base.c +16 -34
@@ -146,15 +146,22 @@ static unsigned int pid_entry_count_dirsreturn count; } -static struct fs_struct *get_fs_struct (struct task_struct *task) +static int get_fs_path (struct task_struct *task,struct path *path,bool root) {struct fs_struct *fs; +int result = -ENOENT ; +task_lock (task); fs = task->fs; -if (fs) -atomic_inc (&fs->count); +if (fs) { +read_lock (&fs->lock); + *path = root ? fs->root : fs->pwd; +path_get (path); +read_unlock (&fs->lock); + result =0 ; + }task_unlock (task); -return fs; +return result; }static int get_nr_threads (struct task_struct *tsk)
@@ -172,42 +179,24 @@ static int get_nr_threads(struct task_ststatic int proc_cwd_link (struct inode *inode,struct path *path) {struct task_struct *task =get_proc_task (inode); -struct fs_struct *fs =NULL ;int result = -ENOENT ;if (task) { - fs =get_fs_struct (task); + result =get_fs_path (task, path,0 );put_task_struct (task); } -if (fs) { -read_lock (&fs->lock); - *path = fs->pwd; -path_get (&fs->pwd); -read_unlock (&fs->lock); - result =0 ; -put_fs_struct (fs); - }return result; }static int proc_root_link (struct inode *inode,struct path *path) {struct task_struct *task =get_proc_task (inode); -struct fs_struct *fs =NULL ;int result = -ENOENT ;if (task) { - fs =get_fs_struct (task); + result =get_fs_path (task, path,1 );put_task_struct (task); } -if (fs) { -read_lock (&fs->lock); - *path = fs->root; -path_get (&fs->root); -read_unlock (&fs->lock); - result =0 ; -put_fs_struct (fs); - }return result; }
@@ -596,7 +585,6 @@ static int mounts_open_common(struct inostruct task_struct *task =get_proc_task (inode);struct nsproxy *nsp;struct mnt_namespace *ns =NULL ; -struct fs_struct *fs =NULL ;struct path root;struct proc_mounts *p;int ret = -EINVAL ;
@@ -610,22 +598,16 @@ static int mounts_open_common(struct inoget_mnt_ns (ns); }rcu_read_unlock (); -if (ns) - fs =get_fs_struct (task); +if (ns &&get_fs_path (task, &root,1 ) ==0 ) + ret =0 ;put_task_struct (task); }if (!ns) goto err; -if (!fs) +if (ret) goto err_put_ns; -read_lock (&fs->lock); - root = fs->root; -path_get (&root); -read_unlock (&fs->lock); -put_fs_struct (fs); - ret = -ENOMEM ; p =kmalloc (sizeof (struct proc_mounts ),GFP_KERNEL );if (!p)
PATCH 36/58 Annotate struct fs_structs usage count restriction
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Howells <[email protected]>
commit 795e2fe0a3b69dbc040d7efcf517e0cbad6901d0 upstream.
Annotate struct fs_struct's usage count to indicate the restrictions upon it. It may not be incremented, except by clone(CLONE_FS), as this affects the check in check_unsafe_exec() in fs/exec.c.
--- include/linux/fs_struct.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/fs_struct.h +4 -1
@@ -4,7 +4,10 @@#include <linux/path.h> struct fs_struct { -atomic_t count; +atomic_t count;/* This usage count is used by check_unsafe_exec() for +* security checking purposes - therefore it may not be +* incremented, except by clone(CLONE_FS). +*/ rwlock_t lock;int umask;struct path root, pwd;
PATCH 37/58 Kill unsharing fs_struct in __set_personality()
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit 11d06b2a1e5658f448a308aa3beb97bacd64a940 upstream.
That's a rudiment of altroot support. I.e. it should've been buried a long time ago.
kernel/exec_domain.c +0 -22
@@ -145,28 +145,6 @@ __set_personality(u_long personality)return 0 ; } -if (atomic_read (¤t->fs->count) !=1 ) { -struct fs_struct *fsp, *ofsp; - - fsp =copy_fs_struct (current->fs); -if (fsp ==NULL ) { -module_put (ep->module); -return -ENOMEM ; - } - -task_lock (current); - ofsp = current->fs; - current->fs = fsp; -task_unlock (current); - -put_fs_struct (ofsp); - } - -/* -* At that point we are guaranteed to be the sole owner of -* current->fs. -*/ - current->personality = personality; oep =current_thread_info ()->exec_domain;current_thread_info ()->exec_domain = ep;
PATCH 38/58 Get rid of bumping fs_struct refcount in pivot_root(2)
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit f8ef3ed2bebd2c4cb9ece92efa185d7aead8831a upstream.
Not because execve races with _that_ are serious - we really need a situation when final drop of fs_struct refcount is done by something that used to have it as current->fs.
--- fs/namespace.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
fs/namespace.c +17 -9
@@ -2127,25 +2127,33 @@ static void chroot_fs_refs(struct path * {struct task_struct *g, *p;struct fs_struct *fs; +int count =0 ;read_lock (&tasklist_lock); do_each_thread(g, p) {task_lock (p); fs = p->fs;if (fs) { -atomic_inc (&fs->count); -task_unlock (p); +write_lock (&fs->lock);if (fs->root.dentry == old_root->dentry - && fs->root.mnt == old_root->mnt) -set_fs_root (fs, new_root); + && fs->root.mnt == old_root->mnt) { +path_get (new_root); + fs->root = *new_root; + count++; + }if (fs->pwd.dentry == old_root->dentry - && fs->pwd.mnt == old_root->mnt) -set_fs_pwd (fs, new_root); -put_fs_struct (fs); - }else -task_unlock (p); + && fs->pwd.mnt == old_root->mnt) { +path_get (new_root); + fs->pwd = *new_root; + count++; + } +write_unlock (&fs->lock); + } +task_unlock (p); }while_each_thread (g, p);read_unlock (&tasklist_lock); +while (count--) +path_put (old_root); }/*
PATCH 39/58 Take fs_struct handling to new file (fs/fs_struct.c)
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit 3e93cd671813e204c258f1e6c797959920cf7772 upstream.
Pure code move; two new helper functions for nfsd and daemonize (unshare_fs_struct() and daemonize_fs_struct() resp.; for now - the same code as used to be in callers). unshare_fs_struct() exported (for nfsd, as copy_fs_struct()/exit_fs() used to be), copy_fs_struct() and exit_fs() don't need exports anymore.
--- fs/Makefile | 2 fs/fs_struct.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++ fs/internal.h | 6 + fs/namei.c | 7 -- fs/namespace.c | 68 ---------------------- fs/nfsd/nfssvc.c | 7 -- include/linux/fs_struct.h | 2 kernel/exit.c | 31 ---------- kernel/fork.c | 29 --------- 9 files changed, 155 insertions(+), 138 deletions(-)
fs/fs_struct.c new file +141 -0
@@ -0,0 +1,141 @@ +#include <linux/module.h> +#include <linux/sched.h> +#include <linux/fs.h> +#include <linux/path.h> +#include <linux/slab.h> + +/* +* Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. +* It can block. +*/ +void set_fs_root (struct fs_struct *fs,struct path *path) +{ +struct path old_root; + +write_lock (&fs->lock); + old_root = fs->root; + fs->root = *path; +path_get (path); +write_unlock (&fs->lock); +if (old_root.dentry) +path_put (&old_root); +} + +/* +* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. +* It can block. +*/ +void set_fs_pwd (struct fs_struct *fs,struct path *path) +{ +struct path old_pwd; + +write_lock (&fs->lock); + old_pwd = fs->pwd; + fs->pwd = *path; +path_get (path); +write_unlock (&fs->lock); + +if (old_pwd.dentry) +path_put (&old_pwd); +} + +void chroot_fs_refs (struct path *old_root,struct path *new_root) +{ +struct task_struct *g, *p; +struct fs_struct *fs; +int count =0 ; + +read_lock (&tasklist_lock); + do_each_thread(g, p) { +task_lock (p); + fs = p->fs; +if (fs) { +write_lock (&fs->lock); +if (fs->root.dentry == old_root->dentry + && fs->root.mnt == old_root->mnt) { +path_get (new_root); + fs->root = *new_root; + count++; + } +if (fs->pwd.dentry == old_root->dentry + && fs->pwd.mnt == old_root->mnt) { +path_get (new_root); + fs->pwd = *new_root; + count++; + } +write_unlock (&fs->lock); + } +task_unlock (p); + }while_each_thread (g, p); +read_unlock (&tasklist_lock); +while (count--) +path_put (old_root); +} + +void put_fs_struct (struct fs_struct *fs) +{ +/* No need to hold fs->lock if we are killing it */ +if (atomic_dec_and_test (&fs->count)) { +path_put (&fs->root); +path_put (&fs->pwd); +kmem_cache_free (fs_cachep, fs); + } +} + +void exit_fs (struct task_struct *tsk) +{ +struct fs_struct * fs = tsk->fs; + +if (fs) { +task_lock (tsk); + tsk->fs =NULL ; +task_unlock (tsk); +put_fs_struct (fs); + } +} + +struct fs_struct *copy_fs_struct (struct fs_struct *old) +{ +struct fs_struct *fs =kmem_cache_alloc (fs_cachep,GFP_KERNEL ); +/* We don't need to lock fs - think why ;-) */ +if (fs) { +atomic_set (&fs->count,1 ); +rwlock_init (&fs->lock); + fs->umask = old->umask; +read_lock (&old->lock); + fs->root = old->root; +path_get (&old->root); + fs->pwd = old->pwd; +path_get (&old->pwd); +read_unlock (&old->lock); + } +return fs; +} + +int unshare_fs_struct (void ) +{ +struct fs_struct *fsp =copy_fs_struct (current->fs); +if (!fsp) +return -ENOMEM ; +exit_fs (current); + current->fs = fsp; +return 0 ; +} +EXPORT_SYMBOL_GPL (unshare_fs_struct); + +/* to be mentioned only in INIT_TASK */ +struct fs_struct init_fs = { + .count =ATOMIC_INIT (1 ), + .lock =__RW_LOCK_UNLOCKED (init_fs.lock), + .umask =0022 , +}; + +void daemonize_fs_struct (void ) +{ +struct fs_struct *fs; + +exit_fs (current);/* current->fs->count--; */ + fs = &init_fs; + current->fs = fs; +atomic_inc (&fs->count); +}
fs/internal.h +6 -0
@@ -11,6 +11,7 @@struct super_block ;struct linux_binprm ; +struct path ;/* * block_dev.c
@@ -60,3 +61,8 @@ extern void umount_tree(struct vfsmountextern struct vfsmount *copy_tree (struct vfsmount *,struct dentry *,int );extern void __init mnt_init (void ); + +/* +* fs_struct.c +*/ +extern void chroot_fs_refs (struct path *,struct path *);
fs/Makefile +1 -1
@@ -11,7 +11,7 @@ obj-y := open.o read_write.o file_table. attr.o bad_inode.o file.o filesystems.o namespace.o \ seq_file.o xattr.o libfs.o fs-writeback.o \ pnode.o drop_caches.o splice.o sync.o utimes.o \ - stack.o + stack.o fs_struct.o ifeq ($(CONFIG_BLOCK),y) obj-y += buffer.o bio.o block_dev.o direct-io.o mpage.o ioprio.o
fs/namei.c +0 -7
@@ -2891,10 +2891,3 @@ EXPORT_SYMBOL(vfs_symlink);EXPORT_SYMBOL (vfs_unlink);EXPORT_SYMBOL (dentry_unhash);EXPORT_SYMBOL (generic_readlink); - -/* to be mentioned only in INIT_TASK */ -struct fs_struct init_fs = { - .count =ATOMIC_INIT (1 ), - .lock =__RW_LOCK_UNLOCKED (init_fs.lock), - .umask =0022 , -};
fs/namespace.c +0 -68
74 lines not on this page · raw message
fs/nfsd/nfssvc.c +2 -5
@@ -404,7 +404,6 @@ static int nfsd(void *vrqstp) {struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp; -struct fs_struct *fsp;int err, preverr =0 ;/* Lock module and set up kernel thread */
@@ -413,13 +412,11 @@ nfsd(void *vrqstp)/* At this point, the thread shares current->fs * with the init process. We need to create files with a * umask of 0 instead of init's umask. */ - fsp =copy_fs_struct (current->fs); -if (!fsp) { +if (unshare_fs_struct () <0 ) {printk ("Unable to start nfsd thread: out of memory\n" ); goto out; } -exit_fs (current); - current->fs = fsp; + current->fs->umask =0 ;/*
include/linux/fs_struct.h +2 -0
@@ -20,5 +20,7 @@ extern void set_fs_root(struct fs_structextern void set_fs_pwd (struct fs_struct *,struct path *);extern struct fs_struct *copy_fs_struct (struct fs_struct *);extern void put_fs_struct (struct fs_struct *); +extern void daemonize_fs_struct (void ); +extern int unshare_fs_struct (void );#endif /* _LINUX_FS_STRUCT_H */
kernel/exit.c +1 -30
@@ -429,7 +429,6 @@ EXPORT_SYMBOL(disallow_signal);void daemonize (const char *name, ...) {va_list args; -struct fs_struct *fs;sigset_t blocked;va_start (args, name);
@@ -462,11 +461,7 @@ void daemonize(const char *name, ...)/* Become as one with the init task */ -exit_fs (current);/* current->fs->count--; */ - fs = init_task.fs; - current->fs = fs; -atomic_inc (&fs->count); - +daemonize_fs_struct ();exit_files (current); current->files = init_task.files;atomic_inc (¤t->files->count);
@@ -565,30 +560,6 @@ void exit_files(struct task_struct *tsk) } } -void put_fs_struct (struct fs_struct *fs) -{ -/* No need to hold fs->lock if we are killing it */ -if (atomic_dec_and_test (&fs->count)) { -path_put (&fs->root); -path_put (&fs->pwd); -kmem_cache_free (fs_cachep, fs); - } -} - -void exit_fs (struct task_struct *tsk) -{ -struct fs_struct * fs = tsk->fs; - -if (fs) { -task_lock (tsk); - tsk->fs =NULL ; -task_unlock (tsk); -put_fs_struct (fs); - } -} - -EXPORT_SYMBOL_GPL (exit_fs); -#ifdef CONFIG_MM_OWNER /* * Task p is exiting and it owned mm, lets find a new owner for it
kernel/fork.c +2 -27
@@ -676,38 +676,13 @@ fail_nomem:return retval; } -static struct fs_struct *__copy_fs_struct (struct fs_struct *old) -{ -struct fs_struct *fs =kmem_cache_alloc (fs_cachep,GFP_KERNEL ); -/* We don't need to lock fs - think why ;-) */ -if (fs) { -atomic_set (&fs->count,1 ); -rwlock_init (&fs->lock); - fs->umask = old->umask; -read_lock (&old->lock); - fs->root = old->root; -path_get (&old->root); - fs->pwd = old->pwd; -path_get (&old->pwd); -read_unlock (&old->lock); - } -return fs; -} - -struct fs_struct *copy_fs_struct (struct fs_struct *old) -{ -return __copy_fs_struct (old); -} - -EXPORT_SYMBOL_GPL (copy_fs_struct); -static int copy_fs (unsigned long clone_flags,struct task_struct *tsk) {if (clone_flags &CLONE_FS ) {atomic_inc (¤t->fs->count);return 0 ; } - tsk->fs =__copy_fs_struct (current->fs); + tsk->fs =copy_fs_struct (current->fs);if (!tsk->fs)return -ENOMEM ;return 0 ;
@@ -1545,7 +1520,7 @@ static int unshare_fs(unsigned long unshif ((unshare_flags &CLONE_FS ) && (fs &&atomic_read (&fs->count) >1 )) { - *new_fsp =__copy_fs_struct (current->fs); + *new_fsp =copy_fs_struct (current->fs);if (!*new_fsp)return -ENOMEM ; }
PATCH 40/58 New locking/refcounting for fs_struct
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit 498052bba55ecaff58db6a1436b0e25bfd75a7ff upstream.
* all changes of current->fs are done under task_lock and write_lock of old fs->lock
* refcount is not atomic anymore (same protection)
* its decrements are done when removing reference from current; at the same time we decide whether to free it.
* put_fs_struct() is gone
* new field - ->in_exec. Set by check_unsafe_exec() if we are trying to do execve() and only subthreads share fs_struct. Cleared when finishing exec (success and failure alike). Makes CLONE_FS fail with -EAGAIN if set.
* check_unsafe_exec() may fail with -EAGAIN if another execve() from subthread is in progress.
--- fs/compat.c | 16 +++++++++- fs/exec.c | 31 +++++++++++++++++--- fs/fs_struct.c | 69 ++++++++++++++++++++++++++++++++-------------- fs/internal.h | 2 - fs/proc/task_nommu.c | 2 - include/linux/fs_struct.h | 8 ++--- kernel/fork.c | 37 ++++++++++++++++++------ 7 files changed, 121 insertions(+), 44 deletions(-)
fs/compat.c +14 -2
@@ -51,6 +51,7 @@#include <linux/poll.h> #include <linux/mm.h> #include <linux/eventpoll.h> +#include <linux/fs_struct.h> #include <asm/uaccess.h> #include <asm/mmu_context.h>
@@ -1412,12 +1413,15 @@ int compat_do_execve(char * filename, bprm->cred =prepare_exec_creds ();if (!bprm->cred) goto out_unlock; -check_unsafe_exec (bprm); + + retval =check_unsafe_exec (bprm); +if (retval) + goto out_unlock; file =open_exec (filename); retval =PTR_ERR (file);if (IS_ERR (file)) - goto out_unlock; + goto out_unmark;sched_exec ();
@@ -1459,6 +1463,9 @@ int compat_do_execve(char * filename, goto out;/* execve succeeded */ +write_lock (¤t->fs->lock); + current->fs->in_exec =0 ; +write_unlock (¤t->fs->lock);mutex_unlock (¤t->cred_exec_mutex);acct_update_integrals (current);free_bprm (bprm);
@@ -1476,6 +1483,11 @@ out_file:fput (bprm->file); } +out_unmark: +write_lock (¤t->fs->lock); + current->fs->in_exec =0 ; +write_unlock (¤t->fs->lock); + out_unlock:mutex_unlock (¤t->cred_exec_mutex);
fs/exec.c +26 -5
@@ -1049,16 +1049,18 @@ EXPORT_SYMBOL(install_exec_creds);* - the caller must hold current->cred_exec_mutex to protect against * PTRACE_ATTACH */ -void check_unsafe_exec (struct linux_binprm *bprm) +int check_unsafe_exec (struct linux_binprm *bprm) {struct task_struct *p = current, *t;unsigned long flags;unsigned n_fs, n_sighand; +int res =0 ; bprm->unsafe =tracehook_unsafe_exec (p); n_fs =1 ; n_sighand =1 ; +write_lock (&p->fs->lock);lock_task_sighand (p, &flags);for (t =next_thread (p); t != p; t =next_thread (t)) {if (t->fs == p->fs)
@@ -1066,11 +1068,19 @@ void check_unsafe_exec(struct linux_binp n_sighand++; } -if (atomic_read (&p->fs->count) > n_fs || -atomic_read (&p->sighand->count) > n_sighand) +if (p->fs->users > n_fs || +atomic_read (&p->sighand->count) > n_sighand) { bprm->unsafe |=LSM_UNSAFE_SHARE ; + }else { +if (p->fs->in_exec) + res = -EAGAIN ; + p->fs->in_exec =1 ; + }unlock_task_sighand (p, &flags); +write_unlock (&p->fs->lock); + +return res; }/*
@@ -1285,12 +1295,15 @@ int do_execve(char * filename, bprm->cred =prepare_exec_creds ();if (!bprm->cred) goto out_unlock; -check_unsafe_exec (bprm); + + retval =check_unsafe_exec (bprm); +if (retval) + goto out_unlock; file =open_exec (filename); retval =PTR_ERR (file);if (IS_ERR (file)) - goto out_unlock; + goto out_unmark;sched_exec ();
@@ -1333,6 +1346,9 @@ int do_execve(char * filename, goto out;/* execve succeeded */ +write_lock (¤t->fs->lock); + current->fs->in_exec =0 ; +write_unlock (¤t->fs->lock);mutex_unlock (¤t->cred_exec_mutex);acct_update_integrals (current);free_bprm (bprm);
@@ -1350,6 +1366,11 @@ out_file:fput (bprm->file); } +out_unmark: +write_lock (¤t->fs->lock); + current->fs->in_exec =0 ; +write_unlock (¤t->fs->lock); + out_unlock:mutex_unlock (¤t->cred_exec_mutex);
fs/fs_struct.c +49 -20
109 lines not on this page · raw message
fs/internal.h +1 -1
@@ -44,7 +44,7 @@ extern void __init chrdev_init(void);/* * exec.c */ -extern void check_unsafe_exec (struct linux_binprm *); +extern int check_unsafe_exec (struct linux_binprm *);/* * namespace.c
fs/proc/task_nommu.c +1 -1
@@ -49,7 +49,7 @@ void task_mem(struct seq_file *m, structelse bytes +=kobjsize (mm); -if (current->fs &&atomic_read (¤t->fs->count) >1 ) +if (current->fs && current->fs->users >1 ) sbytes +=kobjsize (current->fs);else bytes +=kobjsize (current->fs);
include/linux/fs_struct.h +3 -5
@@ -4,12 +4,10 @@#include <linux/path.h> struct fs_struct { -atomic_t count;/* This usage count is used by check_unsafe_exec() for -* security checking purposes - therefore it may not be -* incremented, except by clone(CLONE_FS). -*/ +int users;rwlock_t lock;int umask; +int in_exec;struct path root, pwd; };
@@ -19,7 +17,7 @@ extern void exit_fs(struct task_struct *extern void set_fs_root (struct fs_struct *,struct path *);extern void set_fs_pwd (struct fs_struct *,struct path *);extern struct fs_struct *copy_fs_struct (struct fs_struct *); -extern void put_fs_struct (struct fs_struct *); +extern void free_fs_struct (struct fs_struct *);extern void daemonize_fs_struct (void );extern int unshare_fs_struct (void );
kernel/fork.c +27 -10
@@ -678,11 +678,19 @@ fail_nomem:static int copy_fs (unsigned long clone_flags,struct task_struct *tsk) { +struct fs_struct *fs = current->fs;if (clone_flags &CLONE_FS ) { -atomic_inc (¤t->fs->count); +/* tsk->fs is already what we want */ +write_lock (&fs->lock); +if (fs->in_exec) { +write_unlock (&fs->lock); +return -EAGAIN ; + } + fs->users++; +write_unlock (&fs->lock);return 0 ; } - tsk->fs =copy_fs_struct (current->fs); + tsk->fs =copy_fs_struct (fs);if (!tsk->fs)return -ENOMEM ;return 0 ;
@@ -1518,12 +1526,16 @@ static int unshare_fs(unsigned long unsh {struct fs_struct *fs = current->fs; -if ((unshare_flags &CLONE_FS ) && - (fs &&atomic_read (&fs->count) >1 )) { - *new_fsp =copy_fs_struct (current->fs); -if (!*new_fsp) -return -ENOMEM ; - } +if (!(unshare_flags &CLONE_FS ) || !fs) +return 0 ; + +/* don't need lock here; in the worst case we'll do useless copy */ +if (fs->users ==1 ) +return 0 ; + + *new_fsp =copy_fs_struct (fs); +if (!*new_fsp) +return -ENOMEM ;return 0 ; }
@@ -1639,8 +1651,13 @@ SYSCALL_DEFINE1(unshare, unsigned long,if (new_fs) { fs = current->fs; +write_lock (&fs->lock); current->fs = new_fs; - new_fs = fs; +if (--fs->users) + new_fs =NULL ; +else + new_fs = fs; +write_unlock (&fs->lock); }if (new_mm) {
@@ -1679,7 +1696,7 @@ bad_unshare_cleanup_sigh: bad_unshare_cleanup_fs:if (new_fs) -put_fs_struct (new_fs); +free_fs_struct (new_fs); bad_unshare_cleanup_thread: bad_unshare_out:
PATCH 41/58 check_unsafe_exec() doesnt care about signal handlers sharing
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Al Viro <[email protected]>
commit f1191b50ec11c8e2ca766d6d99eb5bb9d2c084a3 upstream.
... since we'll unshare sighand anyway
--- fs/exec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/exec.c +2 -5
@@ -1053,23 +1053,20 @@ int check_unsafe_exec(struct linux_binpr {struct task_struct *p = current, *t;unsigned long flags; -unsigned n_fs, n_sighand; +unsigned n_fs;int res =0 ; bprm->unsafe =tracehook_unsafe_exec (p); n_fs =1 ; - n_sighand =1 ;write_lock (&p->fs->lock);lock_task_sighand (p, &flags);for (t =next_thread (p); t != p; t =next_thread (t)) {if (t->fs == p->fs) n_fs++; - n_sighand++; } -if (p->fs->users > n_fs || -atomic_read (&p->sighand->count) > n_sighand) { +if (p->fs->users > n_fs) { bprm->unsafe |=LSM_UNSAFE_SHARE ; }else {if (p->fs->in_exec)
PATCH 42/58 do_execve() must not clear fs->in_exec if it was set by another thread
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit 8c652f96d3852b97a49c331cd0bb02d22f3cb31b upstream.
If do_execve() fails after check_unsafe_exec(), it clears fs->in_exec unconditionally. This is wrong if we race with our sub-thread which also does do_execve:
Two threads T1 and T2 and another process P, all share the same ->fs. T1 starts do_execve(BAD_FILE). It calls check_unsafe_exec(), since ->fs is shared, we set LSM_UNSAFE but not ->in_exec. P exits and decrements fs->users. T2 starts do_execve(), calls check_unsafe_exec(), now ->fs is not shared, we set fs->in_exec. T1 continues, open_exec(BAD_FILE) fails, we clear ->in_exec and return to the user-space. T1 does clone(CLONE_FS /* without CLONE_THREAD */). T2 continues without LSM_UNSAFE_SHARE while ->fs is shared with another process.
Change check_unsafe_exec() to return res = 1 if we set ->in_exec, and change do_execve() to clear ->in_exec depending on res.
When do_execve() suceeds, it is safe to clear ->in_exec unconditionally. It can be set only if we don't share ->fs with another process, and since we already killed all sub-threads either ->in_exec == 0 or we are the only user of this ->fs.
Also, we do not need fs->lock to clear fs->in_exec.
--- fs/compat.c | 11 +++++------ fs/exec.c | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-)
fs/compat.c +5 -6
@@ -1394,6 +1394,7 @@ int compat_do_execve(char * filename,struct linux_binprm *bprm;struct file *file;struct files_struct *displaced; +bool clear_in_exec;int retval; retval =unshare_files (&displaced);
@@ -1415,8 +1416,9 @@ int compat_do_execve(char * filename, goto out_unlock; retval =check_unsafe_exec (bprm); -if (retval) +if (retval <0 ) goto out_unlock; + clear_in_exec = retval; file =open_exec (filename); retval =PTR_ERR (file);
@@ -1463,9 +1465,7 @@ int compat_do_execve(char * filename, goto out;/* execve succeeded */ -write_lock (¤t->fs->lock); current->fs->in_exec =0 ; -write_unlock (¤t->fs->lock);mutex_unlock (¤t->cred_exec_mutex);acct_update_integrals (current);free_bprm (bprm);
@@ -1484,9 +1484,8 @@ out_file: } out_unmark: -write_lock (¤t->fs->lock); - current->fs->in_exec =0 ; -write_unlock (¤t->fs->lock); +if (clear_in_exec) + current->fs->in_exec =0 ; out_unlock:mutex_unlock (¤t->cred_exec_mutex);
fs/exec.c +10 -9
@@ -1069,9 +1069,11 @@ int check_unsafe_exec(struct linux_binprif (p->fs->users > n_fs) { bprm->unsafe |=LSM_UNSAFE_SHARE ; }else { -if (p->fs->in_exec) - res = -EAGAIN ; - p->fs->in_exec =1 ; + res = -EAGAIN ; +if (!p->fs->in_exec) { + p->fs->in_exec =1 ; + res =1 ; + } }unlock_task_sighand (p, &flags);
@@ -1273,6 +1275,7 @@ int do_execve(char * filename,struct linux_binprm *bprm;struct file *file;struct files_struct *displaced; +bool clear_in_exec;int retval; retval =unshare_files (&displaced);
@@ -1294,8 +1297,9 @@ int do_execve(char * filename, goto out_unlock; retval =check_unsafe_exec (bprm); -if (retval) +if (retval <0 ) goto out_unlock; + clear_in_exec = retval; file =open_exec (filename); retval =PTR_ERR (file);
@@ -1343,9 +1347,7 @@ int do_execve(char * filename, goto out;/* execve succeeded */ -write_lock (¤t->fs->lock); current->fs->in_exec =0 ; -write_unlock (¤t->fs->lock);mutex_unlock (¤t->cred_exec_mutex);acct_update_integrals (current);free_bprm (bprm);
@@ -1364,9 +1366,8 @@ out_file: } out_unmark: -write_lock (¤t->fs->lock); - current->fs->in_exec =0 ; -write_unlock (¤t->fs->lock); +if (clear_in_exec) + current->fs->in_exec =0 ; out_unlock:mutex_unlock (¤t->cred_exec_mutex);
PATCH 43/58 check_unsafe_exec: s/lock_task_sighand/rcu_read_lock/
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Oleg Nesterov <[email protected]>
commit 437f7fdb607f32b737e4da9f14bebcfdac2c90c3 upstream.
write_lock(¤t->fs->lock) guarantees we can't wrongly miss LSM_UNSAFE_SHARE, this is what we care about. Use rcu_read_lock() instead of ->siglock to iterate over the sub-threads. We must see all CLONE_THREAD|CLONE_FS threads which didn't pass exit_fs(), it takes fs->lock too.
With or without this patch we can miss the freshly cloned thread and set LSM_UNSAFE_SHARE, we don't care.
--- fs/exec.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/exec.c +2 -4
@@ -1052,7 +1052,6 @@ EXPORT_SYMBOL(install_exec_creds);int check_unsafe_exec (struct linux_binprm *bprm) {struct task_struct *p = current, *t; -unsigned long flags;unsigned n_fs;int res =0 ;
@@ -1060,11 +1059,12 @@ int check_unsafe_exec(struct linux_binpr n_fs =1 ;write_lock (&p->fs->lock); -lock_task_sighand (p, &flags); +rcu_read_lock ();for (t =next_thread (p); t != p; t =next_thread (t)) {if (t->fs == p->fs) n_fs++; } +rcu_read_unlock ();if (p->fs->users > n_fs) { bprm->unsafe |=LSM_UNSAFE_SHARE ;
@@ -1075,8 +1075,6 @@ int check_unsafe_exec(struct linux_binpr res =1 ; } } - -unlock_task_sighand (p, &flags);write_unlock (&p->fs->lock);return res;
PATCH 44/58 mv643xx_eth: 64bit mib counter read fix
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Lennert Buytenhek <[email protected]>
commit 93af7aca44f0e82e67bda10a0fb73d383edcc8bd upstream.
On several mv643xx_eth hardware versions, the two 64bit mib counters for 'good octets received' and 'good octets sent' are actually 32bit counters, and reading from the upper half of the register has the same effect as reading from the lower half of the register: an atomic read-and-clear of the entire 32bit counter value. This can under heavy traffic occasionally lead to small numbers being added to the upper half of the 64bit mib counter even though no 32bit wrap has occured.
Since we poll the mib counters at least every 30 seconds anyway, we might as well just skip the reads of the upper halves of the hardware counters without breaking the stats, which this patch does.
--- drivers/net/mv643xx_eth.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/mv643xx_eth.c +0 -2
@@ -1177,7 +1177,6 @@ static void mib_counters_update(struct mspin_lock_bh (&mp->mib_counters_lock); p->good_octets_received +=mib_read (mp,0x00 ); - p->good_octets_received += (u64 )mib_read (mp,0x04 ) <<32 ; p->bad_octets_received +=mib_read (mp,0x08 ); p->internal_mac_transmit_err +=mib_read (mp,0x0c ); p->good_frames_received +=mib_read (mp,0x10 );
@@ -1191,7 +1190,6 @@ static void mib_counters_update(struct m p->frames_512_to_1023_octets +=mib_read (mp,0x30 ); p->frames_1024_to_max_octets +=mib_read (mp,0x34 ); p->good_octets_sent +=mib_read (mp,0x38 ); - p->good_octets_sent += (u64 )mib_read (mp,0x3c ) <<32 ; p->good_frames_sent +=mib_read (mp,0x40 ); p->excessive_collision +=mib_read (mp,0x44 ); p->multicast_frames_sent +=mib_read (mp,0x48 );
PATCH 45/58 mv643xx_eth: OOM handling fixes
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Lennert Buytenhek <[email protected]>
commit 1319ebadf185933e6b7ff95211d3cef9004e9754 upstream.
Currently, when OOM occurs during rx ring refill, mv643xx_eth will get into an infinite loop, due to the refill function setting the OOM bit but not clearing the 'rx refill needed' bit for this queue, while the calling function (the NAPI poll handler) will call the refill function in a loop until the 'rx refill needed' bit goes off, without checking the OOM bit.
This patch fixes this by checking the OOM bit in the NAPI poll handler before attempting to do rx refill. This means that once OOM occurs, we won't try to do any memory allocations again until the next invocation of the poll handler.
While we're at it, change the OOM flag to be a single bit instead of one bit per receive queue since OOM is a system state rather than a per-queue state, and cancel the OOM timer on entry to the NAPI poll handler if it's running to prevent it from firing when we've already come out of OOM.
--- drivers/net/mv643xx_eth.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/mv643xx_eth.c +13 -9
@@ -372,12 +372,12 @@ struct mv643xx_eth_private {struct work_struct tx_timeout_task;struct napi_struct napi; +u8 oom;u8 work_link;u8 work_tx;u8 work_tx_end;u8 work_rx;u8 work_rx_refill; -u8 work_rx_oom;int skb_size;struct sk_buff_head rx_recycle;
@@ -603,7 +603,7 @@ static int rxq_refill(struct rx_queue *r dma_get_cache_alignment() - 1);if (skb ==NULL ) { - mp->work_rx_oom |=1 << rxq->index; + mp->oom =1 ; goto oom; }
@@ -1906,8 +1906,10 @@ static int mv643xx_eth_poll(struct napi_ mp = container_of(napi, struct mv643xx_eth_private, napi); - mp->work_rx_refill |= mp->work_rx_oom; - mp->work_rx_oom =0 ; +if (unlikely (mp->oom)) { + mp->oom =0 ; +del_timer (&mp->rx_oom); + } work_done =0 ;while (work_done < budget) {
@@ -1921,8 +1923,10 @@ static int mv643xx_eth_poll(struct napi_continue ; } - queue_mask = mp->work_tx | mp->work_tx_end | - mp->work_rx | mp->work_rx_refill; + queue_mask = mp->work_tx | mp->work_tx_end | mp->work_rx; +if (likely (!mp->oom)) + queue_mask |= mp->work_rx_refill; +if (!queue_mask) {if (mv643xx_eth_collect_events (mp))continue ;
@@ -1943,7 +1947,7 @@ static int mv643xx_eth_poll(struct napi_txq_maybe_wake (mp->txq + queue); }else if (mp->work_rx & queue_mask) { work_done +=rxq_process (mp->rxq + queue, work_tbd); - }else if (mp->work_rx_refill & queue_mask) { + }else if (!mp->oom && (mp->work_rx_refill & queue_mask)) { work_done +=rxq_refill (mp->rxq + queue, work_tbd); }else {BUG ();
@@ -1951,7 +1955,7 @@ static int mv643xx_eth_poll(struct napi_ }if (work_done < budget) { -if (mp->work_rx_oom) +if (mp->oom)mod_timer (&mp->rx_oom, jiffies + (HZ /10 ));napi_complete (napi);wrlp (mp,INT_MASK ,INT_TX_END |INT_RX |INT_EXT );
@@ -2143,7 +2147,7 @@ static int mv643xx_eth_open(struct net_drxq_refill (mp->rxq + i,INT_MAX ); } -if (mp->work_rx_oom) { +if (mp->oom) { mp->rx_oom.expires = jiffies + (HZ /10 );add_timer (&mp->rx_oom); }
PATCH 46/58 ath5k: fix buffer overrun in rate debug code
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Bob Copeland <[email protected]>
commit b7fcb5c4a4c27da2f6d86cb03d18687e537442cf upstream.
char bname[5] is too small for the string "X GHz" when the null terminator is taken into account. Thus, turning on rate debugging can crash unless we have lucky stack alignment.
--- drivers/net/wireless/ath5k/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath5k/debug.c +1 -1
@@ -465,7 +465,7 @@ ath5k_debug_dump_bands(struct ath5k_softfor (b =0 ; b <IEEE80211_NUM_BANDS ; b++) {struct ieee80211_supported_band *band = &sc->sbands[b]; -char bname[5 ]; +char bname[6 ];switch (band->band) {case IEEE80211_BAND_2GHZ :strcpy (bname,"2 GHz" );
PATCH 47/58 proc: avoid information leaks to non-privileged processes
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jake Edge <[email protected]>
commit f83ce3e6b02d5e48b3a43b001390e2b58820389d upstream.
By using the same test as is used for /proc/pid/maps and /proc/pid/smaps, only allow processes that can ptrace() a given process to see information that might be used to bypass address space layout randomization (ASLR). These include eip, esp, wchan, and start_stack in /proc/pid/stat as well as the non-symbolic output from /proc/pid/wchan.
ASLR can be bypassed by sampling eip as shown by the proof-of-concept code at http://code.google.com/p/fuzzyaslr/ As part of a presentation
(http://www.cr0.org/paper/to-jt-linux-alsr-leak.pdf) esp and wchan were also noted as possibly usable information leaks as well. The start_stack address also leaks potentially useful information.
--- fs/proc/array.c | 13 +++++++++---- fs/proc/base.c | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-)
fs/proc/array.c +9 -4
@@ -80,6 +80,7 @@#include <linux/delayacct.h> #include <linux/seq_file.h> #include <linux/pid_namespace.h> +#include <linux/ptrace.h> #include <linux/tracehook.h> #include <asm/pgtable.h>
@@ -352,6 +353,7 @@ static int do_task_stat(struct seq_filechar state;pid_t ppid =0 , pgid =-1 , sid =-1 ;int num_threads =0 ; +int permitted;struct mm_struct *mm;unsigned long long start_time;unsigned long cmin_flt =0 , cmaj_flt =0 ;
@@ -364,11 +366,14 @@ static int do_task_stat(struct seq_file state = *get_task_state (task); vsize = eip = esp =0 ; + permitted =ptrace_may_access (task,PTRACE_MODE_READ ); mm =get_task_mm (task);if (mm) { vsize =task_vsize (mm); - eip =KSTK_EIP (task); - esp =KSTK_ESP (task); +if (permitted) { + eip =KSTK_EIP (task); + esp =KSTK_ESP (task); + } }get_task_comm (tcomm, task);
@@ -424,7 +429,7 @@ static int do_task_stat(struct seq_fileunlock_task_sighand (task, &flags); } -if (!whole || num_threads <2 ) +if (permitted && (!whole || num_threads <2 )) wchan =get_wchan (task);if (!whole) { min_flt = task->min_flt;
@@ -476,7 +481,7 @@ static int do_task_stat(struct seq_file rsslim, mm ? mm->start_code :0 , mm ? mm->end_code :0 , - mm ? mm->start_stack :0 , + (permitted && mm) ? mm->start_stack :0 , esp, eip,/* The signal information here is obsolete.
fs/proc/base.c +4 -1
@@ -321,7 +321,10 @@ static int proc_pid_wchan(struct task_st wchan =get_wchan (task);if (lookup_symbol_name (wchan, symname) <0 ) -return sprintf (buffer,"%lu" , wchan); +if (!ptrace_may_access (task,PTRACE_MODE_READ )) +return 0 ; +else +return sprintf (buffer,"%lu" , wchan);else return sprintf (buffer,"%s" , symname); }
PATCH 48/58 cs5536: define dma_sff_read_status() method
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Sergei Shtylyov <[email protected]>
commit 15da90b516e9da92cc1d90001e640fd6707d0e27 upstream.
The driver somehow got merged with the initializer for the dma_sff_read_status() method missing which caused kernel panic on bootup.
This should fix the kernel.org bug #13026...
--- drivers/ide/cs5536.c | 1 + 1 file changed, 1 insertion(+)
drivers/ide/cs5536.c +1 -0
@@ -237,6 +237,7 @@ static const struct ide_dma_ops cs5536_d .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timeout = ide_dma_timeout, + .dma_sff_read_status = ide_dma_sff_read_status, };static const struct ide_port_info cs5536_info = {
PATCH 49/58 intel-iommu: Fix device-to-iommu mapping for PCI-PCI bridges.
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Woodhouse <[email protected]>
(cherry picked from commit 924b6231edfaf1e764ffb4f97ea382bf4facff58)
When the DMAR table identifies that a PCI-PCI bridge belongs to a given IOMMU, that means that the bridge and all devices behind it should be associated with the IOMMU. Not just the bridge itself.
This fixes the device_to_iommu() function accordingly.
(It's broken if you have the same PCI bus numbers in multiple domains, but this function was always broken in that way; I'll be dealing with that later).
--- drivers/pci/intel-iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pci/intel-iommu.c +6 -1
@@ -447,11 +447,16 @@ static struct intel_iommu *device_to_iomif (drhd->ignored)continue ; -for (i =0 ; i < drhd->devices_cnt; i++) +for (i =0 ; i < drhd->devices_cnt; i++) {if (drhd->devices[i] && drhd->devices[i]->bus->number == bus && drhd->devices[i]->devfn == devfn)return drhd->iommu; +if (drhd->devices[i]->subordinate && + drhd->devices[i]->subordinate->number <= bus && + drhd->devices[i]->subordinate->subordinate >= bus) +return drhd->iommu; + }if (drhd->include_all)return drhd->iommu;
PATCH 50/58 intel-iommu: Fix oops in device_to_iommu() when devices not found.
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Woodhouse <[email protected]>
(cherry picked from commit 4958c5dc7bcb2e42d985cd26aeafd8a7eca9ab1e)
It's possible for a device in the drhd->devices[] array to be NULL if it wasn't found at boot time, which means we have to check for that case.
--- drivers/pci/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/intel-iommu.c +2 -1
@@ -452,7 +452,8 @@ static struct intel_iommu *device_to_iom drhd->devices[i]->bus->number == bus && drhd->devices[i]->devfn == devfn)return drhd->iommu; -if (drhd->devices[i]->subordinate && +if (drhd->devices[i] && + drhd->devices[i]->subordinate && drhd->devices[i]->subordinate->number <= bus && drhd->devices[i]->subordinate->subordinate >= bus)return drhd->iommu;
PATCH 51/58 intel-iommu: Avoid panic() for DRHD at address zero.
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: David Woodhouse <[email protected]>
(cherry picked from commit e523b38e2f568af58baa13120a994cbf24e6dee0)
If the BIOS does something obviously stupid, like claiming that the registers for the IOMMU are at physical address zero, then print a nasty message and abort, rather than trying to set up the IOMMU and then later panicking.
It's becoming more and more obvious that trusting this stuff to the BIOS was a mistake.
--- drivers/pci/dmar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/pci/dmar.c +10 -1
@@ -170,12 +170,21 @@ dmar_parse_one_drhd(struct acpi_dmar_heastruct dmar_drhd_unit *dmaru;int ret =0 ; + drhd = (struct acpi_dmar_hardware_unit *)header; +if (!drhd->address) { +/* Promote an attitude of violence to a BIOS engineer today */ +WARN (1 ,"Your BIOS is broken; DMAR reported at address zero!\n" +"BIOS vendor: %s; Ver: %s; Product Version: %s\n" , +dmi_get_system_info (DMI_BIOS_VENDOR ), +dmi_get_system_info (DMI_BIOS_VERSION ), +dmi_get_system_info (DMI_PRODUCT_VERSION )); +return -ENODEV ; + } dmaru =kzalloc (sizeof (*dmaru),GFP_KERNEL );if (!dmaru)return -ENOMEM ; dmaru->hdr = header; - drhd = (struct acpi_dmar_hardware_unit *)header; dmaru->reg_base_addr = drhd->address; dmaru->include_all = drhd->flags &0x1 ;/* BIT0: INCLUDE_ALL */
PATCH 52/58 clockevents: prevent endless loop in tick_handle_periodic()
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: john stultz <[email protected]>
commit 74a03b69d1b5ce00a568e142ca97e76b7f5239c6 upstream.
tick_handle_periodic() can lock up hard when a one shot clock event device is used in combination with jiffies clocksource.
Avoid an endless loop issue by requiring that a highres valid clocksource be installed before we call tick_periodic() in a loop when using ONESHOT mode. The result is we will only increment jiffies once per interrupt until a continuous hardware clocksource is available.
Without this, we can run into a endless loop, where each cycle through the loop, jiffies is updated which increments time by tick_period or more (due to clock steering), which can cause the event programming to think the next event was before the newly incremented time and fail causing tick_periodic() to be called again and the whole process loops forever.
[ Impact: prevent hard lock up ]
kernel/time/tick-common.c +11 -1
@@ -93,7 +93,17 @@ void tick_handle_periodic(struct clock_event_device *dev)for (;;) {if (!clockevents_program_event (dev, next,ktime_get ()))return ; -tick_periodic (cpu); +/* +* Have to be careful here. If we're in oneshot mode, +* before we call tick_periodic() in a loop, we need +* to be sure we're using a real hardware clocksource. +* Otherwise we could get trapped in an infinite +* loop, as the tick_periodic() increments jiffies, +* when then will increment time, posibly causing +* the loop to trigger again and again. +*/ +if (timekeeping_valid_for_hres ()) +tick_periodic (cpu); next =ktime_add (next, tick_period); } }
PATCH 53/58 Ignore madvise(MADV_WILLNEED) for hugetlbfs-backed regions
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Mel Gorman <[email protected]>
commit a425a638c858fd10370b573bde81df3ba500e271 upstream.
madvise(MADV_WILLNEED) forces page cache readahead on a range of memory backed by a file. The assumption is made that the page required is order-0 and "normal" page cache.
On hugetlbfs, this assumption is not true and order-0 pages are allocated and inserted into the hugetlbfs page cache. This leaks hugetlbfs page reservations and can cause BUGs to trigger related to corrupted page tables.
This patch causes MADV_WILLNEED to be ignored for hugetlbfs-backed regions.
--- mm/madvise.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/madvise.c +8 -0
@@ -112,6 +112,14 @@ static long madvise_willneed(struct vm_aif (!file)return -EBADF ; +/* +* Page cache readahead assumes page cache pages are order-0 which +* is not the case for hugetlbfs. Do not give a bad return value +* but ignore the advice. +*/ +if (vma->vm_flags &VM_HUGETLB ) +return 0 ; +if (file->f_mapping->a_ops->get_xip_mem) {/* no bad return value, but ignore advice */ return 0 ;
PATCH 54/58 mm: fix Committed_AS underflow on large NR_CPUS environment
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: KOSAKI Motohiro <[email protected]>
commit 00a62ce91e554198ef28234c91c36f850f5a3bc9 upstream
The Committed_AS field can underflow in certain situations:
Quoted 7 lines
# while true; do cat /proc/meminfo | grep _AS; sleep 1; done | uniq -c
1 Committed_AS: 18446744073709323392 kB
11 Committed_AS: 18446744073709455488 kB
6 Committed_AS: 35136 kB
5 Committed_AS: 18446744073709454400 kB
7 Committed_AS: 35904 kB
3 Committed_AS: 18446744073709453248 kBQuoted 8 lines
2 Committed_AS: 34752 kB
9 Committed_AS: 18446744073709453248 kB
8 Committed_AS: 34752 kB
3 Committed_AS: 18446744073709320960 kB
7 Committed_AS: 18446744073709454080 kB
3 Committed_AS: 18446744073709320960 kB
5 Committed_AS: 18446744073709454080 kB
6 Committed_AS: 18446744073709320960 kBBecause NR_CPUS can be greater than 1000 and meminfo_proc_show() does not check for underflow.
But NR_CPUS proportional isn't good calculation. In general, possibility of lock contention is proportional to the number of online cpus, not theorical maximum cpus (NR_CPUS).
The current kernel has generic percpu-counter stuff. using it is right way. it makes code simplify and percpu_counter_read_positive() don't make underflow issue.
--- fs/proc/meminfo.c | 2 +- include/linux/mman.h | 9 +++------ mm/mmap.c | 12 ++++++------ mm/nommu.c | 13 +++++++------ mm/swap.c | 46 ---------------------------------------------- 5 files changed, 17 insertions(+), 65 deletions(-)
fs/proc/meminfo.c +1 -1
@@ -35,7 +35,7 @@ static int meminfo_proc_show(struct seq_#define K (x) ((x) << (PAGE_SHIFT - 10))si_meminfo (&i);si_swapinfo (&i); - committed =atomic_long_read (&vm_committed_space); + committed =percpu_counter_read_positive (&vm_committed_as); allowed = ((totalram_pages -hugetlb_total_pages ()) * sysctl_overcommit_ratio /100 ) + total_swap_pages;
include/linux/mman.h +3 -6
@@ -12,21 +12,18 @@#ifdef __KERNEL__#include <linux/mm.h> +#include <linux/percpu_counter.h> #include <asm/atomic.h> extern int sysctl_overcommit_memory;extern int sysctl_overcommit_ratio; -extern atomic_long_t vm_committed_space; +extern struct percpu_counter vm_committed_as; -#ifdef CONFIG_SMP -extern void vm_acct_memory (long pages); -#else static inline void vm_acct_memory (long pages) { -atomic_long_add (pages, &vm_committed_space); +percpu_counter_add (&vm_committed_as, pages); } -#endif static inline void vm_unacct_memory (long pages) {
mm/mmap.c +6 -6
@@ -84,7 +84,7 @@ EXPORT_SYMBOL(vm_get_page_prot);int sysctl_overcommit_memory =OVERCOMMIT_GUESS ;/* heuristic overcommit */ int sysctl_overcommit_ratio =50 ;/* default is 50% */ int sysctl_max_map_count__read_mostly =DEFAULT_MAX_MAP_COUNT ; -atomic_long_t vm_committed_space =ATOMIC_LONG_INIT (0 ); +struct percpu_counter vm_committed_as;/* * Check that a process has enough memory to allocate a new virtual
@@ -178,11 +178,7 @@ int __vm_enough_memory(struct mm_structif (mm) allowed -= mm->total_vm /32 ; -/* -* cast `allowed' as a signed long because vm_committed_space -* sometimes has a negative value -*/ -if (atomic_long_read (&vm_committed_space) < (long )allowed) +if (percpu_counter_read_positive (&vm_committed_as) < allowed)return 0 ; error:vm_unacct_memory (pages);
@@ -2477,6 +2473,10 @@ void mm_drop_all_locks(struct mm_struct*/ void __init mmap_init (void ) { +int ret; + + ret =percpu_counter_init (&vm_committed_as,0 ); +VM_BUG_ON (ret); vm_area_cachep =kmem_cache_create ("vm_area_struct" ,sizeof (struct vm_area_struct ),0 ,SLAB_PANIC ,NULL );
mm/nommu.c +7 -6
@@ -62,7 +62,7 @@ void *high_memory;struct page *mem_map;unsigned long max_mapnr;unsigned long num_physpages; -atomic_long_t vm_committed_space =ATOMIC_LONG_INIT (0 ); +struct percpu_counter vm_committed_as;int sysctl_overcommit_memory =OVERCOMMIT_GUESS ;/* heuristic overcommit */ int sysctl_overcommit_ratio =50 ;/* default is 50% */ int sysctl_max_map_count =DEFAULT_MAX_MAP_COUNT ;
@@ -463,6 +463,10 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)*/ void __init mmap_init (void ) { +int ret; + + ret =percpu_counter_init (&vm_committed_as,0 ); +VM_BUG_ON (ret); vm_region_jar =kmem_cache_create ("vm_region_jar" ,sizeof (struct vm_region ),0 ,SLAB_PANIC ,NULL );
@@ -1849,12 +1853,9 @@ int __vm_enough_memory(struct mm_structif (mm) allowed -= mm->total_vm /32 ; -/* -* cast `allowed' as a signed long because vm_committed_space -* sometimes has a negative value -*/ -if (atomic_long_read (&vm_committed_space) < (long )allowed) +if (percpu_counter_read_positive (&vm_committed_as) < allowed)return 0 ; + error:vm_unacct_memory (pages);
mm/swap.c +0 -46
56 lines not on this page · raw message
PATCH 55/58 rndis_wlan: fix initialization order for workqueue&workers
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Jussi Kivilinna <[email protected]>
commit e805e4d0b53506dff4255a2792483f094e7fcd2c upstream.
rndis_wext_link_change() might be called from rndis_command() at initialization stage and priv->workqueue/priv->work have not been initialized yet. This causes invalid opcode at rndis_wext_bind on some brands of bcm4320.
Fix by initializing workqueue/workers in rndis_wext_bind() before rndis_command is used.
This bug has existed since 2.6.25, reported at:
http://bugzilla.kernel.org/show_bug.cgi?id=12794
--- drivers/net/wireless/rndis_wlan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/wireless/rndis_wlan.c +10 -4
@@ -2550,6 +2550,11 @@ static int rndis_wext_bind(struct usbnetmutex_init (&priv->command_lock);spin_lock_init (&priv->stats_lock); +/* because rndis_command() sleeps we need to use workqueue */ + priv->workqueue =create_singlethread_workqueue ("rndis_wlan" ); +INIT_WORK (&priv->work, rndis_wext_worker); +INIT_DELAYED_WORK (&priv->stats_work, rndis_update_wireless_stats); +/* try bind rndis_host */ retval =generic_rndis_bind (usbdev, intf,FLAG_RNDIS_PHYM_WIRELESS );if (retval <0 )
@@ -2594,16 +2599,17 @@ static int rndis_wext_bind(struct usbnetdisassociate (usbdev,1 );netif_carrier_off (usbdev->net); -/* because rndis_command() sleeps we need to use workqueue */ - priv->workqueue =create_singlethread_workqueue ("rndis_wlan" ); -INIT_DELAYED_WORK (&priv->stats_work, rndis_update_wireless_stats);queue_delayed_work (priv->workqueue, &priv->stats_work,round_jiffies_relative (STATS_UPDATE_JIFFIES )); -INIT_WORK (&priv->work, rndis_wext_worker);return 0 ; fail: +cancel_delayed_work_sync (&priv->stats_work); +cancel_work_sync (&priv->work); +flush_workqueue (priv->workqueue); +destroy_workqueue (priv->workqueue); +kfree (priv);return retval; }
PATCH 56/58 sched: account system time properly
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Eric Dumazet <[email protected]>
commit f5f293a4e3d0a0c52cec31de6762c95050156516 upstream.
Andrew Gallatin reported that IRQ and SOFTIRQ times were sometime not reported correctly on recent kernels, and even bisected to commit 457533a7d3402d1d91fbc125c8bd1bd16dcd3cd4 ([PATCH] fix scaled & unscaled cputime accounting) as the first bad commit.
Further analysis pointed that commit 79741dd35713ff4f6fd0eafd59fa94e8a4ba922d ([PATCH] idle cputime accounting) was the real cause of the problem.
account_process_tick() was not taking into account timer IRQ interrupting the idle task servicing a hard or soft irq.
On mostly idle cpu, irqs were thus not accounted and top or mpstat could tell user/admin that cpu was 100 % idle, 0.00 % irq, 0.00 % softirq, while it was not.
[ Impact: fix occasionally incorrect CPU statistics in top/mpstat ]
LKML-Reference: <[email protected]>
--- kernel/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
@@ -4347,7 +4347,7 @@ void account_process_tick(struct task_stif (user_tick)account_user_time (p, one_jiffy, one_jiffy_scaled); -else if (p != rq->idle) +else if ((p != rq->idle) || (irq_count () !=HARDIRQ_OFFSET ))account_system_time (p,HARDIRQ_OFFSET , one_jiffy, one_jiffy_scaled);else
PATCH 57/58 tracing: x86, mmiotrace: fix range test
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stuart Bennett <[email protected]>
commit 33015c85995716d03f6293346cf05a1908b0fb9a upstream.
Matching on (addr == (p->addr + p->len)) causes problems when mappings are adjacent.
[ Impact: fix mmiotrace confusion on adjacent iomaps ]
LKML-Reference: <[email protected]>
--- arch/x86/mm/kmmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kmmio.c +1 -1
@@ -87,7 +87,7 @@ static struct kmmio_probe *get_kmmio_pro {struct kmmio_probe *p;list_for_each_entry_rcu (p, &kmmio_probes, list) { -if (addr >= p->addr && addr <= (p->addr + p->len)) +if (addr >= p->addr && addr < (p->addr + p->len))return p; }return NULL ;
Re: [patch 57/58] tracing: x86, mmiotrace: fix range test
Quoted 11 lines · Greg KH
2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Stuart Bennett <[email protected]>
commit
33015c85995716d03f6293346cf05a1908b0fb9aupstream.Matching on (addr == (
p->addr+p->len)) causes problems when mappings are adjacent.
Quoted 8 lines
[ Impact: fix mmiotrace confusion on adjacent iomaps ]
Signed-off-by Stuart Bennett <[email protected]>Acked-by Pekka Paalanen <[email protected]>Cc Steven Rostedt <[email protected]>LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
-- Steve
Quoted 19 lines
--- arch/x86/mm/kmmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/mm/kmmio.c +1
-1@@ -87,7 +87,7 @@ static struct kmmio_probe *get_kmmio_pro {struct kmmio_probe *p;list_for_each_entry_rcu (p, &kmmio_probes, list) { -if (addr >= p->addr && addr <= (p->addr + p->len)) +if (addr >= p->addr && addr < (p->addr + p->len))return p; }return NULL ;
PATCH 58/58 ath9k: Fix FIF_BCN_PRBRESP_PROMISC handling
In reply to Greg KH2.6.29-stable review patch. If anyone has any objections, please let us know.
------------------
From: Luis R. Rodriguez <[email protected]>
This is a port of commit91ed19f5f66a7fe544f0ec385e981f43491d1d5a
for 2.6.29.
Without this after scanning your device will set the association ID to something bogus and what is being reported is multicast/broadcast frame are not being received. For details see this bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=498502
Quoted 1 line
From the original commit:
So that a new created IBSS network
doesn't break on the first scan.
It seems to Sujith and me that this
stupid code unnecessary, too.
So remove it...
--- drivers/net/wireless/ath9k/main.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/wireless/ath9k/main.c +0 -5
@@ -2300,11 +2300,6 @@ static void ath9k_configure_filter(struc rfilt =ath_calcrxfilter (sc);ath9k_hw_setrxfilter (sc->sc_ah, rfilt); -if (changed_flags &FIF_BCN_PRBRESP_PROMISC ) { -if (*total_flags &FIF_BCN_PRBRESP_PROMISC ) -ath9k_hw_write_associd (sc->sc_ah, ath_bcast_mac,0 ); - } -DPRINTF (sc,ATH_DBG_CONFIG ,"Set HW RX filter: 0x%x\n" , sc->rx.rxfilter); }
Hi
On Mittwoch, 6. Mai 2009, Greg KH wrote:
[...]
Quoted 2 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz
The actual patch seems to be missing, is there an issue with the mirroring?
$ LANG= wget kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz --2009-05-07 00:32:03-- http://kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz Resolving kernel.org... 149.20.20.133, 204.152.191.37 Connecting to kernel.org|149.20.20.133|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2009-05-07 00:32:03 ERROR 404: Not Found.
Regards
Stefan Lippers-Hollmann
Quoted 7 lines · Stefan Lippers-Hollmann
Hi
On Mittwoch, 6. Mai 2009, Greg KH wrote:
[...]Quoted 2 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz
Quoted 8 lines
The actual patch seems to be missing, is there an issue with the mirroring?
$ LANG= wget kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz --2009-05-07 00:32:03-- http://kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.29.3-rc1.gz Resolving kernel.org... 149.20.20.133, 204.152.191.37 Connecting to kernel.org|149.20.20.133|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2009-05-07 00:32:03 ERROR 404: Not Found.
Doh, I forgot to upload it, sorry about that. Should be there in about 15 minutes.
thanks,
greg k-h
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 patches in this series, all will be posted as a response to this one.
Maybe I'm missing something, but I don't see any of
the fs/cifs/connect.c security fixes from commits such as f083def68f84b04fe3f97312498911afce79609e. I was hoping this would make it into 2.6.29.3.
For reference, this was discussed on full-disclosure:
http://marc.info/?l=full-disclosure&m=123936563230145&w=2 (near the end of Andreas's post)
Jeff and Steve mentioned last week that they were working on other related cleanups as well, that they hoped to push to stable.
Thanks,
- Chris
Quoted 10 lines · Chris Frey
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 patches in this series, all will be posted as a response to this one.
Maybe I'm missing something, but I don't see any of
thefs/cifs/connect.csecurity fixes from commits such asf083def68f84b04fe3f97312498911afce79609e. I was hoping this would make it into 2.6.29.3.
Quoted 6 lines
For reference, this was discussed on full-disclosure:
http://marc.info/?l=full-disclosure&m=123936563230145&w=2
(near the end of Andreas's post)Jeff and Steve mentioned last week that they were working on other related cleanups as well, that they hoped to push to stable.
The cleanup and rewrite of some of the Unicode string handling functions was too large for stable, but the potential buffer overrun fixes were small enough to submit, had been collected (and cleaned up so that they could merge) for stable submission by Suresh (Jeff and I acked them over the last two days)
01-cifs-fix-buffer-size-for-nativeFileSystem 02-cifs-fix-temp-buffer-size-in-cifs_readdir 03-cifs-fix-dest-buffer-size-in-cifs_strncpy_to_host 04-cifs-fix-cifs_convertUCSpath 05-cifs-fix-unicode-string-alignment-in-session-setup
I am not aware of any others that are missing.
Suresh,
Are we missing any?
Signature · 3 lines
Thanks, Steve
Quoted 9 lines · Chris Frey
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 patches in this series, all will be posted as a response to this one.
Maybe I'm missing something, but I don't see any of
thefs/cifs/connect.csecurity fixes from commits such asf083def68f84b04fe3f97312498911afce79609e. I was hoping this would make it into 2.6.29.3.
No one sent them to [email protected] for inclusion :(
Quoted 6 lines
For reference, this was discussed on full-disclosure:
http://marc.info/?l=full-disclosure&m=123936563230145&w=2 (near the end of Andreas's post)Jeff and Steve mentioned last week that they were working on other related cleanups as well, that they hoped to push to stable.
That doesn't seem to have happened yet.
thanks,
greg k-h
Quoted 11 lines · Greg KH
Quoted 8 lines · Chris Frey
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 patches in this series, all will be posted as a response to this one.
Maybe I'm missing something, but I don't see any of
thefs/cifs/connect.csecurity fixes from commits such asf083def68f84b04fe3f97312498911afce79609e. I was hoping this would make it into 2.6.29.3.No one sent them to [email protected] for inclusion :(
Sorry, the patches were sent to cifs mailing list for consensus/discussion and -stable inclusion request has not happened (though Steve Cced stable the summary email with his ACK). I'm sending the patches right away.. and hope it's not too late for 29.3
I have based the patches on top of 2.6.29.2.
Thanks,
Signature · 1 line
Suresh Jayaraman
Quoted 11 lines · Suresh Jayaraman
Quoted 10 lines · Greg KH
Quoted 8 lines · Chris Frey
Quoted 3 lines · Greg KH
This is the start of the stable review cycle for the 2.6.29.3 release. There are 58 patches in this series, all will be posted as a response to this one.
Maybe I'm missing something, but I don't see any of
thefs/cifs/connect.csecurity fixes from commits such asf083def68f84b04fe3f97312498911afce79609e. I was hoping this would make it into 2.6.29.3.
Quoted 6 lines
Quoted 1 line
No one sent them to [email protected] for inclusion :(
Sorry, the patches were sent to cifs mailing list for consensus/discussion and -stable inclusion request has not happened (though Steve Cced stable the summary email with his ACK). I'm sending the patches right away.. and hope it's not too late for 29.3
Yes, it's too late for .3, that review cycle started yesterday and will be released tomorrow.
Quoted 1 line
I have based the patches on top of 2.6.29.2.
Thanks, we can always start a new review cycle on Friday with these if needed.
thanks,
greg k-h