3.2.23-stable review
Subsystems (41)
cover 3.2.23-stable review
This is the start of the stable review cycle for the 3.2.23 release. There are 48 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Jul 11 20:00:00 UTC 2012. Anything received after that time might be too late.
A combined patch relative to 3.2.22 will be posted as an additional response to this, and the diffstat can be found below.
Ben.
-------------
Makefile | 4 +- arch/arm/kernel/smp.c | 10 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- arch/powerpc/xmon/xmon.c | 2 +- drivers/block/umem.c | 40 ++++++++ drivers/gpu/drm/i915/i915_dma.c | 37 +++++-- drivers/md/persistent-data/dm-space-map-checker.c | 54 ++++++----- drivers/md/persistent-data/dm-space-map-disk.c | 11 ++- .../md/persistent-data/dm-transaction-manager.c | 11 ++- drivers/md/raid10.c | 12 ++- drivers/md/raid5.c | 10 +- drivers/mtd/nand/cafe_nand.c | 2 +- drivers/net/bonding/bond_main.c | 9 +- drivers/net/dummy.c | 4 +- drivers/net/ethernet/emulex/benet/be_main.c | 5 +- drivers/net/ethernet/marvell/sky2.c | 10 +- drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 2 +- drivers/net/wireless/ath/ath9k/recv.c | 3 +- drivers/net/wireless/ath/key.c | 4 + drivers/net/wireless/mwifiex/11n_rxreorder.c | 5 +- drivers/net/wireless/mwifiex/11n_rxreorder.h | 7 ++ drivers/net/wireless/mwifiex/cfg80211.c | 21 ++-- drivers/net/wireless/mwifiex/wmm.c | 12 ++- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 3 + drivers/target/tcm_fc/tfc_sess.c | 3 +- fs/btrfs/tree-log.c | 6 ++ fs/cifs/connect.c | 9 +- fs/ocfs2/file.c | 4 +- fs/open.c | 6 +- fs/splice.c | 35 ++++--- fs/udf/super.c | 102 ++++++++++++-------- include/linux/aio.h | 1 + include/linux/splice.h | 8 +- include/net/cipso_ipv4.h | 29 +++++- include/net/sch_generic.h | 7 +- kernel/relay.c | 5 +- kernel/trace/trace.c | 8 +- mm/madvise.c | 16 ++- mm/shmem.c | 3 +- net/bridge/br_if.c | 1 + net/bridge/br_netlink.c | 2 +- net/bridge/br_private.h | 1 + net/core/ethtool.c | 1 + net/core/netpoll.c | 11 ++- net/core/skbuff.c | 3 +- net/core/sock.c | 7 +- net/ipv6/route.c | 41 ++++++-- net/l2tp/l2tp_eth.c | 2 + net/l2tp/l2tp_ip.c | 9 +- net/mac80211/rx.c | 5 +- net/nfc/nci/ntf.c | 4 +- net/nfc/rawsock.c | 5 +- sound/pci/hda/patch_sigmatel.c | 4 +- sound/soc/codecs/tlv320aic3x.c | 4 +- sound/soc/codecs/tlv320aic3x.h | 1 + 56 files changed, 439 insertions(+), 185 deletions(-)
Signature · 2 lines
Ben Hutchings No political challenge can be met by shopping. - George Monbiot
PATCH 1/48 splice: fix racy pipe->buffers uses
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 047fe3605235888f3ebcda0c728cb31937eadfe6 upstream.
Dave Jones reported a kernel BUG at mm/slub.c:3474! triggered by splice_shrink_spd() called from vmsplice_to_pipe()
commit 35f3d14dbbc5 (pipe: add support for shrinking and growing pipes) added capability to adjust pipe->buffers.
Problem is some paths don't hold pipe mutex and assume pipe->buffers doesn't change for their duration.
Fix this by adding nr_pages_max field in struct splice_pipe_desc, and use it in place of pipe->buffers where appropriate.
splice_shrink_spd() loses its struct pipe_inode_info argument.
[bwh: Backported to 3.2:
- Adjust context in vmsplice_to_pipe()
- Update one more call to splice_shrink_spd(), from skb_splice_bits()]
--- fs/splice.c | 35 ++++++++++++++++++++--------------- include/linux/splice.h | 8 ++++---- kernel/relay.c | 5 +++-- kernel/trace/trace.c | 6 ++++-- mm/shmem.c | 3 ++- net/core/skbuff.c | 1 + 6 files changed, 34 insertions(+), 24 deletions(-)
fs/splice.c +20 -15
@@ -274,13 +274,16 @@ void spd_release_page(struct splice_pipe* Check if we need to grow the arrays holding pages and partial page * descriptions. */ -int splice_grow_spd (struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) +int splice_grow_spd (const struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +unsigned int buffers =ACCESS_ONCE (pipe->buffers); + + spd->nr_pages_max = buffers; +if (buffers <=PIPE_DEF_BUFFERS )return 0 ; - spd->pages =kmalloc (pipe->buffers *sizeof (struct page *),GFP_KERNEL ); - spd->partial =kmalloc (pipe->buffers *sizeof (struct partial_page ),GFP_KERNEL ); + spd->pages =kmalloc (buffers *sizeof (struct page *),GFP_KERNEL ); + spd->partial =kmalloc (buffers *sizeof (struct partial_page ),GFP_KERNEL );if (spd->pages && spd->partial)return 0 ;
@@ -290,10 +293,9 @@ int splice_grow_spd(struct pipe_inode_inreturn -ENOMEM ; } -void splice_shrink_spd (struct pipe_inode_info *pipe, -struct splice_pipe_desc *spd) +void splice_shrink_spd (struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +if (spd->nr_pages_max <=PIPE_DEF_BUFFERS )return ;kfree (spd->pages);
@@ -316,6 +318,7 @@ __generic_file_splice_read(struct file *struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -327,7 +330,7 @@ __generic_file_splice_read(struct file * index = *ppos >>PAGE_CACHE_SHIFT ; loff = *ppos & ~PAGE_CACHE_MASK ; req_pages = (len + loff +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; - nr_pages =min (req_pages, pipe->buffers); + nr_pages =min (req_pages, spd.nr_pages_max);/* * Lookup the (hopefully) full range of pages we need.
@@ -498,7 +501,7 @@ fill_it:if (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return error; }
@@ -599,6 +602,7 @@ ssize_t default_file_splice_read(structstruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &default_pipe_buf_ops, .spd_release = spd_release_page,
@@ -609,8 +613,8 @@ ssize_t default_file_splice_read(struct res = -ENOMEM ; vec = __vec; -if (pipe->buffers >PIPE_DEF_BUFFERS ) { - vec =kmalloc (pipe->buffers *sizeof (struct iovec ),GFP_KERNEL ); +if (spd.nr_pages_max >PIPE_DEF_BUFFERS ) { + vec =kmalloc (spd.nr_pages_max *sizeof (struct iovec ),GFP_KERNEL );if (!vec) goto shrink_ret; }
@@ -618,7 +622,7 @@ ssize_t default_file_splice_read(struct offset = *ppos & ~PAGE_CACHE_MASK ; nr_pages = (len + offset +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; -for (i =0 ; i < nr_pages && i < pipe->buffers && len; i++) { +for (i =0 ; i < nr_pages && i < spd.nr_pages_max && len; i++) {struct page *page; page =alloc_page (GFP_USER );
@@ -666,7 +670,7 @@ ssize_t default_file_splice_read(struct shrink_ret:if (vec != __vec)kfree (vec); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return res; err:
@@ -1616,6 +1620,7 @@ static long vmsplice_to_pipe(struct filestruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &user_page_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1631,13 +1636,13 @@ static long vmsplice_to_pipe(struct file spd.nr_pages =get_iovec_page_array (iov, nr_segs, spd.pages, spd.partial, flags &SPLICE_F_GIFT , - pipe->buffers); + spd.nr_pages_max);if (spd.nr_pages <=0 ) ret = spd.nr_pages;else ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; }
include/linux/splice.h +4 -4
@@ -51,7 +51,8 @@ struct partial_page {struct splice_pipe_desc {struct page **pages;/* page map */ struct partial_page *partial;/* pages[] may not be contig */ -int nr_pages;/* number of pages in map */ +int nr_pages;/* number of populated pages in map */ +unsigned int nr_pages_max;/* pages[] & partial[] arrays size */ unsigned int flags;/* splice flags */ const struct pipe_buf_operations *ops;/* ops associated with output pipe */ void (*spd_release)(struct splice_pipe_desc *,unsigned int );
@@ -85,9 +86,8 @@ extern ssize_t splice_direct_to_actor(st/* * for dynamic pipe sizing */ -extern int splice_grow_spd (struct pipe_inode_info *,struct splice_pipe_desc *); -extern void splice_shrink_spd (struct pipe_inode_info *, -struct splice_pipe_desc *); +extern int splice_grow_spd (const struct pipe_inode_info *,struct splice_pipe_desc *); +extern void splice_shrink_spd (struct splice_pipe_desc *);extern void spd_release_page (struct splice_pipe_desc *,unsigned int );extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
kernel/relay.c +3 -2
@@ -1235,6 +1235,7 @@ static ssize_t subbuf_splice_actor(strucstruct splice_pipe_desc spd = { .pages = pages, .nr_pages =0 , + .nr_pages_max =PIPE_DEF_BUFFERS , .partial = partial, .flags = flags, .ops = &relay_pipe_buf_ops,
@@ -1302,8 +1303,8 @@ static ssize_t subbuf_splice_actor(struc ret += padding; out: -splice_shrink_spd (pipe, &spd); -return ret; +splice_shrink_spd (&spd); +return ret; } static ssize_t relay_file_splice_read(struct file *in,
kernel/trace/trace.c +4 -2
@@ -3456,6 +3456,7 @@ static ssize_t tracing_splice_read_pipe( .pages = pages_def, .partial = partial_def, .nr_pages = 0, /* This gets updated below. */ + .nr_pages_max = PIPE_DEF_BUFFERS, .flags = flags, .ops = &tracing_pipe_buf_ops, .spd_release = tracing_spd_release_pipe,
@@ -3527,7 +3528,7 @@ static ssize_t tracing_splice_read_pipe( ret =splice_to_pipe (pipe, &spd); out: -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; out_err:
@@ -4017,6 +4018,7 @@ tracing_buffers_splice_read(struct filestruct splice_pipe_desc spd = { .pages = pages_def, .partial = partial_def, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &buffer_pipe_buf_ops, .spd_release = buffer_spd_release,
@@ -4104,7 +4106,7 @@ tracing_buffers_splice_read(struct file } ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd); out:return ret; }
mm/shmem.c +2 -1
@@ -1359,6 +1359,7 @@ static ssize_t shmem_file_splice_read(ststruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1447,7 +1448,7 @@ static ssize_t shmem_file_splice_read(stif (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);if (error >0 ) { *ppos += error;
net/core/skbuff.c +2 -1
@@ -1663,6 +1663,7 @@ int skb_splice_bits(struct sk_buff *skb,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =MAX_SKB_FRAGS , .flags = flags, .ops = &sock_pipe_buf_ops, .spd_release = sock_spd_release,
@@ -1709,7 +1710,7 @@ done:lock_sock (sk); } -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; }
PATCH 2/48 umem: fix up unplugging
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Guo <[email protected]>
commit 32587371ad3db2f9d335de10dbd8cffd4fff5669 upstream.
Fix a regression introduced by 7eaceaccab5f40 ("block: remove per-queue plugging"). In that patch, Jens removed the whole mm_unplug_device() function, which used to be the trigger to make umem start to work.
We need to implement unplugging to make umem start to work, or I/O will never be triggered.
--- drivers/block/umem.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/block/umem.c +40 -0
@@ -513,6 +513,44 @@ static void process_page(unsigned long data) } } +struct mm_plug_cb { +struct blk_plug_cb cb; +struct cardinfo *card; +}; + +static void mm_unplug (struct blk_plug_cb *cb) +{ + struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb); + +spin_lock_irq (&mmcb->card->lock); +activate (mmcb->card); +spin_unlock_irq (&mmcb->card->lock); +kfree (mmcb); +} + +static int mm_check_plugged (struct cardinfo *card) +{ +struct blk_plug *plug = current->plug; +struct mm_plug_cb *mmcb; + +if (!plug) +return 0 ; + +list_for_each_entry (mmcb, &plug->cb_list, cb.list) { +if (mmcb->cb.callback == mm_unplug && mmcb->card == card) +return 1 ; + } +/* Not currently on the callback list */ + mmcb =kmalloc (sizeof (*mmcb),GFP_ATOMIC ); +if (!mmcb) +return 0 ; + + mmcb->card = card; + mmcb->cb.callback = mm_unplug; +list_add (&mmcb->cb.list, &plug->cb_list); +return 1 ; +} +static void mm_make_request (struct request_queue *q,struct bio *bio) {struct cardinfo *card = q->queuedata;
@@ -523,6 +561,8 @@ static void mm_make_request(struct request_queue *q, struct bio *bio) *card->biotail = bio; bio->bi_next =NULL ; card->biotail = &bio->bi_next; +if (bio->bi_rw &REQ_SYNC || !mm_check_plugged (card)) +activate (card);spin_unlock_irq (&card->lock);return ;
PATCH 3/48 mwifiex: fix 11n rx packet drop issue
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stone Piao <[email protected]>
commit 925839243dc9aa4ef25305f5afd10ed18258a4ac upstream.
Currently we check the sequence number of last packet received against start_win. If a sequence hole is detected, start_win is updated to next sequence number.
Since the rx sequence number is initialized to 0, a corner case exists when BA setup happens immediately after association. As 0 is a valid sequence number, start_win gets increased to 1 incorrectly. This causes the first packet with sequence number 0 being dropped.
Initialize rx sequence number as 0xffff and skip adjusting start_win if the sequence number remains 0xffff. The sequence number will be updated once the first packet is received.
--- drivers/net/wireless/mwifiex/11n_rxreorder.c | 5 +++-- drivers/net/wireless/mwifiex/11n_rxreorder.h | 7 +++++++ drivers/net/wireless/mwifiex/wmm.c | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/11n_rxreorder.c +3 -2
@@ -256,7 +256,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,else last_seq = priv->rx_seq[tid]; -if (last_seq >= new_node->start_win) +if (last_seq !=MWIFIEX_DEF_11N_RX_SEQ_NUM && + last_seq >= new_node->start_win) new_node->start_win = last_seq +1 ; new_node->win_size = win_size;
@@ -596,5 +597,5 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)spin_unlock_irqrestore (&priv->rx_reorder_tbl_lock, flags);INIT_LIST_HEAD (&priv->rx_reorder_tbl_ptr); -memset (priv->rx_seq,0 ,sizeof (priv->rx_seq)); +mwifiex_reset_11n_rx_seq_num (priv); }
drivers/net/wireless/mwifiex/11n_rxreorder.h +7 -0
@@ -37,6 +37,13 @@#define ADDBA_RSP_STATUS_ACCEPT 0 +#define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff + +static inline void mwifiex_reset_11n_rx_seq_num (struct mwifiex_private *priv) +{ +memset (priv->rx_seq,0xff ,sizeof (priv->rx_seq)); +} + int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, u16 seqNum, u16 tid, u8 *ta,
drivers/net/wireless/mwifiex/wmm.c +2 -0
@@ -404,6 +404,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) priv->add_ba_param.tx_win_size =MWIFIEX_AMPDU_DEF_TXWINSIZE ; priv->add_ba_param.rx_win_size =MWIFIEX_AMPDU_DEF_RXWINSIZE ; +mwifiex_reset_11n_rx_seq_num (priv); +atomic_set (&priv->wmm.tx_pkts_queued,0 );atomic_set (&priv->wmm.highest_queued_prio,HIGH_PRIO_TID ); }
PATCH 4/48 mwifiex: fix WPS eapol handshake failure
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stone Piao <[email protected]>
commit f03ba7e9a24e5e9efaad56bd1713b994ea556b16 upstream.
After association, STA will go through eapol handshake with WPS enabled AP. It's observed that WPS handshake fails with some 11n AP. The reason for the failure is that the eapol packet is sent via 11n frame aggregation.
The eapol packet should be sent directly without 11n aggregation.
This patch fixes the problem by adding WPS session control while dequeuing Tx packets for transmission.
[bwh: Backported to 3.2: reformat the if-statement per earlier
upstream commit c65a30f35f938b421ac67c34a9e70b0e49e6019a]
---
drivers/net/wireless/mwifiex/wmm.c +6 -4
@@ -1211,10 +1211,12 @@ mwifiex_dequeue_tx_packet(struct mwifiexreturn 0 ; } -if (!ptr->is_11n_enabled ||mwifiex_is_ba_stream_setup (priv, ptr, tid) - || ((priv->sec_info.wpa_enabled - || priv->sec_info.wpa2_enabled) && !priv->wpa_is_gtk_set) - ) { +if (!ptr->is_11n_enabled || +mwifiex_is_ba_stream_setup (priv, ptr, tid) || + priv->wps.session_enable || + ((priv->sec_info.wpa_enabled || + priv->sec_info.wpa2_enabled) && + !priv->wpa_is_gtk_set)) {mwifiex_send_single_packet (priv, ptr, ptr_index, flags);/* ra_list_spinlock has been freed in mwifiex_send_single_packet() */
PATCH 5/48 NFC: Prevent multiple buffer overflows in NCI
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Rosenberg <[email protected]>
commit 67de956ff5dc1d4f321e16cfbd63f5be3b691b43 upstream.
Fix multiple remotely-exploitable stack-based buffer overflows due to the NCI code pulling length fields directly from incoming frames and copying too much data into statically-sized arrays.
[bwh: Backported to 3.2:
- Drop changes to parsing of tech B and tech F parameters
- Various renaming]
---
net/nfc/nci/ntf.c +2 -2
@@ -86,7 +86,7 @@ static int nci_rf_activate_nfca_passive_ nfca_poll->sens_res =__le16_to_cpu (*((__u16 *)data)); data +=2 ; - nfca_poll->nfcid1_len = *data++; + nfca_poll->nfcid1_len =min_t (__u8, *data++,sizeof (nfca_poll->nfcid1)); nfc_dbg("sens_res 0x%x, nfcid1_len %d", nfca_poll->sens_res,
@@ -111,7 +111,7 @@ static int nci_rf_activate_nfca_passive_switch (ntf->rf_interface_type) {case NCI_RF_INTERFACE_ISO_DEP : - nfca_poll_iso_dep->rats_res_len = *data++; + nfca_poll_iso_dep->rats_res_len =min_t (__u8, *data++,20 );if (nfca_poll_iso_dep->rats_res_len >0 ) { memcpy(nfca_poll_iso_dep->rats_res, data,
PATCH 6/48 ath9k: fix dynamic WEP related regression
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit bed3d9c0b71f9afbfec905cb6db3b9f16be29d4d upstream.
commit 7a532fe7131216a02c81a6c1b1f8632da1195a58ath9k_hw: fix interpretation of the rx KeyMiss flag
This commit used the rx key miss indication to detect packets that were passed from the hardware without being decrypted, however it seems that this bit is not only undefined in the static WEP case, but also for dynamically allocated WEP keys. This caused a regression when using WEP-LEAP.
This patch fixes the regression by keeping track of which key indexes refer to CCMP keys and only using the key miss indication for those.
--- drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/ath9k/recv.c | 3 ++- drivers/net/wireless/ath/key.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath.h +1 -0
@@ -143,6 +143,7 @@ struct ath_common {u32 keymax;DECLARE_BITMAP (keymap,ATH_KEYMAX );DECLARE_BITMAP (tkip_keymap,ATH_KEYMAX ); +DECLARE_BITMAP (ccmp_keymap,ATH_KEYMAX );enum ath_crypt_caps crypt_caps;unsigned int clockrate;
drivers/net/wireless/ath/ath9k/recv.c +2 -1
@@ -829,7 +829,8 @@ static bool ath9k_rx_accept(struct ath_c* descriptor does contain a valid key index. This has been observed * mostly with CCMP encryption. */ -if (rx_stats->rs_keyix ==ATH9K_RXKEYIX_INVALID ) +if (rx_stats->rs_keyix ==ATH9K_RXKEYIX_INVALID || + !test_bit (rx_stats->rs_keyix, common->ccmp_keymap)) rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS ;if (!rx_stats->rs_datalen)
drivers/net/wireless/ath/key.c +4 -0
@@ -556,6 +556,9 @@ int ath_key_config(struct ath_common *coreturn -EIO ;set_bit (idx, common->keymap); +if (key->cipher ==WLAN_CIPHER_SUITE_CCMP ) +set_bit (idx, common->ccmp_keymap); +if (key->cipher ==WLAN_CIPHER_SUITE_TKIP ) {set_bit (idx +64 , common->keymap);set_bit (idx, common->tkip_keymap);
@@ -582,6 +585,7 @@ void ath_key_delete(struct ath_common *creturn ;clear_bit (key->hw_key_idx, common->keymap); +clear_bit (key->hw_key_idx, common->ccmp_keymap);if (key->cipher !=WLAN_CIPHER_SUITE_TKIP )return ;
PATCH 7/48 NFC: Return from rawsock_release when sk is NULL
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 03e934f620101ca2cfc9383bd76172dd3e1f8567 upstream.
Sasha Levin reported following panic :
[ 2136.383310] BUG: unable to handle kernel NULL pointer dereference at 00000000000003b0 [ 2136.384022] IP: [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0 [ 2136.384022] PGD 131c4067 PUD 11c0c067 PMD 0 [ 2136.388106] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [ 2136.388106] CPU 1 [ 2136.388106] Pid: 24855, comm: trinity-child1 Tainted: G W 3.5.0-rc2-sasha-00015-g7b268f7 #374 [ 2136.388106] RIP: 0010:[<ffffffff8114e400>] [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0 [ 2136.388106] RSP: 0018:ffff8800130b3ca8 EFLAGS: 00010046 [ 2136.388106] RAX: 0000000000000086 RBX: ffff88001186b000 RCX: 0000000000000000 [ 2136.388106] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 2136.388106] RBP: ffff8800130b3d08 R08: 0000000000000001 R09: 0000000000000000 [ 2136.388106] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000002 [ 2136.388106] R13: 00000000000003b0 R14: 0000000000000000 R15: 0000000000000000 [ 2136.388106] FS: 00007fa5b1bd4700(0000) GS:ffff88001b800000(0000) knlGS:0000000000000000 [ 2136.388106] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2136.388106] CR2: 00000000000003b0 CR3: 0000000011d1f000 CR4: 00000000000406e0 [ 2136.388106] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2136.388106] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2136.388106] Process trinity-child1 (pid: 24855, threadinfo ffff8800130b2000, task ffff88001186b000) [ 2136.388106] Stack: [ 2136.388106] ffff8800130b3cd8 ffffffff81121785 ffffffff81236774 000080d000000001 [ 2136.388106] ffff88001b9d6c00 00000000001d6c00 ffffffff130b3d08 ffff88001186b000 [ 2136.388106] 0000000000000000 0000000000000002 0000000000000000 0000000000000000 [ 2136.388106] Call Trace: [ 2136.388106] [<ffffffff81121785>] ? sched_clock_local+0x25/0x90 [ 2136.388106] [<ffffffff81236774>] ? get_empty_filp+0x74/0x220 [ 2136.388106] [<ffffffff8114e97a>] lock_acquire+0x18a/0x1e0 [ 2136.388106] [<ffffffff836b37df>] ? rawsock_release+0x4f/0xa0 [ 2136.388106] [<ffffffff837c0ef0>] _raw_write_lock_bh+0x40/0x80 [ 2136.388106] [<ffffffff836b37df>] ? rawsock_release+0x4f/0xa0 [ 2136.388106] [<ffffffff836b37df>] rawsock_release+0x4f/0xa0 [ 2136.388106] [<ffffffff8321cfe8>] sock_release+0x18/0x70 [ 2136.388106] [<ffffffff8321d069>] sock_close+0x29/0x30 [ 2136.388106] [<ffffffff81236bca>] __fput+0x11a/0x2c0 [ 2136.388106] [<ffffffff81236d85>] fput+0x15/0x20 [ 2136.388106] [<ffffffff8321de34>] sys_accept4+0x1b4/0x200 [ 2136.388106] [<ffffffff837c165c>] ? _raw_spin_unlock_irq+0x4c/0x80 [ 2136.388106] [<ffffffff837c1669>] ? _raw_spin_unlock_irq+0x59/0x80 [ 2136.388106] [<ffffffff837c2565>] ? sysret_check+0x22/0x5d [ 2136.388106] [<ffffffff8321de8b>] sys_accept+0xb/0x10 [ 2136.388106] [<ffffffff837c2539>] system_call_fastpath+0x16/0x1b [ 2136.388106] Code: ec 04 00 0f 85 ea 03 00 00 be d5 0b 00 00 48 c7 c7 8a c1 40 84 e8 b1 a5 f8 ff 31 c0 e9 d4 03 00 00 66 2e 0f 1f 84 00 00 00 00 00 <49> 81 7d 00 60 73 5e 85 b8 01 00 00 00 44 0f 44 e0 83 fe 01 77 [ 2136.388106] RIP [<ffffffff8114e400>] __lock_acquire+0xc0/0x4b0 [ 2136.388106] RSP <ffff8800130b3ca8> [ 2136.388106] CR2: 00000000000003b0 [ 2136.388106] ---[ end trace 6d450e935ee18982 ]--- [ 2136.388106] Kernel panic - not syncing: Fatal exception in interrupt
rawsock_release() should test if sock->sk is NULL before calling sock_orphan()/sock_put()
--- net/nfc/rawsock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/nfc/rawsock.c +4 -1
@@ -52,7 +52,10 @@ static int rawsock_release(struct socket {struct sock *sk = sock->sk; -nfc_dbg ("sock=%p" , sock); +nfc_dbg ("sock=%p sk=%p" , sock, sk); + +if (!sk) +return 0 ;sock_orphan (sk);sock_put (sk);
PATCH 8/48 rtlwifi: rtl8192cu: New USB IDs
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f63d7dabd5da9ef41f28f6d69b29bc084db0ca5a upstream.
The latest Realtek driver for the RTL8188CU and RTL8192CU chips adds three new USB IDs.
--- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +3 -0
@@ -301,9 +301,11 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ + {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ + {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*//* HP - Lite-On ,8188CUS Slim Combo */ {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
@@ -346,6 +348,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ + {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
PATCH 9/48 ath9k: enable serialize_regmode for non-PCIE AR9287
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Panayiotis Karabassis <[email protected]>
commit 7508b657967cf664b5aa0f6367d05016e7e3bc2a upstream.
https://bugzilla.kernel.org/show_bug.cgi?id=42903
Based on the work of <[email protected]>
--- drivers/net/wireless/ath/ath9k/hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -557,7 +557,7 @@ static int __ath9k_hw_init(struct ath_hwif (ah->config.serialize_regmode ==SER_REG_MODE_AUTO ) {if (ah->hw_version.macVersion ==AR_SREV_VERSION_5416_PCI || - ((AR_SREV_9160 (ah) ||AR_SREV_9280 (ah)) && + ((AR_SREV_9160 (ah) ||AR_SREV_9280 (ah) ||AR_SREV_9287 (ah)) && !ah->is_pciexpress)) { ah->config.serialize_regmode =SER_REG_MODE_ON ;
PATCH 10/48 mac80211: correct behaviour on unrecognised action frames
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 4b5ebccc40843104d980f0714bc86bfcd5568941 upstream.
When receiving an "individually addressed" action frame, the receiver is required to return it to the sender. mac80211 gets this wrong as it also returns group addressed (mcast) frames to the sender. Fix this and update the reference to the new 802.11 standards version since things were shuffled around significantly.
--- net/mac80211/rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/rx.c +4 -1
@@ -2455,7 +2455,7 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)* frames that we didn't handle, including returning unknown * ones. For all other modes we will return them to the sender, * setting the 0x80 bit in the action category, as required by -* 802.11-2007 7.3.1.11. +* 802.11-2012 9.24.4. * Newer versions of hostapd shall also use the management frame * registration mechanisms, but older ones still use cooked * monitor interfaces so push all frames there.
@@ -2465,6 +2465,9 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx) sdata->vif.type == NL80211_IFTYPE_AP_VLAN))return RX_DROP_MONITOR ; +if (is_multicast_ether_addr (mgmt->da)) +return RX_DROP_MONITOR ; +/* do not return rejected action frames */ if (mgmt->u.action.category &0x80 )return RX_DROP_UNUSABLE ;
PATCH 11/48 ASoC: tlv320aic3x: Fix codec pll configure bug
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Hebbar, Gururaja" <[email protected]>
commit c9fe573a6584034670c1a55ee8162d623519cbbf upstream.
In sound/soc/codecs/tlv320aic3x.c
data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
snd_soc_write(codec, AIC3X_PLL_PROGA_REG,
data | (pll_p << PLLP_SHIFT));In the above code, pll-p value is OR'ed with previous value without clearing it. Bug is not seen if pll-p value doesn't change across Sampling frequency.
However on some platforms (like AM335x EVM-SK), pll-p may have different values across different sampling frequencies. In such case, above code configures the pll with a wrong value.
Because of this bug, when a audio stream is played with pll value different from previous stream, audio is heard as differently(like its stretched).
--- sound/soc/codecs/tlv320aic3x.c | 4 +--- sound/soc/codecs/tlv320aic3x.h | 1 + 2 files changed, 2 insertions(+), 3 deletions(-)
sound/soc/codecs/tlv320aic3x.c +1 -3
@@ -935,9 +935,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, } found: - data =snd_soc_read (codec,AIC3X_PLL_PROGA_REG ); -snd_soc_write (codec,AIC3X_PLL_PROGA_REG , - data | (pll_p <<PLLP_SHIFT )); +snd_soc_update_bits (codec,AIC3X_PLL_PROGA_REG ,PLLP_MASK , pll_p);snd_soc_write (codec,AIC3X_OVRF_STATUS_AND_PLLR_REG , pll_r <<PLLR_SHIFT );snd_soc_write (codec,AIC3X_PLL_PROGB_REG , pll_j <<PLLJ_SHIFT );
sound/soc/codecs/tlv320aic3x.h +1 -0
@@ -166,6 +166,7 @@/* PLL registers bitfields */ #define PLLP_SHIFT 0 +#define PLLP_MASK 7#define PLLQ_SHIFT 3#define PLLR_SHIFT 0#define PLLJ_SHIFT 2
PATCH 12/48 powerpc/xmon: Use cpumask iterator to avoid warning
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit bc1d7702910c7c7e88eb60b58429dbfe293683ce upstream.
We have a bug report where the kernel hits a warning in the cpumask code:
WARNING: at include/linux/cpumask.h:107
Which is:
WARN_ON_ONCE(cpu >= nr_cpumask_bits);
The backtrace is:
cpu_cmd
cmds
xmon_core
xmon
die
xmon is iterating through 0 to NR_CPUS. I'm not sure why we are still open coding this but iterating above nr_cpu_ids is definitely a bug.
This patch iterates through all possible cpus, in case we issue a system reset and CPUs in an offline state call in.
Perhaps the old code was trying to handle CPUs that were in the partition but were never started (eg kexec into a kernel with an nr_cpus= boot option). They are going to die way before we get into xmon since we haven't set any kernel state up for them.
--- arch/powerpc/xmon/xmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/xmon/xmon.c +1 -1
@@ -971,7 +971,7 @@ static int cpu_cmd(void)/* print cpus waiting or in xmon */ printf ("cpus stopped:" ); count =0 ; -for (cpu =0 ; cpu <NR_CPUS ; ++cpu) { +for_each_possible_cpu (cpu) {if (cpumask_test_cpu (cpu, &cpus_in_xmon)) {if (count ==0 )printf (" %x" , cpu);
PATCH 13/48 powerpc/kvm: sldi should be sld
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit 2f584a146a2965b82fce89b8d2f95dc5cfe468d0 upstream.
Since we are taking a registers, this should never have been an sldi. Talking to paulus offline, this is the correct fix.
Was introduced by:
commit 19ccb76a1938ab364a412253daec64613acbf3df
Author: Paul Mackerras <[email protected]>
Date: Sat Jul 23 17:42:46 2011 +1000
Talking to paulus, this shouldn't be a literal.
--- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv_rmhandlers.S +1 -1
@@ -810,7 +810,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) lwz r3,VCORE_NAPPING_THREADS(r5) lwz r4,VCPU_PTID(r9) li r0,1 - sldi r0,r0,r4 + sld r0,r0,r4 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ beq 43f mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
PATCH 14/48 md/raid10: Dont try to recovery unmatched (and unused) chunks.
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit fc448a18ae6219af9a73257b1fbcd009efab4a81 upstream.
If a RAID10 has an odd number of chunks - as might happen when there are an odd number of devices - the last chunk has no pair and so is not mirrored. We don't store data there, but when recovering the last device in an array we retry to recover that last chunk from a non-existent location. This results in an error, and the recovery aborts.
When we get to that last chunk we should just stop - there is nothing more to do anyway.
This bug has been present since the introduction of RAID10, so the patch is appropriate for any -stable kernel.
--- drivers/md/raid10.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/raid10.c +6 -0
@@ -2436,6 +2436,12 @@ static sector_t sync_request(struct mdde/* want to reconstruct this device */ rb2 = r10_bio; sect =raid10_find_virt (conf, sector_nr, i); +if (sect >= mddev->resync_max_sectors) { +/* last stripe is not complete - don't +* try to recover this sector. +*/ +continue ; + }/* Unless we are doing a full sync, we only need * to recover the block if it is set in the bitmap */
PATCH 15/48 md/raid5: Do not add data_offset before call to is_badblock
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: majianpeng <[email protected]>
commit 6c0544e255dd6582a9899572e120fb55d9f672a4 upstream.
In chunk_aligned_read() we are adding data_offset before calling is_badblock. But is_badblock also adds data_offset, so that is bad.
So move the addition of data_offset to after the call to is_badblock.
This bug was introduced by commit 31c176ecdf3563140e639
md/raid5: avoid reading from known bad blocks.
which first appeared in 3.0. So that patch is suitable for any -stable kernel from 3.0.y onwards. However it will need minor revision for most of those (as the comment didn't appear until recently).
--- drivers/md/raid5.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid5.c +3 -1
@@ -3621,7 +3621,6 @@ static int chunk_aligned_read(struct mdd raid_bio->bi_next = (void *)rdev; align_bi->bi_bdev = rdev->bdev; align_bi->bi_flags &= ~(1 <<BIO_SEG_VALID ); - align_bi->bi_sector += rdev->data_offset;if (!bio_fits_rdev (align_bi) || is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3632,6 +3631,9 @@ static int chunk_aligned_read(struct mddreturn 0 ; } +/* No reshape active, so we can trust rdev->data_offset */ + align_bi->bi_sector += rdev->data_offset; +spin_lock_irq (&conf->device_lock); wait_event_lock_irq(conf->wait_for_stripe, conf->quiesce == 0,
PATCH 16/48 md/raid5: In ops_run_io, inc nr_pending before calling md_wait_for_blocked_rdev
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: majianpeng <[email protected]>
commit 1850753d2e6d9ca7856581ca5d3cf09521e6a5d7 upstream.
In ops_run_io(), the call to md_wait_for_blocked_rdev will decrement nr_pending so we lose the reference we hold on the rdev. So atomic_inc it first to maintain the reference.
This bug was introduced by commit 73e92e51b7969ef5477d
md/raid5. Don't write to known bad block on doubtful devices.
which appeared in 3.0, so patch is suitable for stable kernels since then.
--- drivers/md/raid5.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/raid5.c +6 -0
@@ -606,6 +606,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)* a chance*/ md_check_recovery (conf->mddev); } +/* +* Because md_wait_for_blocked_rdev +* will dec nr_pending, we must +* increment it first. +*/ +atomic_inc (&rdev->nr_pending);md_wait_for_blocked_rdev (rdev, conf->mddev); }else {/* Acknowledged bad block - skip the write */
PATCH 17/48 md/raid10: fix failure when trying to repair a read error.
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 055d3747dbf00ce85c6872ecca4d466638e80c22 upstream.
commit 58c54fcca3bac5bf9290cfed31c76e4c4bfbabaf
md/raid10: handle further errors during fix_read_error better.
in 3.1 added "r10_sync_page_io" which takes an IO size in sectors. But we were passing the IO size in bytes!!!
This resulting in bio_add_page failing, and empty request being sent down, and a consequent BUG_ON in scsi_lib.
[fix missing space in error message at same time]
This fix is suitable for 3.1.y and later.
--- drivers/md/raid10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/raid10.c +3 -3
@@ -1919,7 +1919,7 @@ static void fix_read_error(struct r10conif (r10_sync_page_io (rdev, r10_bio->devs[sl].addr + sect, - s<<9 , conf->tmppage,WRITE ) + s, conf->tmppage,WRITE ) ==0 ) {/* Well, this device is dead */ printk(KERN_NOTICE
@@ -1956,7 +1956,7 @@ static void fix_read_error(struct r10conswitch (r10_sync_page_io (rdev, r10_bio->devs[sl].addr + sect, - s<<9 , conf->tmppage, + s, conf->tmppage,READ )) {case 0 :/* Well, this device is dead */
@@ -2119,7 +2119,7 @@ read_more: rdev = conf->mirrors[mirror].rdev; printk_ratelimited( KERN_ERR - "md/raid10:%s: %s: redirecting" + "md/raid10:%s: %s: redirecting " "sector %llu to another mirror\n", mdname(mddev), bdevname(rdev->bdev, b),
PATCH 18/48 drm/i915: kick any firmware framebuffers before claiming the gtt
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 9f846a16d213523fbe6daea17e20df6b8ac5a1e5 upstream.
Especially vesafb likes to map everything as uc- (yikes), and if that mapping hangs around still while we try to map the gtt as wc the kernel will downgrade our request to uc-, resulting in abyssal performance.
Unfortunately we can't do this as early as readon does (i.e. as the first thing we do when initializing the hw) because our fb/mmio space region moves around on a per-gen basis. So I've had to move it below the gtt initialization, but that seems to work, too. The important thing is that we do this before we set up the gtt wc mapping.
Now an altogether different question is why people compile their kernels with vesafb enabled, but I guess making things just work isn't bad per se ...
v2:
- s/radeondrmfb/inteldrmfb/
- fix up error handling
v3: Kill #ifdef X86, this is Intel after all. Noticed by Ben Widawsky.
v4: Jani Nikula complained about the pointless bool primary initialization.
v5: Don't oops if we can't allocate, noticed by Chris Wilson.
v6: Resolve conflicts with agp rework and fixup whitespace.
This is commit e188719a2891f01b3100d in drm-next.
Backport to 3.5 -fixes queue requested by Dave Airlie - due to grub using vesa on fedora their initrd seems to load vesafb before loading the real kms driver. So tons more people actually experience a dead-slow gpu. Hence also the Cc: stable.
--- drivers/gpu/drm/i915/i915_dma.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +30 -7
@@ -1890,6 +1890,27 @@ ips_ping_for_i915_load(void) } } +static void i915_kick_out_firmware_fb (struct drm_i915_private *dev_priv) +{ +struct apertures_struct *ap; +struct pci_dev *pdev = dev_priv->dev->pdev; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base = dev_priv->dev->agp->base; + ap->ranges[0 ].size = + dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ; + primary = + pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ; + +remove_conflicting_framebuffers (ap,"inteldrmfb" , primary); + +kfree (ap); +} +/** * i915_driver_load - setup chip and create an initial config * @dev: DRM device
@@ -1927,6 +1948,15 @@ int i915_driver_load(struct drm_device * goto free_priv; } + dev_priv->mm.gtt =intel_gtt_get (); +if (!dev_priv->mm.gtt) { +DRM_ERROR ("Failed to initialize GTT\n" ); + ret = -ENODEV ; + goto put_bridge; + } + +i915_kick_out_firmware_fb (dev_priv); +/* overlay on gen2 is broken and can't address above 1G */ if (IS_GEN2 (dev))dma_set_coherent_mask (&dev->pdev->dev,DMA_BIT_MASK (30 ));
@@ -1950,13 +1980,6 @@ int i915_driver_load(struct drm_device * goto put_bridge; } - dev_priv->mm.gtt =intel_gtt_get (); -if (!dev_priv->mm.gtt) { -DRM_ERROR ("Failed to initialize GTT\n" ); - ret = -ENODEV ; - goto out_rmmap; - } - agp_size = dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ; dev_priv->mm.gtt_mapping =
PATCH 19/48 dm persistent data: fix shadow_info_leak on dm_tm_destroy
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 25d7cd6faa7ae6ed2565617c3ee2500ccb8a9f7f upstream.
Cleanup the shadow table before destroying the transaction manager.
Reference: leak was identified with kmemleak when running test_discard_random_sectors in the thinp-test-suite.
--- drivers/md/persistent-data/dm-transaction-manager.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/persistent-data/dm-transaction-manager.c +3 -0
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone);void dm_tm_destroy (struct dm_transaction_manager *tm) { +if (!tm->is_clone) +wipe_shadow_table (tm); +kfree (tm); }EXPORT_SYMBOL_GPL (dm_tm_destroy);
PATCH 20/48 dm persistent data: handle space map checker creation failure
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 62662303e7f590fdfbb0070ab820a0ad4267c119 upstream.
If CONFIG_DM_DEBUG_SPACE_MAPS is enabled and dm_sm_checker_create() fails, dm_tm_create_internal() would still return success even though it cleaned up all resources it was supposed to have created. This will lead to a kernel crash:
general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC ... RIP: 0010:[<ffffffff81593659>] [<ffffffff81593659>] dm_bufio_get_block_size+0x9/0x20 Call Trace: [<ffffffff81599bae>] dm_bm_block_size+0xe/0x10 [<ffffffff8159b8b8>] sm_ll_init+0x78/0xd0 [<ffffffff8159c1a6>] sm_ll_new_disk+0x16/0xa0 [<ffffffff8159c98e>] dm_sm_disk_create+0xfe/0x160 [<ffffffff815abf6e>] dm_pool_metadata_open+0x16e/0x6a0 [<ffffffff815aa010>] pool_ctr+0x3f0/0x900 [<ffffffff8158d565>] dm_table_add_target+0x195/0x450 [<ffffffff815904c4>] table_load+0xe4/0x330 [<ffffffff815917ea>] ctl_ioctl+0x15a/0x2c0 [<ffffffff81591963>] dm_ctl_ioctl+0x13/0x20 [<ffffffff8116a4f8>] do_vfs_ioctl+0x98/0x560 [<ffffffff8116aa51>] sys_ioctl+0x91/0xa0 [<ffffffff81869f52>] system_call_fastpath+0x16/0x1b
Fix the space map checker code to return an appropriate ERR_PTR and have dm_sm_disk_create() and dm_tm_create_internal() check for it with IS_ERR.
--- drivers/md/persistent-data/dm-space-map-checker.c | 24 ++++++++++---------- drivers/md/persistent-data/dm-space-map-disk.c | 11 ++++++++- .../md/persistent-data/dm-transaction-manager.c | 8 +++++-- 3 files changed, 28 insertions(+), 15 deletions(-)
drivers/md/persistent-data/dm-space-map-checker.c +12 -12
@@ -343,25 +343,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)int r;struct sm_checker *smc; -if (!sm) -return NULL ; +if (IS_ERR_OR_NULL (sm)) +return ERR_PTR (-EINVAL ); smc =kmalloc (sizeof (*smc),GFP_KERNEL );if (!smc) -return NULL ; +return ERR_PTR (-ENOMEM );memcpy (&smc->sm, &ops_,sizeof (smc->sm)); r =ca_create (&smc->old_counts, sm);if (r) {kfree (smc); -return NULL ; +return ERR_PTR (r); } r =ca_create (&smc->counts, sm);if (r) {ca_destroy (&smc->old_counts);kfree (smc); -return NULL ; +return ERR_PTR (r); } smc->real_sm = sm;
@@ -371,7 +371,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)ca_destroy (&smc->counts);ca_destroy (&smc->old_counts);kfree (smc); -return NULL ; +return ERR_PTR (r); } r =ca_commit (&smc->old_counts, &smc->counts);
@@ -379,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm)ca_destroy (&smc->counts);ca_destroy (&smc->old_counts);kfree (smc); -return NULL ; +return ERR_PTR (r); }return &smc->sm;
@@ -391,25 +391,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm)int r;struct sm_checker *smc; -if (!sm) -return NULL ; +if (IS_ERR_OR_NULL (sm)) +return ERR_PTR (-EINVAL ); smc =kmalloc (sizeof (*smc),GFP_KERNEL );if (!smc) -return NULL ; +return ERR_PTR (-ENOMEM );memcpy (&smc->sm, &ops_,sizeof (smc->sm)); r =ca_create (&smc->old_counts, sm);if (r) {kfree (smc); -return NULL ; +return ERR_PTR (r); } r =ca_create (&smc->counts, sm);if (r) {ca_destroy (&smc->old_counts);kfree (smc); -return NULL ; +return ERR_PTR (r); } smc->real_sm = sm;
drivers/md/persistent-data/dm-space-map-disk.c +10 -1
@@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm, dm_block_t nr_blocks) {struct dm_space_map *sm =dm_sm_disk_create_real (tm, nr_blocks); -return dm_sm_checker_create_fresh (sm); +struct dm_space_map *smc; + +if (IS_ERR_OR_NULL (sm)) +return sm; + + smc =dm_sm_checker_create_fresh (sm); +if (IS_ERR (smc)) +dm_sm_destroy (sm); + +return smc; }EXPORT_SYMBOL_GPL (dm_sm_disk_create);
drivers/md/persistent-data/dm-transaction-manager.c +6 -2
@@ -347,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, } *sm =dm_sm_checker_create (inner); -if (!*sm) +if (IS_ERR (*sm)) { + r =PTR_ERR (*sm); goto bad2; + } }else { r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location,
@@ -367,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, } *sm =dm_sm_checker_create (inner); -if (!*sm) +if (IS_ERR (*sm)) { + r =PTR_ERR (*sm); goto bad2; + } }return 0 ;
PATCH 21/48 dm persistent data: fix allocation failure in space map checker init
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit b0239faaf87c38bb419c9264bf20817438ddc3a9 upstream.
If CONFIG_DM_DEBUG_SPACE_MAPS is enabled and memory is fragmented and a sufficiently-large metadata device is used in a thin pool then the space map checker will fail to allocate the memory it requires.
Switch from kmalloc to vmalloc to allow larger virtually contiguous allocations for the space map checker's internal count arrays.
--- drivers/md/persistent-data/dm-space-map-checker.c | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/md/persistent-data/dm-space-map-checker.c +19 -11
@@ -8,6 +8,7 @@#include <linux/device-mapper.h> #include <linux/export.h> +#include <linux/vmalloc.h> #ifdef CONFIG_DM_DEBUG_SPACE_MAPS
@@ -89,13 +90,23 @@ static int ca_create(struct count_array *ca, struct dm_space_map *sm) ca->nr = nr_blocks; ca->nr_free = nr_blocks; - ca->counts =kzalloc (sizeof (*ca->counts) * nr_blocks,GFP_KERNEL ); -if (!ca->counts) -return -ENOMEM ; + +if (!nr_blocks) + ca->counts =NULL ; +else { + ca->counts =vzalloc (sizeof (*ca->counts) * nr_blocks); +if (!ca->counts) +return -ENOMEM ; + }return 0 ; } +static void ca_destroy (struct count_array *ca) +{ +vfree (ca->counts); +} +static int ca_load (struct count_array *ca,struct dm_space_map *sm) {int r;
@@ -126,12 +137,14 @@ static int ca_load(struct count_array *ca, struct dm_space_map *sm)static int ca_extend (struct count_array *ca,dm_block_t extra_blocks) {dm_block_t nr_blocks = ca->nr + extra_blocks; -uint32_t *counts =kzalloc (sizeof (*counts) * nr_blocks,GFP_KERNEL ); +uint32_t *counts =vzalloc (sizeof (*counts) * nr_blocks);if (!counts)return -ENOMEM ; -memcpy (counts, ca->counts,sizeof (*counts) * ca->nr); -kfree (ca->counts); +if (ca->counts) { +memcpy (counts, ca->counts,sizeof (*counts) * ca->nr); +ca_destroy (ca); + } ca->nr = nr_blocks; ca->nr_free += extra_blocks; ca->counts = counts;
@@ -151,11 +164,6 @@ static int ca_commit(struct count_array *old, struct count_array *new)return 0 ; } -static void ca_destroy (struct count_array *ca) -{ -kfree (ca->counts); -} -/*----------------------------------------------------------------*/ struct sm_checker {
PATCH 22/48 ALSA: hda - Fix power-map regression for HP dv6 & co
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 6e1c39c6b00d9141a82c231ba7c5e5b1716974b2 upstream.
The recent fix for power-map controls (commit b0791dda813) caused regressions on some other HP laptops. They have fixed pins but these pins are exposed as jack-detectable. Thus the driver tries to control the power-map dynamically per jack detection where it never gets on.
This patch adds the check of connection and it assumes the no jack detection is available for fixed pins no matter what pin capability says.
--- sound/pci/hda/patch_sigmatel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +2 -2
@@ -4457,7 +4457,7 @@ static int stac92xx_init(struct hda_code AC_PINCTL_IN_EN);for (i =0 ; i < spec->num_pwrs; i++) {hda_nid_t nid = spec->pwr_nids[i]; -int pinctl, def_conf; +unsigned int pinctl, def_conf;/* power on when no jack detection is available */ /* or when the VREF is used for controlling LED */
@@ -4484,7 +4484,7 @@ static int stac92xx_init(struct hda_code def_conf =get_defcfg_connect (def_conf);/* skip any ports that don't have jacks since presence * detection is useless */ -if (def_conf !=AC_JACK_PORT_NONE && +if (def_conf !=AC_JACK_PORT_COMPLEX || !is_jack_detectable (codec, nid)) {stac_toggle_power_map (codec, nid,1 );continue ;
PATCH 23/48 tracing: change CPU ring buffer state from tracing_cpumask
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vaibhav Nagarnaik <[email protected]>
commit 71babb2705e2203a64c27ede13ae3508a0d2c16c upstream.
According to Documentation/trace/ftrace.txt:
tracing_cpumask:
This is a mask that lets the user only trace on specified CPUS. The format is a hex string representing the CPUS.
The tracing_cpumask currently doesn't affect the tracing state of per-CPU ring buffers.
This patch enables/disables CPU recording as its corresponding bit in tracing_cpumask is set/unset.
--- kernel/trace/trace.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace.c +2 -0
@@ -2669,10 +2669,12 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,if (cpumask_test_cpu (cpu, tracing_cpumask) && !cpumask_test_cpu (cpu, tracing_cpumask_new)) {atomic_inc (&global_trace.data[cpu]->disabled); +ring_buffer_record_disable_cpu (global_trace.buffer, cpu); }if (!cpumask_test_cpu (cpu, tracing_cpumask) &&cpumask_test_cpu (cpu, tracing_cpumask_new)) {atomic_dec (&global_trace.data[cpu]->disabled); +ring_buffer_record_enable_cpu (global_trace.buffer, cpu); } }arch_spin_unlock (&ftrace_max_lock);
PATCH 24/48 mwifiex: fix wrong return values in add_virtual_intf() error cases
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bing Zhao <[email protected]>
commit 858faa57dd9e2b91f3f870fbb1185982e42f5a2b upstream
backported for linux-3.2.y, linux-3.3.y, linux-3.4.y
add_virtual_intf() needs to return an ERR_PTR(), instead of NULL, on errors, otherwise cfg80211 will crash.
--- drivers/net/wireless/mwifiex/cfg80211.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +9 -12
@@ -1214,11 +1214,11 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,void *mdev_priv;if (!priv) -return NULL ; +return ERR_PTR (-EFAULT ); adapter = priv->adapter;if (!adapter) -return NULL ; +return ERR_PTR (-EFAULT );switch (type) {case NL80211_IFTYPE_UNSPECIFIED :
@@ -1227,7 +1227,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,if (priv->bss_mode) {wiphy_err (wiphy,"cannot create multiple" " station/adhoc interfaces\n" ); -return NULL ; +return ERR_PTR (-EINVAL ); }if (type ==NL80211_IFTYPE_UNSPECIFIED )
@@ -1244,14 +1244,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,break ;default :wiphy_err (wiphy,"type not supported\n" ); -return NULL ; +return ERR_PTR (-EINVAL ); } dev =alloc_netdev_mq (sizeof (struct mwifiex_private *), name, ether_setup,1 );if (!dev) {wiphy_err (wiphy,"no memory available for netdevice\n" ); - goto error; + priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; +return ERR_PTR (-ENOMEM ); }dev_net_set (dev,wiphy_net (wiphy));
@@ -1276,7 +1277,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,/* Register network device */ if (register_netdevice (dev)) {wiphy_err (wiphy,"cannot register virtual network device\n" ); - goto error; +free_netdev (dev); + priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; +return ERR_PTR (-EFAULT ); }sema_init (&priv->async_sem,1 );
@@ -1288,12 +1291,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,mwifiex_dev_debugfs_init (priv);#endif return dev; -error: -if (dev && (dev->reg_state ==NETREG_UNREGISTERED )) -free_netdev (dev); - priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; - -return NULL ; }EXPORT_SYMBOL_GPL (mwifiex_add_virtual_intf);
PATCH 25/48 udf: Use ret instead of abusing i in udf_load_logicalvol()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit cb14d340ef1737c24125dd663eff77734a482d47 upstream.
--- fs/udf/super.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/udf/super.c +2 -4
@@ -1233,11 +1233,9 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; - i =udf_sb_alloc_partition_maps (sb,le32_to_cpu (lvd->numPartitionMaps)); -if (i !=0 ) { - ret = i; + ret =udf_sb_alloc_partition_maps (sb,le32_to_cpu (lvd->numPartitionMaps)); +if (ret) goto out_bh; - } for (i = 0, offset = 0; i < sbi->s_partitions && offset < le32_to_cpu(lvd->mapTableLength);
PATCH 26/48 udf: Avoid run away loop when partition table length is corrupted
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit adee11b2085bee90bd8f4f52123ffb07882d6256 upstream.
Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
--- fs/udf/super.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/udf/super.c +9 -1
@@ -1225,6 +1225,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,struct genericPartitionMap *gpm;uint16_t ident;struct buffer_head *bh; +unsigned int table_len;int ret =0 ; bh =udf_read_tagged (sb, block, block, &ident);
@@ -1232,13 +1233,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,return 1 ;BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; + table_len =le32_to_cpu (lvd->mapTableLength); +if (sizeof (*lvd) + table_len > sb->s_blocksize) { +udf_err (sb,"error loading logical volume descriptor: " +"Partition table too long (%u > %lu)\n" , table_len, + sb->s_blocksize -sizeof (*lvd)); + goto out_bh; + } ret =udf_sb_alloc_partition_maps (sb,le32_to_cpu (lvd->numPartitionMaps));if (ret) goto out_bh;for (i =0 , offset =0 ; - i < sbi->s_partitions && offset <le32_to_cpu (lvd->mapTableLength); + i < sbi->s_partitions && offset < table_len; i++, offset += gpm->partitionMapLength) {struct udf_part_map *map = &sbi->s_partmaps[i]; gpm = (struct genericPartitionMap *)
PATCH 27/48 udf: Fortify loading of sparing table
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 1df2ae31c724e57be9d7ac00d78db8a5dabdd050 upstream.
Add sanity checks when loading sparing table from disk to avoid accessing unallocated memory or writing to it.
--- fs/udf/super.c | 86 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 33 deletions(-)
fs/udf/super.c +53 -33
@@ -56,6 +56,7 @@#include <linux/seq_file.h> #include <linux/bitmap.h> #include <linux/crc-itu-t.h> +#include <linux/log2.h> #include <asm/byteorder.h> #include "udf_sb.h"
@@ -1215,11 +1216,59 @@ out_bh:return ret; } +static int udf_load_sparable_map (struct super_block *sb, +struct udf_part_map *map, +struct sparablePartitionMap *spm) +{ +uint32_t loc; +uint16_t ident; +struct sparingTable *st; +struct udf_sparing_data *sdata = &map->s_type_specific.s_sparing; +int i; +struct buffer_head *bh; + + map->s_partition_type =UDF_SPARABLE_MAP15 ; + sdata->s_packet_len =le16_to_cpu (spm->packetLength); +if (!is_power_of_2 (sdata->s_packet_len)) { +udf_err (sb,"error loading logical volume descriptor: " +"Invalid packet length %u\n" , + (unsigned )sdata->s_packet_len); +return -EIO ; + } +if (spm->numSparingTables >4 ) { +udf_err (sb,"error loading logical volume descriptor: " +"Too many sparing tables (%d)\n" , + (int )spm->numSparingTables); +return -EIO ; + } + +for (i =0 ; i < spm->numSparingTables; i++) { + loc =le32_to_cpu (spm->locSparingTable[i]); + bh =udf_read_tagged (sb, loc, loc, &ident); +if (!bh) +continue ; + + st = (struct sparingTable *)bh->b_data; +if (ident !=0 || +strncmp (st->sparingIdent.ident,UDF_ID_SPARING , +strlen (UDF_ID_SPARING )) || +sizeof (*st) +le16_to_cpu (st->reallocationTableLen) > + sb->s_blocksize) { +brelse (bh); +continue ; + } + + sdata->s_spar_map[i] = bh; + } + map->s_partition_func = udf_get_pblock_spar15; +return 0 ; +} +static int udf_load_logicalvol (struct super_block *sb,sector_t block,struct kernel_lb_addr *fileset) {struct logicalVolDesc *lvd; -int i, j, offset; +int i, offset;uint8_t type;struct udf_sb_info *sbi =UDF_SB (sb);struct genericPartitionMap *gpm;
@@ -1281,38 +1330,9 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, }else if (!strncmp (upm2->partIdent.ident,UDF_ID_SPARABLE ,strlen (UDF_ID_SPARABLE ))) { -uint32_t loc; -struct sparingTable *st; -struct sparablePartitionMap *spm = - (struct sparablePartitionMap *)gpm; - - map->s_partition_type =UDF_SPARABLE_MAP15 ; - map->s_type_specific.s_sparing.s_packet_len = -le16_to_cpu (spm->packetLength); -for (j =0 ; j < spm->numSparingTables; j++) { -struct buffer_head *bh2; - - loc =le32_to_cpu ( - spm->locSparingTable[j]); - bh2 =udf_read_tagged (sb, loc, loc, - &ident); - map->s_type_specific.s_sparing. - s_spar_map[j] = bh2; - -if (bh2 ==NULL ) -continue ; - - st = (struct sparingTable *)bh2->b_data; -if (ident !=0 ||strncmp ( - st->sparingIdent.ident, -UDF_ID_SPARING , -strlen (UDF_ID_SPARING ))) { -brelse (bh2); - map->s_type_specific.s_sparing. - s_spar_map[j] =NULL ; - } - } - map->s_partition_func = udf_get_pblock_spar15; +if (udf_load_sparable_map (sb, map, + (struct sparablePartitionMap *)gpm) <0 ) + goto out_bh; }else if (!strncmp (upm2->partIdent.ident,UDF_ID_METADATA ,strlen (UDF_ID_METADATA ))) {
PATCH 28/48 ARM: fix rcu stalls on SMP platforms
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 7deabca0acfe02b8e18f59a4c95676012f49a304 upstream.
We can stall RCU processing on SMP platforms if a CPU sits in its idle loop for a long time. This happens because we don't call irq_enter() and irq_exit() around generic_smp_call_function_interrupt() and friends. Add the necessary calls, and remove the one from within ipi_timer(), so that they're all in a common place.
--- arch/arm/kernel/smp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/kernel/smp.c +8 -2
@@ -443,9 +443,7 @@ static DEFINE_PER_CPU(struct clock_event_device, percpu_clockevent);static void ipi_timer (void ) {struct clock_event_device *evt = &__get_cpu_var (percpu_clockevent); -irq_enter (); evt->event_handler (evt); -irq_exit (); }#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
@@ -548,7 +546,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs)switch (ipinr) {case IPI_TIMER : +irq_enter ();ipi_timer (); +irq_exit ();break ;case IPI_RESCHEDULE :
@@ -556,15 +556,21 @@ void handle_IPI(int ipinr, struct pt_regs *regs)break ;case IPI_CALL_FUNC : +irq_enter ();generic_smp_call_function_interrupt (); +irq_exit ();break ;case IPI_CALL_FUNC_SINGLE : +irq_enter ();generic_smp_call_function_single_interrupt (); +irq_exit ();break ;case IPI_CPU_STOP : +irq_enter ();ipi_cpu_stop (cpu); +irq_exit ();break ;default :
PATCH 29/48 net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc ]
We need to validate the number of pages consumed by data_len, otherwise frags array could be overflowed by userspace. So this patch validate data_len and return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.
--- net/core/sock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/sock.c +5 -2
@@ -1497,6 +1497,11 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,gfp_t gfp_mask;long timeo;int err; +int npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; + + err = -EMSGSIZE ; +if (npages >MAX_SKB_FRAGS ) + goto failure; gfp_mask = sk->sk_allocation;if (gfp_mask & __GFP_WAIT)
@@ -1515,14 +1520,12 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,if (atomic_read (&sk->sk_wmem_alloc) < sk->sk_sndbuf) { skb =alloc_skb (header_len, gfp_mask);if (skb) { -int npages;int i;/* No pages, we're done... */ if (!data_len)break ; - npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; skb->truesize += data_len;skb_shinfo (skb)->nr_frags = npages;for (i =0 ; i < npages; i++) {
PATCH 30/48 cipso: handle CIPSO options correctly when NetLabel is disabled
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
[ Upstream commit 20e2a86485967c385d7c7befc1646e4d1d39362e ]
When NetLabel is not enabled, e.g. CONFIG_NETLABEL=n, and the system receives a CIPSO tagged packet it is dropped (cipso_v4_validate() returns non-zero). In most cases this is the correct and desired behavior, however, in the case where we are simply forwarding the traffic, e.g. acting as a network bridge, this becomes a problem.
This patch fixes the forwarding problem by providing the basic CIPSO validation code directly in ip_options_compile() without the need for the NetLabel or CIPSO code. The new validation code can not perform any of the CIPSO option label/value verification that cipso_v4_validate() does, but it can verify the basic CIPSO option format.
The behavior when NetLabel is enabled is unchanged.
--- include/net/cipso_ipv4.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
include/net/cipso_ipv4.h +28 -1
@@ -42,6 +42,7 @@#include <net/netlabel.h> #include <net/request_sock.h> #include <linux/atomic.h> +#include <asm/unaligned.h> /* known doi values */ #define CIPSO_V4_DOI_UNKNOWN 0x00000000
@@ -285,7 +286,33 @@ static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,static inline int cipso_v4_validate (const struct sk_buff *skb,unsigned char **option) { -return -ENOSYS ; +unsigned char *opt = *option; +unsigned char err_offset =0 ; +u8 opt_len = opt[1 ]; +u8 opt_iter; + +if (opt_len <8 ) { + err_offset =1 ; + goto out; + } + +if (get_unaligned_be32 (&opt[2 ]) ==0 ) { + err_offset =2 ; + goto out; + } + +for (opt_iter =6 ; opt_iter < opt_len;) { +if (opt[opt_iter +1 ] > (opt_len - opt_iter)) { + err_offset = opt_iter +1 ; + goto out; + } + opt_iter += opt[opt_iter +1 ]; + } + +out: + *option = opt + err_offset; +return err_offset; + }#endif /* CONFIG_NETLABEL */
PATCH 31/48 net: l2tp_eth: fix kernel panic on rmmod l2tp_eth
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a06998b88b1651c5f71c0e35f528bf2057188ead ]
We must prevent module unloading if some devices are still attached to l2tp_eth driver.
--- net/l2tp/l2tp_eth.c | 2 ++ 1 file changed, 2 insertions(+)
net/l2tp/l2tp_eth.c +2 -0
@@ -167,6 +167,7 @@ static void l2tp_eth_delete(struct l2tp_session *session)if (dev) {unregister_netdev (dev); spriv->dev =NULL ; +module_put (THIS_MODULE ); } } }
@@ -254,6 +255,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 pif (rc <0 ) goto out_del_dev; +__module_get (THIS_MODULE );/* Must be done after register_netdev() */ strlcpy (session->ifname, dev->name,IFNAMSIZ );
PATCH 32/48 l2tp: fix a race in l2tp_ip_sendmsg()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4399a4df98a63e30fd16e9d0cecc46ea92269e8f ]
Commit 081b1b1bb27f (l2tp: fix l2tp_ip_sendmsg() route handling) added a race, in case IP route cache is disabled.
In this case, we should not do the dst_release(&rt->dst), since it'll free the dst immediately, instead of waiting a RCU grace period.
--- net/l2tp/l2tp_ip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/l2tp/l2tp_ip.c +6 -3
@@ -515,10 +515,12 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m sk->sk_bound_dev_if);if (IS_ERR (rt)) goto no_route; -if (connected) +if (connected) {sk_setup_caps (sk, &rt->dst); -else -dst_release (&rt->dst);/* safe since we hold rcu_read_lock */ + }else { +skb_dst_set (skb, &rt->dst); + goto xmit; + } }/* We dont need to clone dst here, it is guaranteed to not disappear.
@@ -526,6 +528,7 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m*/ skb_dst_set_noref (skb, &rt->dst); +xmit:/* Queue the packet to IP for output */ rc =ip_queue_xmit (skb, &inet->cork.fl);rcu_read_unlock ();
PATCH 33/48 sky2: fix checksum bit management on some chips
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
[ Upstream commit 5ff0feac88ced864f44adb145142269196fa79d9 ]
The newer flavors of Yukon II use a different method for receive checksum offload. This is indicated in the driver by the SKY2_HW_NEW_LE flag. On these newer chips, the BMU_ENA_RX_CHKSUM should not be set.
The driver would get incorrectly toggle the bit, enabling the old checksum logic on these chips and cause a BUG_ON() assertion. If receive checksum was toggled via ethtool.
--- drivers/net/ethernet/marvell/sky2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/sky2.c +6 -4
@@ -4361,10 +4361,12 @@ static int sky2_set_features(struct net_device *dev, u32 features)struct sky2_port *sky2 =netdev_priv (dev);u32 changed = dev->features ^ features; -if (changed &NETIF_F_RXCSUM ) { -u32 on = features &NETIF_F_RXCSUM ; -sky2_write32 (sky2->hw,Q_ADDR (rxqaddr[sky2->port],Q_CSR ), - on ?BMU_ENA_RX_CHKSUM :BMU_DIS_RX_CHKSUM ); +if ((changed &NETIF_F_RXCSUM ) && + !(sky2->hw->flags &SKY2_HW_NEW_LE )) { +sky2_write32 (sky2->hw, +Q_ADDR (rxqaddr[sky2->port],Q_CSR ), + (features &NETIF_F_RXCSUM ) + ?BMU_ENA_RX_CHKSUM :BMU_DIS_RX_CHKSUM ); }if (changed &NETIF_F_RXHASH )
PATCH 34/48 be2net: fix a race in be_xmit()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit cd8f76c0a0c6fce0b2cf23c9bd0123f91453f46d ]
As soon as hardware is notified of a transmit, we no longer can assume skb can be dereferenced, as TX completion might have freed the packet.
--- drivers/net/ethernet/emulex/benet/be_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/emulex/benet/be_main.c +3 -2
@@ -696,6 +696,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, copied =make_tx_wrbs (adapter, txq, skb, wrb_cnt, dummy_wrb);if (copied) { +int gso_segs =skb_shinfo (skb)->gso_segs; +/* record the sent skb in the sent_skb table */ BUG_ON (txo->sent_skb_list[start]); txo->sent_skb_list[start] = skb;
@@ -713,8 +715,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb,be_txq_notify (adapter, txq->id, wrb_cnt); -be_tx_stats_update (txo, wrb_cnt, copied, -skb_shinfo (skb)->gso_segs, stopped); +be_tx_stats_update (txo, wrb_cnt, copied, gso_segs, stopped); }else { txq->head = start;dev_kfree_skb_any (skb);
PATCH 35/48 dummy: fix rcu_sched self-detected stalls
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 16b0dc29c1af9df341428f4c49ada4f626258082 ]
Trying to "modprobe dummy numdummies=30000" triggers :
INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)After this splat, RTNL is locked and reboot is needed.
We must call cond_resched() to avoid this, even holding RTNL.
--- drivers/net/dummy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/dummy.c +3 -1
@@ -186,8 +186,10 @@ static int __init dummy_init_module(void)rtnl_lock (); err =__rtnl_link_register (&dummy_link_ops); -for (i =0 ; i < numdummies && !err; i++) +for (i =0 ; i < numdummies && !err; i++) { err =dummy_init_one (); +cond_resched (); + }if (err <0 )__rtnl_link_unregister (&dummy_link_ops);rtnl_unlock ();
PATCH 36/48 bonding: Fix corrupted queue_mapping
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5ee31c6898ea5537fcea160999d60dc63bc0c305 ]
In the transmit path of the bonding driver, skb->cb is used to stash the skb->queue_mapping so that the bonding device can set its own queue mapping. This value becomes corrupted since the skb->cb is also used in __dev_xmit_skb.
When transmitting through bonding driver, bond_select_queue is called from dev_queue_xmit. In bond_select_queue the original skb->queue_mapping is copied into skb->cb (via bond_queue_mapping) and skb->queue_mapping is overwritten with the bond driver queue.
Subsequently in dev_queue_xmit, __dev_xmit_skb is called which writes the packet length into skb->cb, thereby overwriting the stashed queue mappping. In bond_dev_queue_xmit (called from hard_start_xmit), the queue mapping for the skb is set to the stashed value which is now the skb length and hence is an invalid queue for the slave device.
If we want to save skb->queue_mapping into skb->cb[], best place is to add a field in struct qdisc_skb_cb, to make sure it wont conflict with other layers (eg : Qdiscc, Infiniband...)
This patchs also makes sure (struct qdisc_skb_cb)->data is aligned on 8 bytes :
netem qdisc for example assumes it can store an u64 in it, without misalignment penalty.
Note : we only have 20 bytes left in (struct qdisc_skb_cb)->data[]. The largest user is CHOKe and it fills it.
Based on a previous patch from Tom Herbert.
--- drivers/net/bonding/bond_main.c | 9 +++++---- include/net/sch_generic.h | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/bonding/bond_main.c +5 -4
@@ -77,6 +77,7 @@#include <net/route.h> #include <net/net_namespace.h> #include <net/netns/generic.h> +#include <net/pkt_sched.h> #include "bonding.h" #include "bond_3ad.h" #include "bond_alb.h"
@@ -382,8 +383,6 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)return next; } -#define bond_queue_mapping (skb) (*(u16 *)((skb)->cb)) -/** * bond_dev_queue_xmit - Prepare skb for xmit. *
@@ -396,7 +395,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, { skb->dev = slave_dev; - skb->queue_mapping =bond_queue_mapping (skb); +BUILD_BUG_ON (sizeof (skb->queue_mapping) != +sizeof (qdisc_skb_cb (skb)->bond_queue_mapping)); + skb->queue_mapping =qdisc_skb_cb (skb)->bond_queue_mapping;if (unlikely (netpoll_tx_running (slave_dev)))bond_netpoll_send_skb (bond_get_slave_by_dev (bond, slave_dev), skb);
@@ -4151,7 +4152,7 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)/* * Save the original txq to restore before passing to the driver */ -bond_queue_mapping (skb) = skb->queue_mapping; +qdisc_skb_cb (skb)->bond_queue_mapping = skb->queue_mapping;if (unlikely (txq >= dev->real_num_tx_queues)) { do {
include/net/sch_generic.h +5 -2
@@ -220,13 +220,16 @@ struct tcf_proto {struct qdisc_skb_cb {unsigned int pkt_len; -unsigned char data[24 ]; +u16 bond_queue_mapping; +u16 _pad; +unsigned char data[20 ]; };static inline void qdisc_cb_private_validate (const struct sk_buff *skb,int sz) {struct qdisc_skb_cb *qcb; -BUILD_BUG_ON (sizeof (skb->cb) <sizeof (unsigned int ) + sz); + +BUILD_BUG_ON (sizeof (skb->cb) < offsetof(struct qdisc_skb_cb , data) + sz);BUILD_BUG_ON (sizeof (qcb->data) < sz); }
PATCH 37/48 ethtool: allow ETHTOOL_GSSET_INFO for users
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
[ Upstream commit f80400a26a2e8bff541de12834a1134358bb6642 ]
Allow ETHTOOL_GSSET_INFO ethtool ioctl() for unprivileged users. ETHTOOL_GSTRINGS is already allowed, but is unusable without this one.
--- net/core/ethtool.c | 1 + 1 file changed, 1 insertion(+)
net/core/ethtool.c +1 -0
@@ -1672,6 +1672,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)case ETHTOOL_GRXCSUM :case ETHTOOL_GTXCSUM :case ETHTOOL_GSG : +case ETHTOOL_GSSET_INFO :case ETHTOOL_GSTRINGS :case ETHTOOL_GTSO :case ETHTOOL_GPERMADDR :
PATCH 38/48 netpoll: fix netpoll_send_udp() bugs
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 954fba0274058d27c7c07b5ea07c41b3b7477894 ]
Bogdan Hamciuc diagnosed and fixed following bug in netpoll_send_udp() :
"skb->len += len;" instead of "skb_put(skb, len);"
Meaning that _if_ a network driver needs to call skb_realloc_headroom(), only packet headers would be copied, leaving garbage in the payload.
However the skb_realloc_headroom() must be avoided as much as possible since it requires memory and netpoll tries hard to work even if memory is exhausted (using a pool of preallocated skbs)
It appears netpoll_send_udp() reserved 16 bytes for the ethernet header, which happens to work for typicall drivers but not all.
Right thing is to use LL_RESERVED_SPACE(dev)
(And also add dev->needed_tailroom of tailroom)
This patch combines both fixes.
Many thanks to Bogdan for raising this issue.
--- net/core/netpoll.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/core/netpoll.c +6 -5
@@ -351,22 +351,23 @@ EXPORT_SYMBOL(netpoll_send_skb_on_dev);void netpoll_send_udp (struct netpoll *np,const char *msg,int len) { -int total_len, eth_len, ip_len, udp_len; +int total_len, ip_len, udp_len;struct sk_buff *skb;struct udphdr *udph;struct iphdr *iph;struct ethhdr *eth; udp_len = len +sizeof (*udph); - ip_len = eth_len = udp_len +sizeof (*iph); - total_len = eth_len +ETH_HLEN +NET_IP_ALIGN ; + ip_len = udp_len +sizeof (*iph); + total_len = ip_len +LL_RESERVED_SPACE (np->dev); - skb =find_skb (np, total_len, total_len - len); + skb =find_skb (np, total_len + np->dev->needed_tailroom, + total_len - len);if (!skb)return ;skb_copy_to_linear_data (skb, msg, len); - skb->len += len; +skb_put (skb, len);skb_push (skb,sizeof (*udph));skb_reset_transport_header (skb);
PATCH 39/48 ipv6: Move ipv6 proc file registration to end of init order
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Graf <[email protected]>
[ Upstream commit d189634ecab947c10f6f832258b103d0bbfe73cc ]
/proc/net/ipv6_route reflects the contents of fib_table_hash. The proc handler is installed in ip6_route_net_init() whereas fib_table_hash is allocated in fib6_net_init() _after_ the proc handler has been installed.
This opens up a short time frame to access fib_table_hash with its pants down.
Move the registration of the proc files to a later point in the init order to avoid the race.
Tested :-)
--- net/ipv6/route.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-)
net/ipv6/route.c +31 -10
@@ -2881,10 +2881,6 @@ static int __net_init ip6_route_net_init(struct net *net) net->ipv6.sysctl.ip6_rt_mtu_expires =10 *60 *HZ ; net->ipv6.sysctl.ip6_rt_min_advmss =IPV6_MIN_MTU -20 -40 ; -#ifdef CONFIG_PROC_FS -proc_net_fops_create (net,"ipv6_route" ,0 , &ipv6_route_proc_fops); -proc_net_fops_create (net,"rt6_stats" ,S_IRUGO , &rt6_stats_seq_fops); -#endif net->ipv6.ip6_rt_gc_expire =30 *HZ ; ret =0 ;
@@ -2905,10 +2901,6 @@ out_ip6_dst_ops: static void __net_exit ip6_route_net_exit(struct net *net) { -#ifdef CONFIG_PROC_FS -proc_net_remove (net,"ipv6_route" ); -proc_net_remove (net,"rt6_stats" ); -#endif kfree (net->ipv6.ip6_null_entry);#ifdef CONFIG_IPV6_MULTIPLE_TABLES kfree (net->ipv6.ip6_prohibit_entry);
@@ -2917,11 +2909,33 @@ static void __net_exit ip6_route_net_exit(struct net *net)dst_entries_destroy (&net->ipv6.ip6_dst_ops); } +static int __net_init ip6_route_net_init_late (struct net *net) +{ +#ifdef CONFIG_PROC_FS +proc_net_fops_create (net,"ipv6_route" ,0 , &ipv6_route_proc_fops); +proc_net_fops_create (net,"rt6_stats" ,S_IRUGO , &rt6_stats_seq_fops); +#endif +return 0 ; +} + +static void __net_exit ip6_route_net_exit_late(struct net *net) +{ +#ifdef CONFIG_PROC_FS +proc_net_remove (net,"ipv6_route" ); +proc_net_remove (net,"rt6_stats" ); +#endif +} +static struct pernet_operations ip6_route_net_ops = { .init = ip6_route_net_init, .exit = ip6_route_net_exit, }; +static struct pernet_operations ip6_route_net_late_ops = { + .init = ip6_route_net_init_late, + .exit = ip6_route_net_exit_late, +}; +static struct notifier_block ip6_route_dev_notifier = { .notifier_call = ip6_route_dev_notify, .priority =0 ,
@@ -2971,19 +2985,25 @@ int __init ip6_route_init(void)if (ret) goto xfrm6_init; + ret =register_pernet_subsys (&ip6_route_net_late_ops); +if (ret) + goto fib6_rules_init; + ret = -ENOBUFS ;if (__rtnl_register (PF_INET6 ,RTM_NEWROUTE , inet6_rtm_newroute,NULL ,NULL ) ||__rtnl_register (PF_INET6 ,RTM_DELROUTE , inet6_rtm_delroute,NULL ,NULL ) ||__rtnl_register (PF_INET6 ,RTM_GETROUTE , inet6_rtm_getroute,NULL ,NULL )) - goto fib6_rules_init; + goto out_register_late_subsys; ret =register_netdevice_notifier (&ip6_route_dev_notifier);if (ret) - goto fib6_rules_init; + goto out_register_late_subsys; out:return ret; +out_register_late_subsys: +unregister_pernet_subsys (&ip6_route_net_late_ops); fib6_rules_init:fib6_rules_cleanup (); xfrm6_init:
@@ -3002,6 +3022,7 @@ out_kmem_cache:void ip6_route_cleanup (void ) {unregister_netdevice_notifier (&ip6_route_dev_notifier); +unregister_pernet_subsys (&ip6_route_net_late_ops);fib6_rules_cleanup ();xfrm6_fini ();fib6_gc_cleanup ();
PATCH 40/48 bridge: Assign rtnl_link_ops to bridge devices created via ioctl (v2)
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
[ Upstream commit 149ddd83a92b02c658d6c61f3276eb6500d585e8 ]
This ensures that bridges created with brctl(8) or ioctl(2) directly also carry IFLA_LINKINFO when dumped over netlink. This also allows to create a bridge with ioctl(2) and delete it with RTM_DELLINK.
--- net/bridge/br_if.c | 1 + net/bridge/br_netlink.c | 2 +- net/bridge/br_private.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
net/bridge/br_if.c +1 -0
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const char *name)return -ENOMEM ;dev_net_set (dev, net); + dev->rtnl_link_ops = &br_link_ops; res =register_netdev (dev);if (res)
net/bridge/br_netlink.c +1 -1
@@ -211,7 +211,7 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])return 0 ; } -static struct rtnl_link_ops br_link_ops__read_mostly = { +struct rtnl_link_ops br_link_ops__read_mostly = { .kind ="bridge" , .priv_size =sizeof (struct net_bridge ), .setup = br_dev_setup,
net/bridge/br_private.h +1 -0
@@ -536,6 +536,7 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)#endif /* br_netlink.c */ +extern struct rtnl_link_ops br_link_ops;extern int br_netlink_init (void );extern void br_netlink_fini (void );extern void br_ifinfo_notify (int event,struct net_bridge_port *port);
PATCH 41/48 Btrfs: run delayed directory updates during log replay
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit b6305567e7d31b0bec1b8cb9ec0cadd7f7086f5f upstream.
While we are resolving directory modifications in the tree log, we are triggering delayed metadata updates to the filesystem btrees.
This commit forces the delayed updates to run so the replay code can find any modifications done. It stops us from crashing because the directory deleltion replay expects items to be removed immediately from the tree.
--- fs/btrfs/tree-log.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/tree-log.c +6 -0
@@ -690,6 +690,8 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,kfree (name);iput (inode); + +btrfs_run_delayed_items (trans, root);return ret; }
@@ -895,6 +897,7 @@ again: ret =btrfs_unlink_inode (trans, root, dir, inode, victim_name, victim_name_len); +btrfs_run_delayed_items (trans, root); }kfree (victim_name); ptr = (unsigned long )(victim_ref +1 ) + victim_name_len;
@@ -1475,6 +1478,9 @@ again: ret =btrfs_unlink_inode (trans, root, dir, inode, name, name_len);BUG_ON (ret); + +btrfs_run_delayed_items (trans, root); +kfree (name);iput (inode);
PATCH 42/48 cifs: when server doesnt set CAP_LARGE_READ_X, cap default rsize at MaxBufferSize
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit ec01d738a1691dfc85b96b9f796020267a7be577 upstream.
When the server doesn't advertise CAP_LARGE_READ_X, then MS-CIFS states that you must cap the size of the read at the client's MaxBufferSize. Unfortunately, testing with many older servers shows that they often can't service a read larger than their own MaxBufferSize.
Since we can't assume what the server will do in this situation, we must be conservative here for the default. When the server can't do large reads, then assume that it can't satisfy any read larger than its MaxBufferSize either.
Luckily almost all modern servers can do large reads, so this won't affect them. This is really just for older win9x and OS/2 era servers. Also, note that this patch just governs the default rsize. The admin can always override this if he so chooses.
--- fs/cifs/connect.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
fs/cifs/connect.c +3 -6
@@ -3495,18 +3495,15 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)* MS-CIFS indicates that servers are only limited by the client's * bufsize for reads, testing against win98se shows that it throws * INVALID_PARAMETER errors if you try to request too large a read. +* OS/2 just sends back short reads. * -* If the server advertises a MaxBufferSize of less than one page, -* assume that it also can't satisfy reads larger than that either. -* -* FIXME: Is there a better heuristic for this? +* If the server doesn't advertise CAP_LARGE_READ_X, then assume that +* it can't handle a read request larger than its MaxBufferSize either. */ if (tcon->unix_ext && (unix_cap &CIFS_UNIX_LARGE_READ_CAP )) defsize =CIFS_DEFAULT_IOSIZE ;else if (server->capabilities &CAP_LARGE_READ_X ) defsize =CIFS_DEFAULT_NON_POSIX_RSIZE ; -else if (server->maxBuf >=PAGE_CACHE_SIZE ) - defsize = CIFSMaxBufSize;else defsize = server->maxBuf -sizeof (READ_RSP );
PATCH 43/48 ocfs2: clear unaligned io flag when dio fails
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit 3e5d3c35a68c9a933bdbdd8685bd1a205b57e806 upstream.
The unaligned io flag is set in the kiocb when an unaligned dio is issued, it should be cleared even when the dio fails, or it may affect the following io which are using the same kiocb.
--- fs/ocfs2/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/file.c +3 -1
@@ -2422,8 +2422,10 @@ out_dio: unaligned_dio =0 ; } -if (unaligned_dio) +if (unaligned_dio) { +ocfs2_iocb_clear_unaligned_aio (iocb);atomic_dec (&OCFS2_I (inode)->ip_unaligned_aio); + } out:if (rw_level !=-1 )
PATCH 44/48 aio: make kiocb->private NUll in init_sync_kiocb()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
commit 2dfd06036ba7ae8e7be2daf5a2fff1dac42390bf upstream.
Ocfs2 uses kiocb.*private as a flag of unsigned long size. In commit a11f7e6 ocfs2: serialize unaligned aio, the unaligned io flag is involved in it to serialize the unaligned aio. As *private is not initialized in init_sync_kiocb() of do_sync_write(), this unaligned io flag may be unexpectly set in an aligned dio. And this will cause OCFS2_I(inode)->ip_unaligned_aio decreased to -1 in ocfs2_dio_end_io(), thus the following unaligned dio will hang forever at ocfs2_aiodio_wait() in ocfs2_file_aio_write().
--- include/linux/aio.h | 1 + 1 file changed, 1 insertion(+)
include/linux/aio.h +1 -0
@@ -140,6 +140,7 @@ struct kiocb { (x)->ki_dtor =NULL ; \ (x)->ki_obj.tsk = tsk; \ (x)->ki_user_data =0 ; \ + (x)->private =NULL ; \ } while (0)#define AIO_RING_MAGIC 0xa10a10a1
PATCH 45/48 mtd: cafe_nand: fix an & vs | mistake
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 48f8b641297df49021093763a3271119a84990a2 upstream.
The intent here was clearly to set result to true if the 0x40000000 flag was set. But instead there was a | vs & typo and we always set result to true.
Artem: check the spec at wiki.laptop.org/images/5/5c/88ALP01_Datasheet_July_2007.pdf and this fix looks correct.
--- drivers/mtd/nand/cafe_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/cafe_nand.c +1 -1
@@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };static int cafe_device_ready (struct mtd_info *mtd) {struct cafe_priv *cafe = mtd->priv; -int result = !!(cafe_readl (cafe,NAND_STATUS ) |0x40000000 ); +int result = !!(cafe_readl (cafe,NAND_STATUS ) &0x40000000 );uint32_t irqs =cafe_readl (cafe,NAND_IRQ );cafe_writel (cafe, irqs,NAND_IRQ );
PATCH 46/48 mm: Hold a file reference in madvise_remove
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 9ab4233dd08036fe34a89c7dc6f47a8bf2eb29eb upstream.
Otherwise the code races with munmap (causing a use-after-free of the vma) or with close (causing a use-after-free of the struct file).
The bug was introduced by commit 90ed52ebe481 ("[PATCH] holepunch: fix mmap_sem i_mutex deadlock")
[bwh: Backported to 3.2:
- Adjust context
- madvise_remove() calls vmtruncate_range(), not do_fallocate()]
--- mm/madvise.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
mm/madvise.c +13 -3
@@ -13,6 +13,7 @@#include <linux/hugetlb.h> #include <linux/sched.h> #include <linux/ksm.h> +#include <linux/file.h> /* * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -197,14 +198,16 @@ static long madvise_remove(struct vm_arestruct address_space *mapping;loff_t offset, endoff;int error; +struct file *f; *prev =NULL ;/* tell sys_madvise we drop mmap_sem */ if (vma->vm_flags & (VM_LOCKED |VM_NONLINEAR |VM_HUGETLB ))return -EINVAL ; -if (!vma->vm_file || !vma->vm_file->f_mapping - || !vma->vm_file->f_mapping->host) { + f = vma->vm_file; + +if (!f || !f->f_mapping || !f->f_mapping->host) {return -EINVAL ; }
@@ -218,9 +221,16 @@ static long madvise_remove(struct vm_are endoff = (loff_t)(end - vma->vm_start -1 ) + ((loff_t )vma->vm_pgoff <<PAGE_SHIFT ); -/* vmtruncate_range needs to take i_mutex */ +/* +* vmtruncate_range may need to take i_mutex. We need to +* explicitly grab a reference because the vma (and hence the +* vma's reference to the file) can go away as soon as we drop +* mmap_sem. +*/ +get_file (f);up_read (¤t->mm->mmap_sem); error =vmtruncate_range (mapping->host, offset, endoff); +fput (f);down_read (¤t->mm->mmap_sem);return error; }
PATCH 47/48 tcm_fc: Resolve suspicious RCU usage warnings
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rustad <[email protected]>
commit 863555be0c81558b1af277addcf68acb8f778860 upstream.
Use rcu_dereference_protected to tell rcu that the ft_lport_lock is held during ft_lport_create. This resolved "suspicious RCU usage" warnings when debugging options are turned on.
--- drivers/target/tcm_fc/tfc_sess.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/tcm_fc/tfc_sess.c +2 -1
@@ -58,7 +58,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)struct ft_tport *tport;int i; - tport =rcu_dereference (lport->prov[FC_TYPE_FCP ]); + tport =rcu_dereference_protected (lport->prov[FC_TYPE_FCP ], +lockdep_is_held (&ft_lport_lock));if (tport && tport->tpg)return tport;
PATCH 48/48 vfs: make O_PATH file descriptors usable for fchdir()
In reply to Ben Hutchings3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 332a2e1244bd08b9e3ecd378028513396a004a24 upstream.
We already use them for openat() and friends, but fchdir() also wants to be able to use O_PATH file descriptors. This should make it comparable to the O_SEARCH of Solaris. In particular, O_PATH allows you to access (not-quite-open) a directory you don't have read persmission to, only execute permission.
Noticed during development of multithread support for ksh93.
--- fs/open.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/open.c +3 -3
@@ -397,10 +397,10 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd) {struct file *file;struct inode *inode; -int error; +int error, fput_needed; error = -EBADF ; - file =fget (fd); + file =fget_raw_light (fd, &fput_needed);if (!file) goto out;
@@ -414,7 +414,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)if (!error)set_fs_pwd (current->fs, &file->f_path); out_putf: -fput (file); +fput_light (file, fput_needed); out:return error; }
Re: [ 35/48] dummy: fix rcu_sched self-detected stalls
In reply to Ben HutchingsQuoted 28 lines · Ben Hutchings
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit
16b0dc29c1af9df341428f4c49ada4f626258082]Trying to "modprobe dummy numdummies=30000" triggers :
INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)After this splat, RTNL is locked and reboot is needed.
We must call
cond_resched()to avoid this, even holding RTNL.Signed-off-by Eric Dumazet <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- drivers/net/dummy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/dummy.c +0
-0
drivers/net/dummy.c static int __init dummy_init_module(void) · line 192
Quoted 8 lines
drivers/net/dummy.c +3
-1@@ -186,8 +186,10 @@ static int __init dummy_init_module(void)rtnl_lock (); err =__rtnl_link_register (&dummy_link_ops); -for (i =0 ; i < numdummies && !err; i++) +for (i =0 ; i < numdummies && !err; i++) { err =dummy_init_one (); +cond_resched (); + }
Hi, I got the following build error with this applied to 3.2, on i386 and arm builds:
linux-stable/drivers/net/dummy.c: In function 'dummy_init_module':linux-stable/drivers/net/dummy.c:191:3: error: implicit declaration of function 'cond_resched' [-Werror=implicit-function-declaration]
This doesn't happen on mainline so far. Looking here on mainline, sched.h is implicitly included through <linux/netdevice.h> -> <net/netprio_cgroup.h> -> <linux/cgroup.h> -> <linux/sched.h>
But on 3.2 this doesn't happen, and build fails on i386 and arm. On x86_64 it works though since sched.h is pulled from netdevice.h -> ethtool.h -> compat.h if CONFIG_COMPAT is enabled.
May be the best solution is for the patch backported to 3.2, to include <linux/sched.h> also.
Quoted 10 lines
drivers/net/dummy.c +0
-1if (err <0 )__rtnl_link_unregister (&dummy_link_ops);rtnl_unlock (); --To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
[]'s Herton
Re: [ 35/48] dummy: fix rcu_sched self-detected stalls
Quoted 44 lines · Herton Ronaldo Krzesinski
Quoted 28 lines · Ben Hutchings
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit
16b0dc29c1af9df341428f4c49ada4f626258082]Trying to "modprobe dummy numdummies=30000" triggers :
INFO: rcu_sched self-detected stall on CPU { 8} (t=60000 jiffies)After this splat, RTNL is locked and reboot is needed.
We must call
cond_resched()to avoid this, even holding RTNL.Signed-off-by Eric Dumazet <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- drivers/net/dummy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/dummy.c +0
-0drivers/net/dummy.c static int __init dummy_init_module(void) · line 192
Quoted 8 lines
drivers/net/dummy.c +3
-1@@ -186,8 +186,10 @@ static int __init dummy_init_module(void)rtnl_lock (); err =__rtnl_link_register (&dummy_link_ops); -for (i =0 ; i < numdummies && !err; i++) +for (i =0 ; i < numdummies && !err; i++) { err =dummy_init_one (); +cond_resched (); + }Hi, I got the following build error with this applied to 3.2, on i386 and arm builds:
linux-stable/drivers/net/dummy.c: In function 'dummy_init_module':linux-stable/drivers/net/dummy.c:191:3: error: implicit declaration of function 'cond_resched' [-Werror=implicit-function-declaration]
Quoted 7 lines
This doesn't happen on mainline so far. Looking here on mainline,
sched.his implicitly included through <linux/netdevice.h> -> <net/netprio_cgroup.h> -> <linux/cgroup.h> -> <linux/sched.h>But on 3.2 this doesn't happen, and build fails on i386 and arm. On
x86_64it works though sincesched.his pulled fromnetdevice.h->ethtool.h->compat.hifCONFIG_COMPATis enabled.
I built on x86_64...
Quoted 2 lines
May be the best solution is for the patch backported to 3.2, to include <
linux/sched.h> also.
[...]
Not sure. Really, it ought to be directly included from this file in mainline as well rather than depending on that long chain of includes. But it's not an important bug in mainline (yet) so perhaps we can treat it as only required in stable.
Ben.
Signature · 3 lines
Ben Hutchings
The generation of random numbers is too important to be left to chance.
- Robert CoveyouDavid Miller
maintainerRe: [ 35/48] dummy: fix rcu_sched self-detected stalls
From: Ben Hutchings <[email protected]>
Date: Tue, 10 Jul 2012 00:47:06 +0100
Quoted 1 line
I built on
x86_64...
As did I :-)
Quoted 2 lines
But it's not an important bug in mainline (yet) so perhaps we can treat it as only required in stable.
I think this is the best thing to do for now.
Re: [ 35/48] dummy: fix rcu_sched self-detected stalls
Quoted 11 lines · David Miller
From: Ben Hutchings <[email protected]>
Date: Tue, 10 Jul 2012 00:47:06 +0100Quoted 1 line
I built on
x86_64...As did I :-)
Quoted 2 lines
But it's not an important bug in mainline (yet) so perhaps we can treat it as only required in stable.
I think this is the best thing to do for now.
OK, done.
Ben.
Signature · 3 lines
Ben Hutchings
The generation of random numbers is too important to be left to chance.
- Robert CoveyouRe: [ 26/48] udf: Avoid run away loop when partition table length is corrupted
In reply to Ben HutchingsQuoted 21 lines · Ben Hutchings
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit
adee11b2085bee90bd8f4f52123ffb07882d6256upstream.Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
Signed-off-by Jan Kara <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- fs/udf/super.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)fs/udf/super.c +0
-0
[...]
fs/udf/super.c static int udf_load_logicalvol(struct super_block *sb, sector_t block, · line 1237
Quoted 6 lines
fs/udf/super.c +2
-0@@ -1232,13 +1233,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,return 1 ;BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; + table_len =le32_to_cpu (lvd->mapTableLength); +if (sizeof (*lvd) + table_len > sb->s_blocksize) {
[...]
I don't think this is sufficient, unless there has been some prior validation of lvd->mapTableLength. On a 32-bit machine, the addition may overflow. The untrusted value has to be validated before doing any arithmetic on it, e.g.:
if (table_len > sb->s_blocksize - sizeof(*lv)) {Ben.
Signature · 3 lines
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert CamusJan Kara
reviewerRe: [ 26/48] udf: Avoid run away loop when partition table length is corrupted
Quoted 31 lines · Ben Hutchings
Quoted 21 lines · Ben Hutchings
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit
adee11b2085bee90bd8f4f52123ffb07882d6256upstream.Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
Signed-off-by Jan Kara <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- fs/udf/super.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)fs/udf/super.c +0
-0[...]
Quoted 6 lines
fs/udf/super.c +2
-0@@ -1232,13 +1233,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,return 1 ;BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; + table_len =le32_to_cpu (lvd->mapTableLength); +if (sizeof (*lvd) + table_len > sb->s_blocksize) {[...]
Quoted 6 lines
I don't think this is sufficient, unless there has been some prior validation of
lvd->mapTableLength. On a 32-bit machine, the addition may overflow. The untrusted value has to be validated before doing any arithmetic on it, e.g.:if (table_len > sb->s_blocksize - sizeof(*lv)) {
Yeah, thanks for spotting this! I've queued the attached patch. I don't
find this really pressing so I'll push it in the next merge window. OK?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 1 line
From
57b9655d01ef057a523e810d29c37ac09b80eeadMon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Tue, 10 Jul 2012 17:58:04 +0200
Subject: [PATCH] udf: Improve table length check to avoid possible overflow
When a partition table length is corrupted to be close to 1 << 32, the check for its length may overflow on 32-bit systems and we will think the length is valid. Later on the kernel can crash trying to read beyond end of buffer. Fix the check to avoid possible overflow.
--- fs/udf/super.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/udf/super.c +1 -1
@@ -1340,7 +1340,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; table_len =le32_to_cpu (lvd->mapTableLength); -if (sizeof (*lvd) + table_len > sb->s_blocksize) { +if (table_len > sb->s_blocksize -sizeof (*lvd)) {udf_err (sb,"error loading logical volume descriptor: " "Partition table too long (%u > %lu)\n" , table_len, sb->s_blocksize -sizeof (*lvd));
Signature · 1 line
1.7.1
Sorry for the delay; here's the full diff:
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 2 -SUBLEVEL = 22 -EXTRAVERSION = +SUBLEVEL = 23 +EXTRAVERSION = -rc1 NAME = Saber-toothed Squirrel # *DOCUMENTATION*
arch/arm/kernel/smp.c +8 -2
@@ -471,9 +471,7 @@ static DEFINE_PER_CPU(struct clock_event_device, percpu_clockevent);static void ipi_timer (void ) {struct clock_event_device *evt = &__get_cpu_var (percpu_clockevent); -irq_enter (); evt->event_handler (evt); -irq_exit (); }#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
@@ -572,7 +570,9 @@ void handle_IPI(int ipinr, struct pt_regs *regs)switch (ipinr) {case IPI_TIMER : +irq_enter ();ipi_timer (); +irq_exit ();break ;case IPI_RESCHEDULE :
@@ -580,15 +580,21 @@ void handle_IPI(int ipinr, struct pt_regs *regs)break ;case IPI_CALL_FUNC : +irq_enter ();generic_smp_call_function_interrupt (); +irq_exit ();break ;case IPI_CALL_FUNC_SINGLE : +irq_enter ();generic_smp_call_function_single_interrupt (); +irq_exit ();break ;case IPI_CPU_STOP : +irq_enter ();ipi_cpu_stop (cpu); +irq_exit ();break ;default :
arch/powerpc/kvm/book3s_hv_rmhandlers.S +1 -1
@@ -763,7 +763,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) lwz r3,VCORE_NAPPING_THREADS(r5) lwz r4,VCPU_PTID(r9) li r0,1 - sldi r0,r0,r4 + sld r0,r0,r4 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ beq 43f mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
arch/powerpc/xmon/xmon.c +1 -1
@@ -975,7 +975,7 @@ static int cpu_cmd(void)/* print cpus waiting or in xmon */ printf ("cpus stopped:" ); count =0 ; -for (cpu =0 ; cpu <NR_CPUS ; ++cpu) { +for_each_possible_cpu (cpu) {if (cpumask_test_cpu (cpu, &cpus_in_xmon)) {if (count ==0 )printf (" %x" , cpu);
drivers/block/umem.c +40 -0
@@ -513,6 +513,44 @@ static void process_page(unsigned long data) } } +struct mm_plug_cb { +struct blk_plug_cb cb; +struct cardinfo *card; +}; + +static void mm_unplug (struct blk_plug_cb *cb) +{ + struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb); + +spin_lock_irq (&mmcb->card->lock); +activate (mmcb->card); +spin_unlock_irq (&mmcb->card->lock); +kfree (mmcb); +} + +static int mm_check_plugged (struct cardinfo *card) +{ +struct blk_plug *plug = current->plug; +struct mm_plug_cb *mmcb; + +if (!plug) +return 0 ; + +list_for_each_entry (mmcb, &plug->cb_list, cb.list) { +if (mmcb->cb.callback == mm_unplug && mmcb->card == card) +return 1 ; + } +/* Not currently on the callback list */ + mmcb =kmalloc (sizeof (*mmcb),GFP_ATOMIC ); +if (!mmcb) +return 0 ; + + mmcb->card = card; + mmcb->cb.callback = mm_unplug; +list_add (&mmcb->cb.list, &plug->cb_list); +return 1 ; +} +static void mm_make_request (struct request_queue *q,struct bio *bio) {struct cardinfo *card = q->queuedata;
@@ -523,6 +561,8 @@ static void mm_make_request(struct request_queue *q, struct bio *bio) *card->biotail = bio; bio->bi_next =NULL ; card->biotail = &bio->bi_next; +if (bio->bi_rw &REQ_SYNC || !mm_check_plugged (card)) +activate (card);spin_unlock_irq (&card->lock);return ;
drivers/block/xen-blkback/common.h +2 -0
@@ -253,6 +253,7 @@ static inline void blkif_get_x86_32_req(struct blkif_request *dst, dst->u.rw.seg[i] = src->u.rw.seg[i];break ;case BLKIF_OP_DISCARD : + dst->u.discard.id = src->u.discard.id; dst->u.discard.sector_number = src->u.discard.sector_number; dst->u.discard.nr_sectors = src->u.discard.nr_sectors;break ;
@@ -282,6 +283,7 @@ static inline void blkif_get_x86_64_req(struct blkif_request *dst, dst->u.rw.seg[i] = src->u.rw.seg[i];break ;case BLKIF_OP_DISCARD : + dst->u.discard.id = src->u.discard.id; dst->u.discard.sector_number = src->u.discard.sector_number; dst->u.discard.nr_sectors = src->u.discard.nr_sectors;break ;
drivers/gpu/drm/i915/i915_dma.c +30 -7
@@ -1890,6 +1890,27 @@ ips_ping_for_i915_load(void) } } +static void i915_kick_out_firmware_fb (struct drm_i915_private *dev_priv) +{ +struct apertures_struct *ap; +struct pci_dev *pdev = dev_priv->dev->pdev; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base = dev_priv->dev->agp->base; + ap->ranges[0 ].size = + dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ; + primary = + pdev->resource[PCI_ROM_RESOURCE ].flags &IORESOURCE_ROM_SHADOW ; + +remove_conflicting_framebuffers (ap,"inteldrmfb" , primary); + +kfree (ap); +} +/** * i915_driver_load - setup chip and create an initial config * @dev: DRM device
@@ -1927,6 +1948,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto free_priv; } + dev_priv->mm.gtt =intel_gtt_get (); +if (!dev_priv->mm.gtt) { +DRM_ERROR ("Failed to initialize GTT\n" ); + ret = -ENODEV ; + goto put_bridge; + } + +i915_kick_out_firmware_fb (dev_priv); +/* overlay on gen2 is broken and can't address above 1G */ if (IS_GEN2 (dev))dma_set_coherent_mask (&dev->pdev->dev,DMA_BIT_MASK (30 ));
@@ -1950,13 +1980,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) goto put_bridge; } - dev_priv->mm.gtt =intel_gtt_get (); -if (!dev_priv->mm.gtt) { -DRM_ERROR ("Failed to initialize GTT\n" ); - ret = -ENODEV ; - goto out_rmmap; - } - agp_size = dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ; dev_priv->mm.gtt_mapping =
drivers/md/persistent-data/dm-space-map-checker.c +31 -23
137 lines not on this page · raw message
drivers/md/persistent-data/dm-space-map-disk.c +10 -1
@@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm, dm_block_t nr_blocks) {struct dm_space_map *sm =dm_sm_disk_create_real (tm, nr_blocks); -return dm_sm_checker_create_fresh (sm); +struct dm_space_map *smc; + +if (IS_ERR_OR_NULL (sm)) +return sm; + + smc =dm_sm_checker_create_fresh (sm); +if (IS_ERR (smc)) +dm_sm_destroy (sm); + +return smc; }EXPORT_SYMBOL_GPL (dm_sm_disk_create);
drivers/md/persistent-data/dm-transaction-manager.c +9 -2
@@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone);void dm_tm_destroy (struct dm_transaction_manager *tm) { +if (!tm->is_clone) +wipe_shadow_table (tm); +kfree (tm); }EXPORT_SYMBOL_GPL (dm_tm_destroy);
@@ -342,8 +345,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, } *sm =dm_sm_checker_create (inner); -if (!*sm) +if (IS_ERR (*sm)) { + r =PTR_ERR (*sm); goto bad2; + } }else { r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location,
@@ -362,8 +367,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, } *sm =dm_sm_checker_create (inner); -if (!*sm) +if (IS_ERR (*sm)) { + r =PTR_ERR (*sm); goto bad2; + } }return 0 ;
drivers/md/raid10.c +9 -3
@@ -1919,7 +1919,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10if (r10_sync_page_io (rdev, r10_bio->devs[sl].addr + sect, - s<<9 , conf->tmppage,WRITE ) + s, conf->tmppage,WRITE ) ==0 ) {/* Well, this device is dead */ printk(KERN_NOTICE
@@ -1956,7 +1956,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10switch (r10_sync_page_io (rdev, r10_bio->devs[sl].addr + sect, - s<<9 , conf->tmppage, + s, conf->tmppage,READ )) {case 0 :/* Well, this device is dead */
@@ -2119,7 +2119,7 @@ read_more: rdev = conf->mirrors[mirror].rdev; printk_ratelimited( KERN_ERR - "md/raid10:%s: %s: redirecting" + "md/raid10:%s: %s: redirecting " "sector %llu to another mirror\n", mdname(mddev), bdevname(rdev->bdev, b),
@@ -2436,6 +2436,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,/* want to reconstruct this device */ rb2 = r10_bio; sect =raid10_find_virt (conf, sector_nr, i); +if (sect >= mddev->resync_max_sectors) { +/* last stripe is not complete - don't +* try to recover this sector. +*/ +continue ; + }/* Unless we are doing a full sync, we only need * to recover the block if it is set in the bitmap */
drivers/md/raid5.c +9 -1
@@ -542,6 +542,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)* a chance*/ md_check_recovery (conf->mddev); } +/* +* Because md_wait_for_blocked_rdev +* will dec nr_pending, we must +* increment it first. +*/ +atomic_inc (&rdev->nr_pending);md_wait_for_blocked_rdev (rdev, conf->mddev); }else {/* Acknowledged bad block - skip the write */
@@ -3621,7 +3627,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) raid_bio->bi_next = (void *)rdev; align_bi->bi_bdev = rdev->bdev; align_bi->bi_flags &= ~(1 <<BIO_SEG_VALID ); - align_bi->bi_sector += rdev->data_offset;if (!bio_fits_rdev (align_bi) || is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3632,6 +3637,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)return 0 ; } +/* No reshape active, so we can trust rdev->data_offset */ + align_bi->bi_sector += rdev->data_offset; +spin_lock_irq (&conf->device_lock); wait_event_lock_irq(conf->wait_for_stripe, conf->quiesce == 0,
drivers/net/bonding/bond_main.c +5 -4
@@ -77,6 +77,7 @@#include <net/route.h> #include <net/net_namespace.h> #include <net/netns/generic.h> +#include <net/pkt_sched.h> #include "bonding.h" #include "bond_3ad.h" #include "bond_alb.h"
@@ -382,8 +383,6 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr)return next; } -#define bond_queue_mapping (skb) (*(u16 *)((skb)->cb)) -/** * bond_dev_queue_xmit - Prepare skb for xmit. *
@@ -396,7 +395,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, { skb->dev = slave_dev; - skb->queue_mapping =bond_queue_mapping (skb); +BUILD_BUG_ON (sizeof (skb->queue_mapping) != +sizeof (qdisc_skb_cb (skb)->bond_queue_mapping)); + skb->queue_mapping =qdisc_skb_cb (skb)->bond_queue_mapping;if (unlikely (netpoll_tx_running (slave_dev)))bond_netpoll_send_skb (bond_get_slave_by_dev (bond, slave_dev), skb);
@@ -4151,7 +4152,7 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)/* * Save the original txq to restore before passing to the driver */ -bond_queue_mapping (skb) = skb->queue_mapping; +qdisc_skb_cb (skb)->bond_queue_mapping = skb->queue_mapping;if (unlikely (txq >= dev->real_num_tx_queues)) { do {
drivers/net/dummy.c +3 -1
@@ -186,8 +186,10 @@ static int __init dummy_init_module(void)rtnl_lock (); err =__rtnl_link_register (&dummy_link_ops); -for (i =0 ; i < numdummies && !err; i++) +for (i =0 ; i < numdummies && !err; i++) { err =dummy_init_one (); +cond_resched (); + }if (err <0 )__rtnl_link_unregister (&dummy_link_ops);rtnl_unlock ();
drivers/net/ethernet/emulex/benet/be_main.c +3 -2
@@ -696,6 +696,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, copied =make_tx_wrbs (adapter, txq, skb, wrb_cnt, dummy_wrb);if (copied) { +int gso_segs =skb_shinfo (skb)->gso_segs; +/* record the sent skb in the sent_skb table */ BUG_ON (txo->sent_skb_list[start]); txo->sent_skb_list[start] = skb;
@@ -713,8 +715,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb,be_txq_notify (adapter, txq->id, wrb_cnt); -be_tx_stats_update (txo, wrb_cnt, copied, -skb_shinfo (skb)->gso_segs, stopped); +be_tx_stats_update (txo, wrb_cnt, copied, gso_segs, stopped); }else { txq->head = start;dev_kfree_skb_any (skb);
drivers/net/ethernet/marvell/sky2.c +6 -4
@@ -4361,10 +4361,12 @@ static int sky2_set_features(struct net_device *dev, u32 features)struct sky2_port *sky2 =netdev_priv (dev);u32 changed = dev->features ^ features; -if (changed &NETIF_F_RXCSUM ) { -u32 on = features &NETIF_F_RXCSUM ; -sky2_write32 (sky2->hw,Q_ADDR (rxqaddr[sky2->port],Q_CSR ), - on ?BMU_ENA_RX_CHKSUM :BMU_DIS_RX_CHKSUM ); +if ((changed &NETIF_F_RXCSUM ) && + !(sky2->hw->flags &SKY2_HW_NEW_LE )) { +sky2_write32 (sky2->hw, +Q_ADDR (rxqaddr[sky2->port],Q_CSR ), + (features &NETIF_F_RXCSUM ) + ?BMU_ENA_RX_CHKSUM :BMU_DIS_RX_CHKSUM ); }if (changed &NETIF_F_RXHASH )
drivers/net/wireless/ath/ath.h +1 -0
@@ -143,6 +143,7 @@ struct ath_common {u32 keymax;DECLARE_BITMAP (keymap,ATH_KEYMAX );DECLARE_BITMAP (tkip_keymap,ATH_KEYMAX ); +DECLARE_BITMAP (ccmp_keymap,ATH_KEYMAX );enum ath_crypt_caps crypt_caps;unsigned int clockrate;
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -557,7 +557,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)if (ah->config.serialize_regmode ==SER_REG_MODE_AUTO ) {if (ah->hw_version.macVersion ==AR_SREV_VERSION_5416_PCI || - ((AR_SREV_9160 (ah) ||AR_SREV_9280 (ah)) && + ((AR_SREV_9160 (ah) ||AR_SREV_9280 (ah) ||AR_SREV_9287 (ah)) && !ah->is_pciexpress)) { ah->config.serialize_regmode =SER_REG_MODE_ON ;
drivers/net/wireless/ath/ath9k/recv.c +2 -1
@@ -829,7 +829,8 @@ static bool ath9k_rx_accept(struct ath_common *common,* descriptor does contain a valid key index. This has been observed * mostly with CCMP encryption. */ -if (rx_stats->rs_keyix ==ATH9K_RXKEYIX_INVALID ) +if (rx_stats->rs_keyix ==ATH9K_RXKEYIX_INVALID || + !test_bit (rx_stats->rs_keyix, common->ccmp_keymap)) rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS ;if (!rx_stats->rs_datalen)
drivers/net/wireless/ath/key.c +4 -0
@@ -556,6 +556,9 @@ int ath_key_config(struct ath_common *common,return -EIO ;set_bit (idx, common->keymap); +if (key->cipher ==WLAN_CIPHER_SUITE_CCMP ) +set_bit (idx, common->ccmp_keymap); +if (key->cipher ==WLAN_CIPHER_SUITE_TKIP ) {set_bit (idx +64 , common->keymap);set_bit (idx, common->tkip_keymap);
@@ -582,6 +585,7 @@ void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key)return ;clear_bit (key->hw_key_idx, common->keymap); +clear_bit (key->hw_key_idx, common->ccmp_keymap);if (key->cipher !=WLAN_CIPHER_SUITE_TKIP )return ;
drivers/net/wireless/mwifiex/11n_rxreorder.c +3 -2
@@ -267,7 +267,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,else last_seq = priv->rx_seq[tid]; -if (last_seq >= new_node->start_win) +if (last_seq !=MWIFIEX_DEF_11N_RX_SEQ_NUM && + last_seq >= new_node->start_win) new_node->start_win = last_seq +1 ; new_node->win_size = win_size;
@@ -611,5 +612,5 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv)spin_unlock_irqrestore (&priv->rx_reorder_tbl_lock, flags);INIT_LIST_HEAD (&priv->rx_reorder_tbl_ptr); -memset (priv->rx_seq,0 ,sizeof (priv->rx_seq)); +mwifiex_reset_11n_rx_seq_num (priv); }
drivers/net/wireless/mwifiex/11n_rxreorder.h +7 -0
@@ -37,6 +37,13 @@#define ADDBA_RSP_STATUS_ACCEPT 0 +#define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff + +static inline void mwifiex_reset_11n_rx_seq_num (struct mwifiex_private *priv) +{ +memset (priv->rx_seq,0xff ,sizeof (priv->rx_seq)); +} + int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, u16 seqNum, u16 tid, u8 *ta,
drivers/net/wireless/mwifiex/cfg80211.c +9 -12
@@ -1177,11 +1177,11 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,void *mdev_priv;if (!priv) -return NULL ; +return ERR_PTR (-EFAULT ); adapter = priv->adapter;if (!adapter) -return NULL ; +return ERR_PTR (-EFAULT );switch (type) {case NL80211_IFTYPE_UNSPECIFIED :
@@ -1190,7 +1190,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,if (priv->bss_mode) {wiphy_err (wiphy,"cannot create multiple" " station/adhoc interfaces\n" ); -return NULL ; +return ERR_PTR (-EINVAL ); }if (type ==NL80211_IFTYPE_UNSPECIFIED )
@@ -1208,14 +1208,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,break ;default :wiphy_err (wiphy,"type not supported\n" ); -return NULL ; +return ERR_PTR (-EINVAL ); } dev =alloc_netdev_mq (sizeof (struct mwifiex_private *), name, ether_setup,1 );if (!dev) {wiphy_err (wiphy,"no memory available for netdevice\n" ); - goto error; + priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; +return ERR_PTR (-ENOMEM ); }dev_net_set (dev,wiphy_net (wiphy));
@@ -1240,7 +1241,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,/* Register network device */ if (register_netdevice (dev)) {wiphy_err (wiphy,"cannot register virtual network device\n" ); - goto error; +free_netdev (dev); + priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; +return ERR_PTR (-EFAULT ); }sema_init (&priv->async_sem,1 );
@@ -1252,12 +1255,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,mwifiex_dev_debugfs_init (priv);#endif return dev; -error: -if (dev && (dev->reg_state ==NETREG_UNREGISTERED )) -free_netdev (dev); - priv->bss_mode =NL80211_IFTYPE_UNSPECIFIED ; - -return NULL ; }EXPORT_SYMBOL_GPL (mwifiex_add_virtual_intf);
drivers/net/wireless/mwifiex/wmm.c +8 -4
@@ -406,6 +406,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) priv->add_ba_param.tx_win_size =MWIFIEX_AMPDU_DEF_TXWINSIZE ; priv->add_ba_param.rx_win_size =MWIFIEX_AMPDU_DEF_RXWINSIZE ; +mwifiex_reset_11n_rx_seq_num (priv); +atomic_set (&priv->wmm.tx_pkts_queued,0 );atomic_set (&priv->wmm.highest_queued_prio,HIGH_PRIO_TID ); }
@@ -1209,10 +1211,12 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)return 0 ; } -if (!ptr->is_11n_enabled ||mwifiex_is_ba_stream_setup (priv, ptr, tid) - || ((priv->sec_info.wpa_enabled - || priv->sec_info.wpa2_enabled) && !priv->wpa_is_gtk_set) - ) { +if (!ptr->is_11n_enabled || +mwifiex_is_ba_stream_setup (priv, ptr, tid) || + priv->wps.session_enable || + ((priv->sec_info.wpa_enabled || + priv->sec_info.wpa2_enabled) && + !priv->wpa_is_gtk_set)) {mwifiex_send_single_packet (priv, ptr, ptr_index, flags);/* ra_list_spinlock has been freed in mwifiex_send_single_packet() */
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +3 -0
@@ -311,9 +311,11 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ + {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ + {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*//* HP - Lite-On ,8188CUS Slim Combo */ {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
@@ -355,6 +357,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ + {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
fs/btrfs/tree-log.c +6 -0
@@ -692,6 +692,8 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,kfree (name);iput (inode); + +btrfs_run_delayed_items (trans, root);return ret; }
@@ -897,6 +899,7 @@ again: ret =btrfs_unlink_inode (trans, root, dir, inode, victim_name, victim_name_len); +btrfs_run_delayed_items (trans, root); }kfree (victim_name); ptr = (unsigned long )(victim_ref +1 ) + victim_name_len;
@@ -1477,6 +1480,9 @@ again: ret =btrfs_unlink_inode (trans, root, dir, inode, name, name_len);BUG_ON (ret); + +btrfs_run_delayed_items (trans, root); +kfree (name);iput (inode);
fs/cifs/connect.c +3 -6
@@ -2975,18 +2975,15 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)* MS-CIFS indicates that servers are only limited by the client's * bufsize for reads, testing against win98se shows that it throws * INVALID_PARAMETER errors if you try to request too large a read. +* OS/2 just sends back short reads. * -* If the server advertises a MaxBufferSize of less than one page, -* assume that it also can't satisfy reads larger than that either. -* -* FIXME: Is there a better heuristic for this? +* If the server doesn't advertise CAP_LARGE_READ_X, then assume that +* it can't handle a read request larger than its MaxBufferSize either. */ if (tcon->unix_ext && (unix_cap &CIFS_UNIX_LARGE_READ_CAP )) defsize =CIFS_DEFAULT_IOSIZE ;else if (server->capabilities &CAP_LARGE_READ_X ) defsize =CIFS_DEFAULT_NON_POSIX_RSIZE ; -else if (server->maxBuf >=PAGE_CACHE_SIZE ) - defsize = CIFSMaxBufSize;else defsize = server->maxBuf -sizeof (READ_RSP );
fs/ocfs2/file.c +3 -1
@@ -2422,8 +2422,10 @@ out_dio: unaligned_dio =0 ; } -if (unaligned_dio) +if (unaligned_dio) { +ocfs2_iocb_clear_unaligned_aio (iocb);atomic_dec (&OCFS2_I (inode)->ip_unaligned_aio); + } out:if (rw_level !=-1 )
fs/splice.c +20 -15
@@ -274,13 +274,16 @@ void spd_release_page(struct splice_pipe_desc *spd, unsigned int i)* Check if we need to grow the arrays holding pages and partial page * descriptions. */ -int splice_grow_spd (struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) +int splice_grow_spd (const struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +unsigned int buffers =ACCESS_ONCE (pipe->buffers); + + spd->nr_pages_max = buffers; +if (buffers <=PIPE_DEF_BUFFERS )return 0 ; - spd->pages =kmalloc (pipe->buffers *sizeof (struct page *),GFP_KERNEL ); - spd->partial =kmalloc (pipe->buffers *sizeof (struct partial_page ),GFP_KERNEL ); + spd->pages =kmalloc (buffers *sizeof (struct page *),GFP_KERNEL ); + spd->partial =kmalloc (buffers *sizeof (struct partial_page ),GFP_KERNEL );if (spd->pages && spd->partial)return 0 ;
@@ -290,10 +293,9 @@ int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)return -ENOMEM ; } -void splice_shrink_spd (struct pipe_inode_info *pipe, -struct splice_pipe_desc *spd) +void splice_shrink_spd (struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +if (spd->nr_pages_max <=PIPE_DEF_BUFFERS )return ;kfree (spd->pages);
@@ -316,6 +318,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -327,7 +330,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, index = *ppos >>PAGE_CACHE_SHIFT ; loff = *ppos & ~PAGE_CACHE_MASK ; req_pages = (len + loff +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; - nr_pages =min (req_pages, pipe->buffers); + nr_pages =min (req_pages, spd.nr_pages_max);/* * Lookup the (hopefully) full range of pages we need.
@@ -498,7 +501,7 @@ fill_it:if (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return error; }
@@ -599,6 +602,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &default_pipe_buf_ops, .spd_release = spd_release_page,
@@ -609,8 +613,8 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, res = -ENOMEM ; vec = __vec; -if (pipe->buffers >PIPE_DEF_BUFFERS ) { - vec =kmalloc (pipe->buffers *sizeof (struct iovec ),GFP_KERNEL ); +if (spd.nr_pages_max >PIPE_DEF_BUFFERS ) { + vec =kmalloc (spd.nr_pages_max *sizeof (struct iovec ),GFP_KERNEL );if (!vec) goto shrink_ret; }
@@ -618,7 +622,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, offset = *ppos & ~PAGE_CACHE_MASK ; nr_pages = (len + offset +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; -for (i =0 ; i < nr_pages && i < pipe->buffers && len; i++) { +for (i =0 ; i < nr_pages && i < spd.nr_pages_max && len; i++) {struct page *page; page =alloc_page (GFP_USER );
@@ -666,7 +670,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos, shrink_ret:if (vec != __vec)kfree (vec); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return res; err:
@@ -1616,6 +1620,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &user_page_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1631,13 +1636,13 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, spd.nr_pages =get_iovec_page_array (iov, nr_segs, spd.pages, spd.partial, flags &SPLICE_F_GIFT , - pipe->buffers); + spd.nr_pages_max);if (spd.nr_pages <=0 ) ret = spd.nr_pages;else ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; }
fs/udf/super.c +64 -38
139 lines not on this page · raw message
include/linux/splice.h +4 -4
@@ -51,7 +51,8 @@ struct partial_page {struct splice_pipe_desc {struct page **pages;/* page map */ struct partial_page *partial;/* pages[] may not be contig */ -int nr_pages;/* number of pages in map */ +int nr_pages;/* number of populated pages in map */ +unsigned int nr_pages_max;/* pages[] & partial[] arrays size */ unsigned int flags;/* splice flags */ const struct pipe_buf_operations *ops;/* ops associated with output pipe */ void (*spd_release)(struct splice_pipe_desc *,unsigned int );
@@ -85,9 +86,8 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,/* * for dynamic pipe sizing */ -extern int splice_grow_spd (struct pipe_inode_info *,struct splice_pipe_desc *); -extern void splice_shrink_spd (struct pipe_inode_info *, -struct splice_pipe_desc *); +extern int splice_grow_spd (const struct pipe_inode_info *,struct splice_pipe_desc *); +extern void splice_shrink_spd (struct splice_pipe_desc *);extern void spd_release_page (struct splice_pipe_desc *,unsigned int );extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
include/net/cipso_ipv4.h +28 -1
@@ -42,6 +42,7 @@#include <net/netlabel.h> #include <net/request_sock.h> #include <linux/atomic.h> +#include <asm/unaligned.h> /* known doi values */ #define CIPSO_V4_DOI_UNKNOWN 0x00000000
@@ -285,7 +286,33 @@ static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,static inline int cipso_v4_validate (const struct sk_buff *skb,unsigned char **option) { -return -ENOSYS ; +unsigned char *opt = *option; +unsigned char err_offset =0 ; +u8 opt_len = opt[1 ]; +u8 opt_iter; + +if (opt_len <8 ) { + err_offset =1 ; + goto out; + } + +if (get_unaligned_be32 (&opt[2 ]) ==0 ) { + err_offset =2 ; + goto out; + } + +for (opt_iter =6 ; opt_iter < opt_len;) { +if (opt[opt_iter +1 ] > (opt_len - opt_iter)) { + err_offset = opt_iter +1 ; + goto out; + } + opt_iter += opt[opt_iter +1 ]; + } + +out: + *option = opt + err_offset; +return err_offset; + }#endif /* CONFIG_NETLABEL */
include/net/sch_generic.h +5 -2
@@ -220,13 +220,16 @@ struct tcf_proto {struct qdisc_skb_cb {unsigned int pkt_len; -unsigned char data[24 ]; +u16 bond_queue_mapping; +u16 _pad; +unsigned char data[20 ]; };static inline void qdisc_cb_private_validate (const struct sk_buff *skb,int sz) {struct qdisc_skb_cb *qcb; -BUILD_BUG_ON (sizeof (skb->cb) <sizeof (unsigned int ) + sz); + +BUILD_BUG_ON (sizeof (skb->cb) < offsetof(struct qdisc_skb_cb , data) + sz);BUILD_BUG_ON (sizeof (qcb->data) < sz); }
kernel/relay.c +3 -2
@@ -1235,6 +1235,7 @@ static ssize_t subbuf_splice_actor(struct file *in,struct splice_pipe_desc spd = { .pages = pages, .nr_pages =0 , + .nr_pages_max =PIPE_DEF_BUFFERS , .partial = partial, .flags = flags, .ops = &relay_pipe_buf_ops,
@@ -1302,8 +1303,8 @@ static ssize_t subbuf_splice_actor(struct file *in, ret += padding; out: -splice_shrink_spd (pipe, &spd); -return ret; +splice_shrink_spd (&spd); +return ret; } static ssize_t relay_file_splice_read(struct file *in,
kernel/trace/trace.c +6 -2
@@ -2541,10 +2541,12 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,if (cpumask_test_cpu (cpu, tracing_cpumask) && !cpumask_test_cpu (cpu, tracing_cpumask_new)) {atomic_inc (&global_trace.data[cpu]->disabled); +ring_buffer_record_disable_cpu (global_trace.buffer, cpu); }if (!cpumask_test_cpu (cpu, tracing_cpumask) &&cpumask_test_cpu (cpu, tracing_cpumask_new)) {atomic_dec (&global_trace.data[cpu]->disabled); +ring_buffer_record_enable_cpu (global_trace.buffer, cpu); } }arch_spin_unlock (&ftrace_max_lock);
@@ -3456,6 +3458,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, .pages = pages_def, .partial = partial_def, .nr_pages = 0, /* This gets updated below. */ + .nr_pages_max = PIPE_DEF_BUFFERS, .flags = flags, .ops = &tracing_pipe_buf_ops, .spd_release = tracing_spd_release_pipe,
@@ -3527,7 +3530,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, ret =splice_to_pipe (pipe, &spd); out: -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; out_err:
@@ -4017,6 +4020,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,struct splice_pipe_desc spd = { .pages = pages_def, .partial = partial_def, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &buffer_pipe_buf_ops, .spd_release = buffer_spd_release,
@@ -4104,7 +4108,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, } ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd); out:return ret; }
mm/shmem.c +2 -1
@@ -1359,6 +1359,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1447,7 +1448,7 @@ static ssize_t shmem_file_splice_read(struct file *in, loff_t *ppos,if (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);if (error >0 ) { *ppos += error;
net/bridge/br_if.c +1 -0
@@ -240,6 +240,7 @@ int br_add_bridge(struct net *net, const char *name)return -ENOMEM ;dev_net_set (dev, net); + dev->rtnl_link_ops = &br_link_ops; res =register_netdev (dev);if (res)
net/bridge/br_netlink.c +1 -1
@@ -211,7 +211,7 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])return 0 ; } -static struct rtnl_link_ops br_link_ops__read_mostly = { +struct rtnl_link_ops br_link_ops__read_mostly = { .kind ="bridge" , .priv_size =sizeof (struct net_bridge ), .setup = br_dev_setup,
net/bridge/br_private.h +1 -0
@@ -536,6 +536,7 @@ extern int (*br_fdb_test_addr_hook)(struct net_device *dev, unsigned char *addr)#endif /* br_netlink.c */ +extern struct rtnl_link_ops br_link_ops;extern int br_netlink_init (void );extern void br_netlink_fini (void );extern void br_ifinfo_notify (int event,struct net_bridge_port *port);
net/core/ethtool.c +1 -0
@@ -1672,6 +1672,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)case ETHTOOL_GRXCSUM :case ETHTOOL_GTXCSUM :case ETHTOOL_GSG : +case ETHTOOL_GSSET_INFO :case ETHTOOL_GSTRINGS :case ETHTOOL_GTSO :case ETHTOOL_GPERMADDR :
net/core/netpoll.c +6 -5
@@ -351,22 +351,23 @@ EXPORT_SYMBOL(netpoll_send_skb_on_dev);void netpoll_send_udp (struct netpoll *np,const char *msg,int len) { -int total_len, eth_len, ip_len, udp_len; +int total_len, ip_len, udp_len;struct sk_buff *skb;struct udphdr *udph;struct iphdr *iph;struct ethhdr *eth; udp_len = len +sizeof (*udph); - ip_len = eth_len = udp_len +sizeof (*iph); - total_len = eth_len +ETH_HLEN +NET_IP_ALIGN ; + ip_len = udp_len +sizeof (*iph); + total_len = ip_len +LL_RESERVED_SPACE (np->dev); - skb =find_skb (np, total_len, total_len - len); + skb =find_skb (np, total_len + np->dev->needed_tailroom, + total_len - len);if (!skb)return ;skb_copy_to_linear_data (skb, msg, len); - skb->len += len; +skb_put (skb, len);skb_push (skb,sizeof (*udph));skb_reset_transport_header (skb);
net/core/skbuff.c +1 -0
@@ -1663,6 +1663,7 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =MAX_SKB_FRAGS , .flags = flags, .ops = &sock_pipe_buf_ops, .spd_release = sock_spd_release,
net/core/sock.c +5 -2
@@ -1497,6 +1497,11 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,gfp_t gfp_mask;long timeo;int err; +int npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; + + err = -EMSGSIZE ; +if (npages >MAX_SKB_FRAGS ) + goto failure; gfp_mask = sk->sk_allocation;if (gfp_mask & __GFP_WAIT)
@@ -1515,14 +1520,12 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,if (atomic_read (&sk->sk_wmem_alloc) < sk->sk_sndbuf) { skb =alloc_skb (header_len, gfp_mask);if (skb) { -int npages;int i;/* No pages, we're done... */ if (!data_len)break ; - npages = (data_len + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; skb->truesize += data_len;skb_shinfo (skb)->nr_frags = npages;for (i =0 ; i < npages; i++) {
net/ipv6/route.c +31 -10
87 lines not on this page · raw message
net/l2tp/l2tp_eth.c +2 -0
@@ -167,6 +167,7 @@ static void l2tp_eth_delete(struct l2tp_session *session)if (dev) {unregister_netdev (dev); spriv->dev =NULL ; +module_put (THIS_MODULE ); } } }
@@ -254,6 +255,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 pif (rc <0 ) goto out_del_dev; +__module_get (THIS_MODULE );/* Must be done after register_netdev() */ strlcpy (session->ifname, dev->name,IFNAMSIZ );
net/l2tp/l2tp_ip.c +6 -3
@@ -515,10 +515,12 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m sk->sk_bound_dev_if);if (IS_ERR (rt)) goto no_route; -if (connected) +if (connected) {sk_setup_caps (sk, &rt->dst); -else -dst_release (&rt->dst);/* safe since we hold rcu_read_lock */ + }else { +skb_dst_set (skb, &rt->dst); + goto xmit; + } }/* We dont need to clone dst here, it is guaranteed to not disappear.
@@ -526,6 +528,7 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m*/ skb_dst_set_noref (skb, &rt->dst); +xmit:/* Queue the packet to IP for output */ rc =ip_queue_xmit (skb, &inet->cork.fl);rcu_read_unlock ();
net/mac80211/rx.c +4 -1
@@ -2389,7 +2389,7 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx)* frames that we didn't handle, including returning unknown * ones. For all other modes we will return them to the sender, * setting the 0x80 bit in the action category, as required by -* 802.11-2007 7.3.1.11. +* 802.11-2012 9.24.4. * Newer versions of hostapd shall also use the management frame * registration mechanisms, but older ones still use cooked * monitor interfaces so push all frames there.
@@ -2399,6 +2399,9 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx) sdata->vif.type == NL80211_IFTYPE_AP_VLAN))return RX_DROP_MONITOR ; +if (is_multicast_ether_addr (mgmt->da)) +return RX_DROP_MONITOR ; +/* do not return rejected action frames */ if (mgmt->u.action.category &0x80 )return RX_DROP_UNUSABLE ;
net/nfc/nci/ntf.c +2 -2
@@ -86,7 +86,7 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev, nfca_poll->sens_res =__le16_to_cpu (*((__u16 *)data)); data +=2 ; - nfca_poll->nfcid1_len = *data++; + nfca_poll->nfcid1_len =min_t (__u8, *data++,sizeof (nfca_poll->nfcid1)); nfc_dbg("sens_res 0x%x, nfcid1_len %d", nfca_poll->sens_res,
@@ -111,7 +111,7 @@ static int nci_rf_activate_nfca_passive_poll(struct nci_dev *ndev,switch (ntf->rf_interface_type) {case NCI_RF_INTERFACE_ISO_DEP : - nfca_poll_iso_dep->rats_res_len = *data++; + nfca_poll_iso_dep->rats_res_len =min_t (__u8, *data++,20 );if (nfca_poll_iso_dep->rats_res_len >0 ) { memcpy(nfca_poll_iso_dep->rats_res, data,
net/nfc/rawsock.c +4 -1
@@ -52,7 +52,10 @@ static int rawsock_release(struct socket *sock) {struct sock *sk = sock->sk; -nfc_dbg ("sock=%p" , sock); +nfc_dbg ("sock=%p sk=%p" , sock, sk); + +if (!sk) +return 0 ;sock_orphan (sk);sock_put (sk);
sound/pci/hda/patch_sigmatel.c +2 -2
@@ -4457,7 +4457,7 @@ static int stac92xx_init(struct hda_codec *codec) AC_PINCTL_IN_EN);for (i =0 ; i < spec->num_pwrs; i++) {hda_nid_t nid = spec->pwr_nids[i]; -int pinctl, def_conf; +unsigned int pinctl, def_conf;/* power on when no jack detection is available */ /* or when the VREF is used for controlling LED */
@@ -4484,7 +4484,7 @@ static int stac92xx_init(struct hda_codec *codec) def_conf =get_defcfg_connect (def_conf);/* skip any ports that don't have jacks since presence * detection is useless */ -if (def_conf !=AC_JACK_PORT_NONE && +if (def_conf !=AC_JACK_PORT_COMPLEX || !is_jack_detectable (codec, nid)) {stac_toggle_power_map (codec, nid,1 );continue ;
sound/soc/codecs/tlv320aic3x.c +1 -3
@@ -963,9 +963,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, } found: - data =snd_soc_read (codec,AIC3X_PLL_PROGA_REG ); -snd_soc_write (codec,AIC3X_PLL_PROGA_REG , - data | (pll_p <<PLLP_SHIFT )); +snd_soc_update_bits (codec,AIC3X_PLL_PROGA_REG ,PLLP_MASK , pll_p);snd_soc_write (codec,AIC3X_OVRF_STATUS_AND_PLLR_REG , pll_r <<PLLR_SHIFT );snd_soc_write (codec,AIC3X_PLL_PROGB_REG , pll_j <<PLLJ_SHIFT );
sound/soc/codecs/tlv320aic3x.h +1 -0
@@ -166,6 +166,7 @@/* PLL registers bitfields */ #define PLLP_SHIFT 0 +#define PLLP_MASK 7#define PLLQ_SHIFT 3#define PLLR_SHIFT 0#define PLLJ_SHIFT 2
Signature · 3 lines
Ben Hutchings
The generation of random numbers is too important to be left to chance.
- Robert CoveyouRe: [ 26/48] udf: Avoid run away loop when partition table length is corrupted
In reply to Jan KaraQuoted 32 lines · Jan Kara
Quoted 31 lines · Ben Hutchings
Quoted 21 lines · Ben Hutchings
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit
adee11b2085bee90bd8f4f52123ffb07882d6256upstream.Check provided length of partition table so that (possibly maliciously) corrupted partition table cannot cause accessing data beyond current buffer.
Signed-off-by Jan Kara <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- fs/udf/super.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)fs/udf/super.c +0
-0[...]
Quoted 6 lines
fs/udf/super.c +2
-0@@ -1232,13 +1233,20 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,return 1 ;BUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; + table_len =le32_to_cpu (lvd->mapTableLength); +if (sizeof (*lvd) + table_len > sb->s_blocksize) {[...]
Quoted 8 lines
Quoted 6 lines
I don't think this is sufficient, unless there has been some prior validation of
lvd->mapTableLength. On a 32-bit machine, the addition may overflow. The untrusted value has to be validated before doing any arithmetic on it, e.g.:if (table_len > sb->s_blocksize - sizeof(*lv)) {Yeah, thanks for spotting this! I've queued the attached patch. I don't
find this really pressing so I'll push it in the next merge window. OK?
It's the sort of thing that I would expect to go into distribution security updates a.s.a.p. I don't see why it should wait that long (though of course the merge window isn't *that* far away).
Ben.
Signature · 3 lines
Ben Hutchings
The generation of random numbers is too important to be left to chance.
- Robert Coveyou