v2.6.34.9 longterm review
Subsystems (92)
PATCH 141/209 tcp: avoid a possible divide by zero
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ad9f4f50fe9288bbe65b7dfd76d8820afac6a24c upstream
sysctl_tcp_tso_win_divisor might be set to zero while one cpu runs in tcp_tso_should_defer(). Make sure we dont allow a divide by zero by reading sysctl_tcp_tso_win_divisor exactly once.
--- net/ipv4/tcp_output.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +4 -2
@@ -1514,6 +1514,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)struct tcp_sock *tp =tcp_sk (sk);const struct inet_connection_sock *icsk =inet_csk (sk);u32 send_win, cong_win, limit, in_flight; +int win_divisor;if (TCP_SKB_CB (skb)->flags &TCPCB_FLAG_FIN ) goto send_now;
@@ -1545,13 +1546,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)if ((skb !=tcp_write_queue_tail (sk)) && (limit >= skb->len)) goto send_now; -if (sysctl_tcp_tso_win_divisor) { + win_divisor =ACCESS_ONCE (sysctl_tcp_tso_win_divisor); +if (win_divisor) {u32 chunk =min (tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);/* If at least some fraction of a window is available, * just use it. */ - chunk /= sysctl_tcp_tso_win_divisor; + chunk /= win_divisor;if (limit >= chunk) goto send_now; }else {
Signature · 1 line
1.7.4.4
PATCH 142/209 af_unix: limit unix_tot_inflight
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 9915672d41273f5b77f1b3c29b391ffb7732b84b upstream
Vegard Nossum found a unix socket OOM was possible, posting an exploit program.
My analysis is we can eat all LOWMEM memory before unix_gc() being called from unix_release_sock(). Moreover, the thread blocked in unix_gc() can consume huge amount of time to perform cleanup because of huge working set.
One way to handle this is to have a sensible limit on unix_tot_inflight, tested from wait_for_unix_gc() and to force a call to unix_gc() if this limit is hit.
This solves the OOM and also reduce overall latencies, and should not slowdown normal workloads.
--- net/unix/garbage.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
net/unix/garbage.c +7 -0
@@ -268,9 +268,16 @@ static void inc_inflight_move_tail(struct unix_sock *u) }static bool gc_in_progress = false; +#define UNIX_INFLIGHT_TRIGGER_GC 16000void wait_for_unix_gc (void ) { +/* +* If number of inflight sockets is insane, +* force a garbage collect right now. +*/ +if (unix_tot_inflight >UNIX_INFLIGHT_TRIGGER_GC && !gc_in_progress) +unix_gc ();wait_event (unix_gc_wait, gc_in_progress == false); }
Signature · 1 line
1.7.4.4
PATCH 143/209 af_unix: limit recursion level
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 25888e30319f8896fc656fc68643e6a078263060 upstream
Its easy to eat all kernel memory and trigger NMI watchdog, using an exploit program that queues unix sockets on top of others.
lkml ref : http://lkml.org/lkml/2010/11/25/8
This mechanism is used in applications, one choice we have is to have a recursion limit.
Other limits might be needed as well (if we queue other types of files), since the passfd mechanism is currently limited by socket receive queue sizes only.
Add a recursion_level to unix socket, allowing up to 4 levels.
Each time we send an unix socket through sendfd mechanism, we copy its recursion level (plus one) to receiver. This recursion level is cleared when socket receive queue is emptied.
[PG: slight modifications required due to absense of 7361c36c5 in 34]
--- include/net/af_unix.h | 2 ++ net/unix/af_unix.c | 37 ++++++++++++++++++++++++++++++++----- net/unix/garbage.c | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-)
include/net/af_unix.h +2 -0
@@ -10,6 +10,7 @@ extern void unix_inflight(struct file *fp);extern void unix_notinflight (struct file *fp);extern void unix_gc (void );extern void wait_for_unix_gc (void ); +extern struct sock *unix_get_socket (struct file *filp);#define UNIX_HASH_SIZE 256
@@ -56,6 +57,7 @@ struct unix_sock {spinlock_t lock; unsigned int gc_candidate : 1; unsigned int gc_maybe_cycle : 1; +unsigned char recursion_level;wait_queue_head_t peer_wait; };#define unix_sk (__sk) ((struct unix_sock *)__sk)
net/unix/af_unix.c +32 -5
@@ -1324,9 +1324,25 @@ static void unix_destruct_fds(struct sk_buff *skb)sock_wfree (skb); } +#define MAX_RECURSION_LEVEL 4 +static int unix_attach_fds (struct scm_cookie *scm,struct sk_buff *skb) {int i; +unsigned char max_level =0 ; +int unix_sock_count =0 ; + +for (i = scm->fp->count -1 ; i >=0 ; i--) { +struct sock *sk =unix_get_socket (scm->fp->fp[i]); + +if (sk) { + unix_sock_count++; + max_level =max (max_level, +unix_sk (sk)->recursion_level); + } + } +if (unlikely (max_level >MAX_RECURSION_LEVEL )) +return -ETOOMANYREFS ;/* * Need to duplicate file references for the sake of garbage
@@ -1337,10 +1353,12 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)if (!UNIXCB (skb).fp)return -ENOMEM ; -for (i = scm->fp->count-1 ; i >=0 ; i--) -unix_inflight (scm->fp->fp[i]); +if (unix_sock_count) { +for (i = scm->fp->count-1 ; i >=0 ; i--) +unix_inflight (scm->fp->fp[i]); + } skb->destructor = unix_destruct_fds; -return 0 ; +return max_level; }/*
@@ -1362,6 +1380,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,struct sk_buff *skb;long timeo;struct scm_cookie tmp_scm; +int max_level =0 ;if (NULL == siocb->scm) siocb->scm = &tmp_scm;
@@ -1402,8 +1421,9 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,memcpy (UNIXCREDS (skb), &siocb->scm->creds,sizeof (struct ucred ));if (siocb->scm->fp) { err =unix_attach_fds (siocb->scm, skb); -if (err) +if (err <0 ) goto out_free; + max_level = err +1 ; }unix_get_secdata (siocb->scm, skb);
@@ -1484,6 +1504,8 @@ restart: }skb_queue_tail (&other->sk_receive_queue, skb); +if (max_level >unix_sk (other)->recursion_level) +unix_sk (other)->recursion_level = max_level;unix_state_unlock (other); other->sk_data_ready (other, len);sock_put (other);
@@ -1514,6 +1536,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,int sent =0 ;struct scm_cookie tmp_scm;bool fds_sent = false; +int max_level =0 ;if (NULL == siocb->scm) siocb->scm = &tmp_scm;
@@ -1578,10 +1601,11 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,/* Only send the fds in the first buffer */ if (siocb->scm->fp && !fds_sent) { err =unix_attach_fds (siocb->scm, skb); -if (err) { +if (err <0 ) {kfree_skb (skb); goto out_err; } + max_level = err +1 ; fds_sent = true; }
@@ -1598,6 +1622,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, goto pipe_err_free;skb_queue_tail (&other->sk_receive_queue, skb); +if (max_level >unix_sk (other)->recursion_level) +unix_sk (other)->recursion_level = max_level;unix_state_unlock (other); other->sk_data_ready (other, size); sent += size;
@@ -1814,6 +1840,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,unix_state_lock (sk); skb =skb_dequeue (&sk->sk_receive_queue);if (skb ==NULL ) { +unix_sk (sk)->recursion_level =0 ;if (copied >= target) goto unlock;
net/unix/garbage.c +1 -1
@@ -96,7 +96,7 @@ static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);unsigned int unix_tot_inflight; -static struct sock *unix_get_socket (struct file *filp) +struct sock *unix_get_socket (struct file *filp) {struct sock *u_sock =NULL ;struct inode *inode = filp->f_path.dentry->d_inode;
Signature · 1 line
1.7.4.4
PATCH 144/209 net: packet: fix information leak to userland
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 67286640f638f5ad41a946b9a3dc75327950248f upstream
packet_getname_spkt() doesn't initialize all members of sa_data field of sockaddr struct if strlen(dev->name) < 13. This structure is then copied to userland. It leads to leaking of contents of kernel stack memory. We have to fully fill sa_data with strncpy() instead of strlcpy().
The same with packet_getname(): it doesn't initialize sll_pkttype field of sockaddr_ll. Set it to zero.
--- net/packet/af_packet.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
net/packet/af_packet.c +2 -1
@@ -1645,7 +1645,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk),pkt_sk (sk)->ifindex);if (dev) -strlcpy (uaddr->sa_data, dev->name,15 ); +strncpy (uaddr->sa_data, dev->name,14 );else memset (uaddr->sa_data,0 ,14 );rcu_read_unlock ();
@@ -1668,6 +1668,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, sll->sll_family =AF_PACKET ; sll->sll_ifindex = po->ifindex; sll->sll_protocol = po->num; + sll->sll_pkttype =0 ;rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk), po->ifindex);if (dev) {
Signature · 1 line
1.7.4.4
PATCH 145/209 driver/net/benet: fix be_cmd_multicast_set() memcpy bug
In reply to Paul GortmakerFrom: Joe Jin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 408cc293c29ada769ae772420a39961320da1854 upstream
Regarding benet be_cmd_multicast_set() function, now using netdev_for_each_mc_addr() helper for mac address copy, but when copying to req->mac[] did not increase of the index.
--- drivers/net/benet/be_cmds.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/benet/be_cmds.c +1 -1
@@ -1163,7 +1163,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, i =0 ;netdev_for_each_mc_addr (mc, netdev) -memcpy (req->mac[i].byte, mc->dmi_addr,ETH_ALEN ); +memcpy (req->mac[i++].byte, mc->dmi_addr,ETH_ALEN ); }else { req->promiscuous =1 ; }
Signature · 1 line
1.7.4.4
PATCH 146/209 bonding: Fix slave selection bug.
In reply to Paul GortmakerFrom: Hillf Danton <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit af3e5bd5f650163c2e12297f572910a1af1b8236 upstream
The returned slave is incorrect, if the net device under check is not charged yet by the master.
--- drivers/net/bonding/bonding.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/bonding.h +2 -2
@@ -235,11 +235,11 @@ static inline struct slave *bond_get_slave_by_dev(struct bonding *bond, struct nbond_for_each_slave (bond, slave, i) {if (slave->dev == slave_dev) { -break ; +return slave; } } -return slave; +return 0 ; }static inline struct bonding *bond_get_bond_by_slave (struct slave *slave)
Signature · 1 line
1.7.4.4
PATCH 147/209 filter: fix sk_filter rcu handling
In reply to Paul GortmakerFrom: Eric Dumazet <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 46bcf14f44d8f31ecfdc8b6708ec15a3b33316d9 upstream
Pavel Emelyanov tried to fix a race between sk_filter_(de|at)tach and sk_clone() in commit 47e958eac280c263397
Problem is we can have several clones sharing a common sk_filter, and these clones might want to sk_filter_attach() their own filters at the same time, and can overwrite old_filter->rcu, corrupting RCU queues.
We can not use filter->rcu without being sure no other thread could do the same thing.
Switch code to a more conventional ref-counting technique : Do the atomic decrement immediately and queue one rcu call back when last reference is released.
--- include/net/sock.h | 4 +++- net/core/filter.c | 19 ++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-)
include/net/sock.h +3 -1
@@ -1073,6 +1073,8 @@ extern void sk_common_release(struct sock *sk);/* Initialise core socket variables */ extern void sock_init_data (struct socket *sock,struct sock *sk); +extern void sk_filter_release_rcu (struct rcu_head *rcu); +/** * sk_filter_release - release a socket filter * @fp: filter to remove
@@ -1083,7 +1085,7 @@ extern void sock_init_data(struct socket *sock, struct sock *sk);static inline void sk_filter_release (struct sk_filter *fp) {if (atomic_dec_and_test (&fp->refcnt)) -kfree (fp); +call_rcu_bh (&fp->rcu, sk_filter_release_rcu); }static inline void sk_filter_uncharge (struct sock *sk,struct sk_filter *fp)
net/core/filter.c +6 -13
@@ -472,23 +472,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen)EXPORT_SYMBOL (sk_chk_filter);/** -* sk_filter_rcu_release: Release a socket filter by rcu_head +* sk_filter_release_rcu: Release a socket filter by rcu_head * @rcu: rcu_head that contains the sk_filter to free */ -static void sk_filter_rcu_release (struct rcu_head *rcu) +void sk_filter_release_rcu (struct rcu_head *rcu) { struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); -sk_filter_release (fp); -} - -static void sk_filter_delayed_uncharge (struct sock *sk,struct sk_filter *fp) -{ -unsigned int size =sk_filter_len (fp); - -atomic_sub (size, &sk->sk_omem_alloc); -call_rcu_bh (&fp->rcu, sk_filter_rcu_release); +kfree (fp); } +EXPORT_SYMBOL (sk_filter_release_rcu);/** * sk_attach_filter - attach a socket filter
@@ -533,7 +526,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)rcu_read_unlock_bh ();if (old_fp) -sk_filter_delayed_uncharge (sk, old_fp); +sk_filter_uncharge (sk, old_fp);return 0 ; }EXPORT_SYMBOL_GPL (sk_attach_filter);
@@ -547,7 +540,7 @@ int sk_detach_filter(struct sock *sk) filter =rcu_dereference_bh (sk->sk_filter);if (filter) {rcu_assign_pointer (sk->sk_filter,NULL ); -sk_filter_delayed_uncharge (sk, filter); +sk_filter_uncharge (sk, filter); ret =0 ; }rcu_read_unlock_bh ();
Signature · 1 line
1.7.4.4
PATCH 148/209 econet: Do the correct cleanup after an unprivileged SIOCSIFADDR.
In reply to Paul GortmakerFrom: Nelson Elhage <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 0c62fc6dd02c8d793c75ae76a9b6881fc36388ad upstream
We need to drop the mutex and do a dev_put, so set an error code and break like the other paths, instead of returning directly.
--- net/econet/af_econet.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
net/econet/af_econet.c +4 -2
@@ -661,8 +661,10 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) err =0 ;switch (cmd) {case SIOCSIFADDR : -if (!capable (CAP_NET_ADMIN )) -return -EPERM ; +if (!capable (CAP_NET_ADMIN )) { + err = -EPERM ; +break ; + } edev = dev->ec_ptr;if (edev ==NULL ) {
Signature · 1 line
1.7.4.4
PATCH 149/209 econet: Fix crash in aun_incoming().
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 4e085e76cbe558b79b54cbab772f61185879bc64 upstream
Unconditional use of skb->dev won't work here, try to fetch the econet device via skb_dst()->dev instead.
Suggested by Eric Dumazet.
--- net/econet/af_econet.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
net/econet/af_econet.c +5 -1
@@ -847,9 +847,13 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) {struct iphdr *ip =ip_hdr (skb);unsigned char stn =ntohl (ip->saddr) &0xff ; +struct dst_entry *dst =skb_dst (skb); +struct ec_device *edev =NULL ;struct sock *sk;struct sk_buff *newskb; -struct ec_device *edev = skb->dev->ec_ptr; + +if (dst) + edev = dst->dev->ec_ptr;if (! edev) goto bad;
Signature · 1 line
1.7.4.4
PATCH 150/209 ifb: goto resched directly if error happens and dp->tq isn't empty
In reply to Paul GortmakerFrom: Changli Gao <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 75c1c82566f23dd539fb7ccbf57a1caa7ba82628 upstream
If we break the loop when there are still skbs in tq and no skb in rq, the skbs will be left in txq until new skbs are enqueued into rq. In rare cases, no new skb is queued, then these skbs will stay in rq forever.
After this patch, if tq isn't empty when we break the loop, we goto resched directly.
--- drivers/net/ifb.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ifb.c +2 -0
@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev)rcu_read_unlock ();dev_kfree_skb (skb); stats->tx_dropped++; +if (skb_queue_len (&dp->tq) !=0 ) + goto resched;break ; }rcu_read_unlock ();
Signature · 1 line
1.7.4.4
PATCH 151/209 x25: decrement netdev reference counts on unload
In reply to Paul GortmakerFrom: Apollon Oikonomopoulos <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 171995e5d82dcc92bea37a7d2a2ecc21068a0f19 upstream
x25 does not decrement the network device reference counts on module unload. Thus unregistering any pre-existing interface after unloading the x25 module hangs and results in
unregister_netdevice: waiting for tap0 to become free. Usage count = 1
This patch decrements the reference counts of all interfaces in x25_link_free, the way it is already done in x25_link_device_down for NETDEV_DOWN events.
--- net/x25/x25_link.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/x25/x25_link.c +1 -0
@@ -394,6 +394,7 @@ void __exit x25_link_free(void)list_for_each_safe (entry, tmp, &x25_neigh_list) { nb = list_entry(entry, struct x25_neigh, node);__x25_remove_neigh (nb); +dev_put (nb->dev); }write_unlock_bh (&x25_neigh_list_lock); }
Signature · 1 line
1.7.4.4
PATCH 152/209 x86, mwait: Move mwait constants to a common header file
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit bc83cccc761953f878088cdfa682de0970b5561f upstream.
We have MWAIT constants spread across three different .c files, for no good reason. Move them all into a common header file.
[PG: required for cherry pick of ce5f68246b - to avoid dup. mwait fields in smpboot.c; drop intel_idle.c chunk, as 34 doesnt have it]
LKML-Reference: <tip-*@git.kernel.org>
--- arch/x86/include/asm/mwait.h | 15 +++++++++++++++ arch/x86/kernel/acpi/cstate.c | 11 +---------- drivers/acpi/acpi_pad.c | 7 +------ 3 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 arch/x86/include/asm/mwait.h
arch/x86/include/asm/mwait.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef _ASM_X86_MWAIT_H +#define _ASM_X86_MWAIT_H + +#define MWAIT_SUBSTATE_MASK 0xf +#define MWAIT_CSTATE_MASK 0xf +#define MWAIT_SUBSTATE_SIZE 4 +#define MWAIT_MAX_NUM_CSTATES 8 + +#define CPUID_MWAIT_LEAF 5 +#define CPUID5_ECX_EXTENSIONS_SUPPORTED 0x1 +#define CPUID5_ECX_INTERRUPT_BREAK 0x2 + +#define MWAIT_ECX_INTERRUPT_BREAK 0x1 + +#endif /* _ASM_X86_MWAIT_H */
arch/x86/kernel/acpi/cstate.c +1 -10
@@ -13,6 +13,7 @@#include <acpi/processor.h> #include <asm/acpi.h> +#include <asm/mwait.h> /* * Initialize bm_flags based on the CPU cache properties
@@ -65,16 +66,6 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */static short mwait_supported[ACPI_PROCESSOR_MAX_POWER ]; -#define MWAIT_SUBSTATE_MASK (0xf) -#define MWAIT_CSTATE_MASK (0xf) -#define MWAIT_SUBSTATE_SIZE (4) - -#define CPUID_MWAIT_LEAF (5) -#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) -#define CPUID5_ECX_INTERRUPT_BREAK (0x2) - -#define MWAIT_ECX_INTERRUPT_BREAK (0x1) -#define NATIVE_CSTATE_BEYOND_HALT (2)static long acpi_processor_ffh_cstate_probe_cpu (void *_cx)
drivers/acpi/acpi_pad.c +1 -6
@@ -30,18 +30,13 @@#include <linux/slab.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include <asm/mwait.h> #define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80static DEFINE_MUTEX (isolated_cpus_lock); -#define MWAIT_SUBSTATE_MASK (0xf) -#define MWAIT_CSTATE_MASK (0xf) -#define MWAIT_SUBSTATE_SIZE (4) -#define CPUID_MWAIT_LEAF (5) -#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) -#define CPUID5_ECX_INTERRUPT_BREAK (0x2)static unsigned long power_saving_mwait_eax;static void power_saving_mwait_init (void ) {
Signature · 1 line
1.7.4.4
PATCH 153/209 x86, hotplug: Use mwait to offline a processor, fix the legacy case
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ea53069231f9317062910d6e772cca4ce93de8c8 upstream.
The code in native_play_dead() has a number of problems:
1. We should use MWAIT when available, to put ourselves into a deeper sleep state.
2. We use the existence of CLFLUSH to determine if WBINVD is safe, but that is totally bogus -- WBINVD is 486+, whereas CLFLUSH is a much later addition.
3. We should do WBINVD inside the loop, just in case of something like setting an A bit on page tables. Pointed out by Arjan van de Ven.
This code is based in part of a previous patch by Venki Pallipadi, but unlike that patch this one keeps all the detection code local instead of pre-caching a bunch of information. We're shutting down the CPU; there is absolutely no hurry.
This patch moves all the code to C and deletes the global wbinvd_halt() which is broken anyway.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/processor.h | 23 -------------- arch/x86/kernel/smpboot.c | 63 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 24 deletions(-)
arch/x86/include/asm/processor.h +0 -23
@@ -767,29 +767,6 @@ extern unsigned long boot_option_idle_override;extern unsigned long idle_halt;extern unsigned long idle_nomwait; -/* -* on systems with caches, caches must be flashed as the absolute -* last instruction before going into a suspended halt. Otherwise, -* dirty data can linger in the cache and become stale on resume, -* leading to strange errors. -* -* perform a variety of operations to guarantee that the compiler -* will not reorder instructions. wbinvd itself is serializing -* so the processor will not reorder. -* -* Systems without cache can just go into halt. -*/ -static inline void wbinvd_halt (void ) -{ -mb (); -/* check for clflush to determine if wbinvd is legal */ -if (cpu_has_clflush) - asmvolatile ("cli; wbinvd; 1: hlt; jmp 1b" : : :"memory" ); -else -while (1 ) -halt (); -} -extern void enable_sep_cpu (void );extern int sysenter_setup (void );
arch/x86/kernel/smpboot.c +62 -1
79 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 154/209 x86, hotplug: Move WBINVD back outside the play_dead loop
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit a68e5c94f7d3dd64fef34dd5d97e365cae4bb42a upstream.
On processors with hyperthreading, when only one thread is offlined the other thread can cause a spurious wakeup on the idled thread. We do not want to re-WBINVD when that happens.
Ideally, we should simply skip WBINVD unless we're the last thread on a particular core to shut down, but there might be similar issues elsewhere in the system.
Thus, revert to previous behavior of only WBINVD outside the loop. Partly as a result, remove the mb()'s around it: they are not necessary since wbinvd() is a serializing instruction, but they were intended to make sure the compiler didn't do any funny loop optimizations.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/smpboot.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
arch/x86/kernel/smpboot.c +5 -6
@@ -1399,9 +1399,9 @@ static inline void mwait_play_dead(void) (highest_subcstate -1 ); } +wbinvd (); +while (1 ) { -mb (); -wbinvd ();__monitor (¤t_thread_info ()->flags,0 ,0 );mb ();__mwait (eax,0 );
@@ -1410,11 +1410,10 @@ static inline void mwait_play_dead(void)static inline void hlt_play_dead (void ) { +if (current_cpu_data.x86 >=4 ) +wbinvd (); +while (1 ) { -mb (); -if (current_cpu_data.x86 >=4 ) -wbinvd (); -mb ();native_halt (); } }
Signature · 1 line
1.7.4.4
PATCH 155/209 x86, hotplug: In the MWAIT case of play_dead, CLFLUSH the cache line
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ce5f68246bf2385d6174856708d0b746dc378f20 upstream.
When we're using MWAIT for play_dead, explicitly CLFLUSH the cache line before executing MONITOR. This is a potential workaround for the Xeon 7400 erratum AAI65 after having a spurious wakeup and returning around the loop. "Potential" here because it is not certain that that erratum could actually trigger; however, the CLFLUSH should be harmless.
--- arch/x86/kernel/smpboot.c | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
arch/x86/kernel/smpboot.c +19 -1
@@ -1371,9 +1371,12 @@ static inline void mwait_play_dead(void)unsigned int highest_cstate =0 ;unsigned int highest_subcstate =0 ;int i; +void *mwait_ptr;if (!cpu_has (¤t_cpu_data,X86_FEATURE_MWAIT ))return ; +if (!cpu_has (¤t_cpu_data,X86_FEATURE_CLFLSH )) +return ;if (current_cpu_data.cpuid_level <CPUID_MWAIT_LEAF )return ;
@@ -1399,10 +1402,25 @@ static inline void mwait_play_dead(void) (highest_subcstate -1 ); } +/* +* This should be a memory location in a cache line which is +* unlikely to be touched by other processors. The actual +* content is immaterial as it is not actually modified in any way. +*/ + mwait_ptr = ¤t_thread_info ()->flags; +wbinvd ();while (1 ) { -__monitor (¤t_thread_info ()->flags,0 ,0 ); +/* +* The CLFLUSH is a workaround for erratum AAI65 for +* the Xeon 7400 series. It's not clear it is actually +* needed, but it should be harmless in either case. +* The WBINVD is insufficient due to the spurious-wakeup +* case where we return around the loop. +*/ +clflush (mwait_ptr); +__monitor (mwait_ptr,0 ,0 );mb ();__mwait (eax,0 ); }
Signature · 1 line
1.7.4.4
PATCH 156/209 fuse: verify ioctl retries
In reply to Paul GortmakerFrom: Miklos Szeredi <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 7572777eef78ebdee1ecb7c258c0ef94d35bad16 upstream.
Verify that the total length of the iovec returned in FUSE_IOCTL_RETRY doesn't overflow iov_length().
--- fs/fuse/file.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
fs/fuse/file.c +22 -0
@@ -1619,6 +1619,20 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,return 0 ; } +/* Make sure iov_length() won't overflow */ +static int fuse_verify_ioctl_iov (struct iovec *iov,size_t count) +{ +size_t n; +u32 max =FUSE_MAX_PAGES_PER_REQ <<PAGE_SHIFT ; + +for (n =0 ; n < count; n++) { +if (iov->iov_len > (size_t ) max) +return -ENOMEM ; + max -= iov->iov_len; + } +return 0 ; +} +/* * For ioctls, there is no generic way to determine how much memory * needs to be read and/or written. Furthermore, ioctls are allowed
@@ -1812,6 +1826,14 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, in_iov =page_address (iov_page); out_iov = in_iov + in_iovs; + err =fuse_verify_ioctl_iov (in_iov, in_iovs); +if (err) + goto out; + + err =fuse_verify_ioctl_iov (out_iov, out_iovs); +if (err) + goto out; + goto retry; }
Signature · 1 line
1.7.4.4
PATCH 157/209 fuse: fix ioctl when server is 32bit
In reply to Paul GortmakerFrom: Miklos Szeredi <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit d9d318d39dd5cb686660504a3565aac453709ccc upstream.
If a 32bit CUSE server is run on 64bit this results in EIO being returned to the caller.
The reason is that FUSE_IOCTL_RETRY reply was defined to use 'struct iovec', which is different on 32bit and 64bit archs.
Work around this by looking at the size of the reply to determine which struct was used. This is only needed if CONFIG_COMPAT is defined.
A more permanent fix for the interface will be to use the same struct on both 32bit and 64bit.
--- fs/fuse/file.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 44 insertions(+), 6 deletions(-)
fs/fuse/file.c +44 -6
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <linux/sched.h> #include <linux/module.h> +#include <linux/compat.h> static const struct file_operations fuse_direct_io_file_operations;
@@ -1634,6 +1635,44 @@ static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count) }/* +* CUSE servers compiled on 32bit broke on 64bit kernels because the +* ABI was defined to be 'struct iovec' which is different on 32bit +* and 64bit. Fortunately we can determine which structure the server +* used from the size of the reply. +*/ +static int fuse_copy_ioctl_iovec (struct iovec *dst,void *src, +size_t transferred,unsigned count, +bool is_compat) +{ +#ifdef CONFIG_COMPAT +if (count *sizeof (struct compat_iovec ) == transferred) { +struct compat_iovec *ciov = src; +unsigned i; + +/* +* With this interface a 32bit server cannot support +* non-compat (i.e. ones coming from 64bit apps) ioctl +* requests +*/ +if (!is_compat) +return -EINVAL ; + +for (i =0 ; i < count; i++) { + dst[i].iov_base =compat_ptr (ciov[i].iov_base); + dst[i].iov_len = ciov[i].iov_len; + } +return 0 ; + } +#endif + +if (count *sizeof (struct iovec ) != transferred) +return -EIO ; + +memcpy (dst, src, transferred); +return 0 ; +} + +/* * For ioctls, there is no generic way to determine how much memory * needs to be read and/or written. Furthermore, ioctls are allowed * to dereference the passed pointer, so the parameter requires deep
@@ -1814,14 +1853,13 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) goto out; - err = -EIO ; -if ((in_iovs + out_iovs) *sizeof (struct iovec ) != transferred) - goto out; - -/* okay, copy in iovs and retry */ vaddr =kmap_atomic (pages[0 ],KM_USER0 ); -memcpy (page_address (iov_page), vaddr, transferred); + err =fuse_copy_ioctl_iovec (page_address (iov_page), vaddr, + transferred, in_iovs + out_iovs, + (flags &FUSE_IOCTL_COMPAT ) !=0 );kunmap_atomic (vaddr,KM_USER0 ); +if (err) + goto out; in_iov =page_address (iov_page); out_iov = in_iov + in_iovs;
Signature · 1 line
1.7.4.4
PATCH 158/209 ALSA: hda: Use model=lg quirk for LG P1 Express to enable playback and capture
In reply to Paul GortmakerFrom: Daniel T Chen <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 77c4d5cdb81d25a45fbdfb84dd3348121219a072 upstream.
The original reporter states that audible playback from the internal speaker is inaudible despite the hardware being properly detected. To work around this symptom, he uses the model=lg quirk to properly enable both playback, capture, and jack sense. Another user corroborates this workaround on separate hardware. Add this PCI SSID to the quirk table to enable it for further LG P1 Expresses.
--- sound/pci/hda/patch_realtek.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
sound/pci/hda/patch_realtek.c +1 -0
@@ -4149,6 +4149,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {SND_PCI_QUIRK (0x1734 ,0x10b0 ,"Fujitsu" ,ALC880_FUJITSU ),SND_PCI_QUIRK (0x1854 ,0x0018 ,"LG LW20" ,ALC880_LG_LW ),SND_PCI_QUIRK (0x1854 ,0x003b ,"LG" ,ALC880_LG ), +SND_PCI_QUIRK (0x1854 ,0x005f ,"LG P1 Express" ,ALC880_LG ),SND_PCI_QUIRK (0x1854 ,0x0068 ,"LG w1" ,ALC880_LG ),SND_PCI_QUIRK (0x1854 ,0x0077 ,"LG LW25" ,ALC880_LG_LW ), SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
Signature · 1 line
1.7.4.4
PATCH 159/209 drm/kms: remove spaces from connector names (v2)
In reply to Paul GortmakerFrom: Alex Deucher <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit e76116ca9671e2e5239054a40303b94feab585ad upstream.
Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
--- drivers/gpu/drm/drm_crtc.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_crtc.c +5 -5
@@ -154,12 +154,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 }, + { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 }, + { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 }, { DRM_MODE_CONNECTOR_TV, "TV", 0 }, - { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, + { DRM_MODE_CONNECTOR_eDP, "eDP", 0 }, }; static struct drm_prop_enum_list drm_encoder_enum_list[] =
Signature · 1 line
1.7.4.4
PATCH 160/209 nohz: Fix printk_needs_cpu() return value on offline cpus
In reply to Paul GortmakerFrom: Heiko Carstens <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 61ab25447ad6334a74e32f60efb135a3467223f8 upstream.
This patch fixes a hang observed with 2.6.32 kernels where timers got enqueued on offline cpus.
printk_needs_cpu() may return 1 if called on offline cpus. When a cpu gets offlined it schedules the idle process which, before killing its own cpu, will call tick_nohz_stop_sched_tick(). That function in turn will call printk_needs_cpu() in order to check if the local tick can be disabled. On offline cpus this function should naturally return 0 since regardless if the tick gets disabled or not the cpu will be dead short after. That is besides the fact that __cpu_disable() should already have made sure that no interrupts on the offlined cpu will be delivered anyway.
In this case it prevents tick_nohz_stop_sched_tick() to call select_nohz_load_balancer(). No idea if that really is a problem. However what made me debug this is that on 2.6.32 the function get_nohz_load_balancer() is used within __mod_timer() to select a cpu on which a timer gets enqueued. If printk_needs_cpu() returns 1 then the nohz_load_balancer cpu doesn't get updated when a cpu gets offlined. It may contain the cpu number of an offline cpu. In turn timers get enqueued on an offline cpu and not very surprisingly they never expire and cause system hangs.
This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses get_nohz_timer_target() which doesn't have that problem. However there might be other problems because of the too early exit tick_nohz_stop_sched_tick() in case a cpu goes offline.
Easiest way to fix this is just to test if the current cpu is offline and call printk_tick() directly which clears the condition.
Alternatively I tried a cpu hotplug notifier which would clear the condition, however between calling the notifier function and printk_needs_cpu() something could have called printk() again and the problem is back again. This seems to be the safest fix.
LKML-Reference: <[email protected]>
--- kernel/printk.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/printk.c +2 -0
@@ -1009,6 +1009,8 @@ void printk_tick(void)int printk_needs_cpu (int cpu) { +if (unlikely (cpu_is_offline (cpu))) +printk_tick ();return per_cpu (printk_pending, cpu); }
Signature · 1 line
1.7.4.4
PATCH 161/209 nohz: Fix get_next_timer_interrupt() vs cpu hotplug
In reply to Paul GortmakerFrom: Heiko Carstens <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit dbd87b5af055a0cc9bba17795c9a2b0d17795389 upstream.
This fixes a bug as seen on 2.6.32 based kernels where timers got enqueued on offline cpus.
If a cpu goes offline it might still have pending timers. These will be migrated during CPU_DEAD handling after the cpu is offline. However while the cpu is going offline it will schedule the idle task which will then call tick_nohz_stop_sched_tick().
That function in turn will call get_next_timer_intterupt() to figure out if the tick of the cpu can be stopped or not. If it turns out that the next tick is just one jiffy off (delta_jiffies == 1) tick_nohz_stop_sched_tick() incorrectly assumes that the tick should not stop and takes an early exit and thus it won't update the load balancer cpu.
Just afterwards the cpu will be killed and the load balancer cpu could be the offline cpu.
On 2.6.32 based kernel get_nohz_load_balancer() gets called to decide on which cpu a timer should be enqueued (see __mod_timer()). Which leads to the possibility that timers get enqueued on an offline cpu. These will never expire and can cause a system hang.
This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses get_nohz_timer_target() which doesn't have that problem. However there might be other problems because of the too early exit tick_nohz_stop_sched_tick() in case a cpu goes offline.
The easiest and probably safest fix seems to be to let get_next_timer_interrupt() just lie and let it say there isn't any pending timer if the current cpu is offline.
I also thought of moving migrate_[hr]timers() from CPU_DEAD to CPU_DYING, but seeing that there already have been fixes at least in the hrtimer code in this area I'm afraid that this could add new subtle bugs.
LKML-Reference: <[email protected]>
--- kernel/timer.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/timer.c +6 -0
@@ -1173,6 +1173,12 @@ unsigned long get_next_timer_interrupt(unsigned long now)struct tvec_base *base =__get_cpu_var (tvec_bases);unsigned long expires; +/* +* Pretend that there is no timer pending if the cpu is offline. +* Possible pending timers will be migrated later to an active cpu. +*/ +if (cpu_is_offline (smp_processor_id ())) +return now +NEXT_TIMER_MAX_DELTA ;spin_lock (&base->lock);if (time_before_eq (base->next_timer, base->timer_jiffies)) base->next_timer =__next_timer_interrupt (base);
Signature · 1 line
1.7.4.4
PATCH 162/209 NFS: Fix panic after nfs_umount()
In reply to Paul GortmakerFrom: Chuck Lever <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 5b362ac3799ff4225c40935500f520cad4d7ed66 upstream.
After a few unsuccessful NFS mount attempts in which the client and server cannot agree on an authentication flavor both support, the client panics. nfs_umount() is invoked in the kernel in this case.
Turns out nfs_umount()'s UMNT RPC invocation causes the RPC client to write off the end of the rpc_clnt's iostat array. This is because the mount client's nrprocs field is initialized with the count of defined procedures (two: MNT and UMNT), rather than the size of the client's proc array (four).
The fix is to use the same initialization technique used by most other upper layer clients in the kernel.
Introduced by commit 0b524123, which failed to update nrprocs when support was added for UMNT in the kernel.
--- fs/nfs/mount_clnt.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/mount_clnt.c +2 -2
@@ -503,13 +503,13 @@ static struct rpc_procinfo mnt3_procedures[] = {static struct rpc_version mnt_version1 = { .number =1 , - .nrprocs =2 , + .nrprocs =ARRAY_SIZE (mnt_procedures), .procs = mnt_procedures, };static struct rpc_version mnt_version3 = { .number =3 , - .nrprocs =2 , + .nrprocs =ARRAY_SIZE (mnt3_procedures), .procs = mnt3_procedures, };
Signature · 1 line
1.7.4.4
PATCH 163/209 nfsd: Fix possible BUG_ON firing in set_change_info
In reply to Paul GortmakerFrom: Neil Brown <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit c1ac3ffcd0bc7e9617f62be8c7043d53ab84deac upstream.
If vfs_getattr in fill_post_wcc returns an error, we don't set fh_post_change.
For NFSv4, this can result in set_change_info triggering a BUG_ON. i.e. fh_post_saved being zero isn't really a bug.
So:
- instead of BUGging when fh_post_saved is zero, just clear ->atomic.
- if vfs_getattr fails in fill_post_wcc, take a copy of i_ctime anyway. This will be used i seg_change_info, but not overly trusted.
- While we are there, remove the pointless 'if' statements in set_change_info. There is no harm setting all the values.
--- fs/nfsd/nfs3xdr.c | 6 ++++-- fs/nfsd/xdr4.h | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-)
fs/nfsd/nfs3xdr.c +4 -2
@@ -260,9 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp) err =vfs_getattr (fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &fhp->fh_post_attr); fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; -if (err) +if (err) { fhp->fh_post_saved =0 ; -else +/* Grab the ctime anyway - set_change_info might use it */ + fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; + }else fhp->fh_post_saved =1 ; }
fs/nfsd/xdr4.h +10 -11
@@ -479,18 +479,17 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)static inline void set_change_info (struct nfsd4_change_info *cinfo,struct svc_fh *fhp) { -BUG_ON (!fhp->fh_pre_saved || !fhp->fh_post_saved); - cinfo->atomic =1 ; +BUG_ON (!fhp->fh_pre_saved); + cinfo->atomic = fhp->fh_post_saved; cinfo->change_supported =IS_I_VERSION (fhp->fh_dentry->d_inode); -if (cinfo->change_supported) { - cinfo->before_change = fhp->fh_pre_change; - cinfo->after_change = fhp->fh_post_change; - }else { - cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; - cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; - cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; - cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; - } + + cinfo->before_change = fhp->fh_pre_change; + cinfo->after_change = fhp->fh_post_change; + cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; + cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; + cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; + cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; + }int nfs4svc_encode_voidres (struct svc_rqst *,__be32 *,void *);
Signature · 1 line
1.7.4.4
PATCH 164/209 NFS: Fix fcntl F_GETLK not reporting some conflicts
In reply to Paul GortmakerFrom: Sergey Vlasov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 21ac19d484a8ffb66f64487846c8d53afef04d2b upstream.
The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK regression (failure to find conflicts)) fixed the posix_test_lock() function by itself, however, its usage in NFS changed by the commit 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock same interface as ->lock) remained broken - subsequent NFS-specific locking code received F_UNLCK instead of the user-specified lock type. To fix the problem, fl->fl_type needs to be saved before the posix_test_lock() call and restored if no local conflicts were reported.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
--- fs/nfs/file.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/nfs/file.c +2 -0
@@ -693,6 +693,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl) {struct inode *inode = filp->f_mapping->host;int status =0 ; +unsigned int saved_type = fl->fl_type;/* Try local locking first */ posix_test_lock (filp, fl);
@@ -700,6 +701,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)/* found a conflict */ goto out; } + fl->fl_type = saved_type;if (nfs_have_delegation (inode,FMODE_READ )) goto out_noconflict;
Signature · 1 line
1.7.4.4
PATCH 165/209 sunrpc: prevent use-after-free on clearing XPT_BUSY
In reply to Paul GortmakerFrom: NeilBrown <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ed2849d3ecfa339435818eeff28f6c3424300cec upstream.
When an xprt is created, it has a refcount of 1, and XPT_BUSY is set. The refcount is *not* owned by the thread that created the xprt (as is clear from the fact that creators never put the reference). Rather, it is owned by the absence of XPT_DEAD. Once XPT_DEAD is set, (And XPT_BUSY is clear) that initial reference is dropped and the xprt can be freed.
So when a creator clears XPT_BUSY it is dropping its only reference and so must not touch the xprt again.
However svc_recv, after calling ->xpo_accept (and so getting an XPT_BUSY reference on a new xprt), calls svc_xprt_recieved. This clears XPT_BUSY and then svc_xprt_enqueue - this last without owning a reference. This is dangerous and has been seen to leave svc_xprt_enqueue working with an xprt containing garbage.
So we need to hold an extra counted reference over that call to svc_xprt_received.
For safety, any time we clear XPT_BUSY and then use the xprt again, we first get a reference, and the put it again afterwards.
Note that svc_close_all does not need this extra protection as there are no threads running, and the final free can only be called asynchronously from such a thread.
--- net/sunrpc/svc_xprt.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
net/sunrpc/svc_xprt.c +8 -1
@@ -212,6 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name,spin_lock (&svc_xprt_class_lock);list_for_each_entry (xcl, &svc_xprt_class_list, xcl_list) {struct svc_xprt *newxprt; +unsigned short newport;if (strcmp (xprt_name, xcl->xcl_name))continue ;
@@ -230,8 +231,9 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name,spin_lock_bh (&serv->sv_lock);list_add (&newxprt->xpt_list, &serv->sv_permsocks);spin_unlock_bh (&serv->sv_lock); + newport =svc_xprt_local_port (newxprt);clear_bit (XPT_BUSY , &newxprt->xpt_flags); -return svc_xprt_local_port (newxprt); +return newport; } err:spin_unlock (&svc_xprt_class_lock);
@@ -431,8 +433,13 @@ void svc_xprt_received(struct svc_xprt *xprt) {BUG_ON (!test_bit (XPT_BUSY , &xprt->xpt_flags)); xprt->xpt_pool =NULL ; +/* As soon as we clear busy, the xprt could be closed and +* 'put', so we need a reference to call svc_xprt_enqueue with: +*/ +svc_xprt_get (xprt);clear_bit (XPT_BUSY , &xprt->xpt_flags);svc_xprt_enqueue (xprt); +svc_xprt_put (xprt); }EXPORT_SYMBOL_GPL (svc_xprt_received);
Signature · 1 line
1.7.4.4
PATCH 166/209 hwmon: (adm1026) Allow 1 as a valid divider value
In reply to Paul GortmakerFrom: Gabriele Gorla <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 8b0f1840a46449e1946fc88860ef3ec8d6b1c2c7 upstream.
Allow 1 as a valid div value as specified in the ADM1026 datasheet.
--- drivers/hwmon/adm1026.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/hwmon/adm1026.c +1 -3
@@ -920,9 +920,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, val =simple_strtol (buf,NULL ,10 ); new_div =DIV_TO_REG (val); -if (new_div ==0 ) { -return -EINVAL ; - } +mutex_lock (&data->update_lock); orig_div = data->fan_div[nr]; data->fan_div[nr] =DIV_FROM_REG (new_div);
Signature · 1 line
1.7.4.4
PATCH 167/209 hwmon: (adm1026) Fix setting fan_div
In reply to Paul GortmakerFrom: Gabriele Gorla <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 52bc9802ce849d0d287cc5fe76d06b0daa3986ca upstream.
Prevent setting fan_div from stomping on other fans that share the same I2C register.
--- drivers/hwmon/adm1026.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/hwmon/adm1026.c +9 -7
@@ -916,7 +916,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,int nr = sensor_attr->index;struct i2c_client *client =to_i2c_client (dev);struct adm1026_data *data =i2c_get_clientdata (client); -int val, orig_div, new_div, shift; +int val, orig_div, new_div; val =simple_strtol (buf,NULL ,10 ); new_div =DIV_TO_REG (val);
@@ -926,15 +926,17 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, data->fan_div[nr] =DIV_FROM_REG (new_div);if (nr <4 ) {/* 0 <= nr < 4 */ - shift =2 * nr;adm1026_write_value (client,ADM1026_REG_FAN_DIV_0_3 , - ((DIV_TO_REG (orig_div) & (~(0x03 << shift))) | - (new_div << shift))); + (DIV_TO_REG (data->fan_div[0 ]) <<0 ) | + (DIV_TO_REG (data->fan_div[1 ]) <<2 ) | + (DIV_TO_REG (data->fan_div[2 ]) <<4 ) | + (DIV_TO_REG (data->fan_div[3 ]) <<6 )); }else {/* 3 < nr < 8 */ - shift =2 * (nr -4 );adm1026_write_value (client,ADM1026_REG_FAN_DIV_4_7 , - ((DIV_TO_REG (orig_div) & (~(0x03 << (2 * shift)))) | - (new_div << shift))); + (DIV_TO_REG (data->fan_div[4 ]) <<0 ) | + (DIV_TO_REG (data->fan_div[5 ]) <<2 ) | + (DIV_TO_REG (data->fan_div[6 ]) <<4 ) | + (DIV_TO_REG (data->fan_div[7 ]) <<6 )); }if (data->fan_div[nr] != orig_div) {
Signature · 1 line
1.7.4.4
PATCH 168/209 amd64_edac: Fix interleaving check
In reply to Paul GortmakerFrom: Borislav Petkov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit e726f3c368e7c1919a7166ec09c5705759f1a69d upstream.
When matching error address to the range contained by one memory node, we're in valid range when node interleaving
1. is disabled, or
2. enabled and when the address bits we interleave on match the interleave selector on this node (see the "Node Interleaving" section in the BKDG for an enlightening example).
Thus, when we early-exit, we need to reverse the compound logic statement properly.
--- drivers/edac/amd64_edac.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/amd64_edac.c +1 -1
@@ -1567,7 +1567,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int dram_range,debugf1 (" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n" , hole_off, hole_valid, intlv_sel); -if (intlv_en || +if (intlv_en && (intlv_sel != ((sys_addr >>12 ) & intlv_en)))return -EINVAL ;
Signature · 1 line
1.7.4.4
PATCH 169/209 IB/uverbs: Handle large number of entries in poll CQ
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 7182afea8d1afd432a17c18162cc3fd441d0da93 upstream.
In ib_uverbs_poll_cq() code there is a potential integer overflow if userspace passes in a large cmd.ne. The calls to kmalloc() would allocate smaller buffers than intended, leading to memory corruption. There iss also an information leak if resp wasn't all used. Unprivileged userspace may call this function, although only if an RDMA device that uses this function is present.
Fix this by copying CQ entries one at a time, which avoids the allocation entirely, and also by moving this copying into a function that makes sure to initialize all memory copied to userspace.
Special thanks to Jason Gunthorpe <[email protected]> for his help and advice.
[ Monkey around with things a bit to avoid bad code generation by gcc
when designated initializers are used. - Roland ]
--- drivers/infiniband/core/uverbs_cmd.c | 101 +++++++++++++++++++--------------- 1 files changed, 57 insertions(+), 44 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +56 -43
@@ -891,68 +891,81 @@ out:return ret ? ret : in_len; } +static int copy_wc_to_user (void __user *dest,struct ib_wc *wc) +{ +struct ib_uverbs_wc tmp; + + tmp.wr_id = wc->wr_id; + tmp.status = wc->status; + tmp.opcode = wc->opcode; + tmp.vendor_err = wc->vendor_err; + tmp.byte_len = wc->byte_len; + tmp.ex.imm_data = (__u32 __force ) wc->ex.imm_data; + tmp.qp_num = wc->qp->qp_num; + tmp.src_qp = wc->src_qp; + tmp.wc_flags = wc->wc_flags; + tmp.pkey_index = wc->pkey_index; + tmp.slid = wc->slid; + tmp.sl = wc->sl; + tmp.dlid_path_bits = wc->dlid_path_bits; + tmp.port_num = wc->port_num; + tmp.reserved =0 ; + +if (copy_to_user (dest, &tmp,sizeof tmp)) +return -EFAULT ; + +return 0 ; +} +ssize_t ib_uverbs_poll_cq (struct ib_uverbs_file *file,const char __user *buf,int in_len,int out_len) {struct ib_uverbs_poll_cq cmd; -struct ib_uverbs_poll_cq_resp *resp; +struct ib_uverbs_poll_cq_resp resp; +u8 __user *header_ptr; +u8 __user *data_ptr;struct ib_cq *cq; -struct ib_wc *wc; -int ret =0 ; -int i; -int rsize; +struct ib_wc wc; +int ret;if (copy_from_user (&cmd, buf,sizeof cmd))return -EFAULT ; - wc =kmalloc (cmd.ne *sizeof *wc,GFP_KERNEL ); -if (!wc) -return -ENOMEM ; - - rsize =sizeof *resp + cmd.ne *sizeof (struct ib_uverbs_wc ); - resp =kmalloc (rsize,GFP_KERNEL ); -if (!resp) { - ret = -ENOMEM ; - goto out_wc; - } - cq =idr_read_cq (cmd.cq_handle, file->ucontext,0 ); -if (!cq) { - ret = -EINVAL ; - goto out; - } +if (!cq) +return -EINVAL ; - resp->count =ib_poll_cq (cq, cmd.ne, wc); +/* we copy a struct ib_uverbs_poll_cq_resp to user space */ + header_ptr = (void __user *)(unsigned long ) cmd.response; + data_ptr = header_ptr +sizeof resp; -put_cq_read (cq); +memset (&resp,0 ,sizeof resp); +while (resp.count < cmd.ne) { + ret =ib_poll_cq (cq,1 , &wc); +if (ret <0 ) + goto out_put; +if (!ret) +break ; + + ret =copy_wc_to_user (data_ptr, &wc); +if (ret) + goto out_put; -for (i =0 ; i < resp->count; i++) { - resp->wc[i].wr_id = wc[i].wr_id; - resp->wc[i].status = wc[i].status; - resp->wc[i].opcode = wc[i].opcode; - resp->wc[i].vendor_err = wc[i].vendor_err; - resp->wc[i].byte_len = wc[i].byte_len; - resp->wc[i].ex.imm_data = (__u32 __force ) wc[i].ex.imm_data; - resp->wc[i].qp_num = wc[i].qp->qp_num; - resp->wc[i].src_qp = wc[i].src_qp; - resp->wc[i].wc_flags = wc[i].wc_flags; - resp->wc[i].pkey_index = wc[i].pkey_index; - resp->wc[i].slid = wc[i].slid; - resp->wc[i].sl = wc[i].sl; - resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits; - resp->wc[i].port_num = wc[i].port_num; + data_ptr +=sizeof (struct ib_uverbs_wc ); + ++resp.count; } -if (copy_to_user ((void __user *) (unsigned long ) cmd.response, resp, rsize)) +if (copy_to_user (header_ptr, &resp,sizeof resp)) { ret = -EFAULT ; + goto out_put; + } -out: -kfree (resp); + ret = in_len; -out_wc: -kfree (wc); -return ret ? ret : in_len; +out_put: +put_cq_read (cq); +return ret; } ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file,
Signature · 1 line
1.7.4.4
PATCH 170/209 PM / Hibernate: Fix PM_POST_* notification with user-space suspend
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 1497dd1d29c6a53fcd3c80f7ac8d0e0239e7389e upstream.
The user-space hibernation sends a wrong notification after the image restoration because of thinko for the file flag check. RDONLY corresponds to hibernation and WRONLY to restoration, confusingly.
--- kernel/power/user.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/power/user.c +1 -1
@@ -137,7 +137,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)free_all_swap_pages (data->swap);if (data->frozen)thaw_processes (); -pm_notifier_call_chain (data->mode ==O_WRONLY ? +pm_notifier_call_chain (data->mode ==O_RDONLY ?PM_POST_HIBERNATION :PM_POST_RESTORE );atomic_inc (&snapshot_device_available);
Signature · 1 line
1.7.4.4
PATCH 171/209 Subject: [PATCH] ACPICA: Fix Scope() op in module level code
In reply to Paul GortmakerFrom: Bob Moore <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 8df3fc981dc12d9fdcaef4100a2193b605024d7a upstream.
Some Panasonic Toughbooks create nodes in module level code. Module level code is the executable AML code outside of control method, for example, below AML code creates a node \_SB.PCI0.GFX0.DD02.CUBL
If (\_OSI ("Windows 2006"))
{
Scope (\_SB.PCI0.GFX0.DD02)
{
Name (CUBL, Ones)
...
}
}Scope() op does not actually create a new object, it refers to an existing object(\_SB.PCI0.GFX0.DD02 in above example). However, for Scope(), we want to indeed open a new scope, so the child nodes(CUBL in above example) can be created correctly under it.
https://bugzilla.kernel.org/show_bug.cgi?id=19462
--- drivers/acpi/acpica/dswexec.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
drivers/acpi/acpica/dswexec.c +17 -2
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,* we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. +* +* Note 10/2010: Except for the Scope() op. This opcode does +* not actually create a new object, it refers to an existing +* object. However, for Scope(), we want to indeed open a +* new scope. */ - status =acpi_ds_load2_begin_op (walk_state,NULL ); +if (op->common.aml_opcode !=AML_SCOPE_OP ) { + status = +acpi_ds_load2_begin_op (walk_state,NULL ); + }else { + status = +acpi_ds_scope_stack_push (op->named.node, + op->named.node-> + type, walk_state); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + } } -break ;case AML_CLASS_EXECUTE :
Signature · 1 line
1.7.4.4
PATCH 172/209 ACPI: EC: Add another dmi match entry for MSI hardware
In reply to Paul GortmakerFrom: Alexey Starikovskiy <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit a5dc4f898c2a0f66e2cefada6c687db82ba2fcbc upstream.
http://bugzilla.kernel.org/show_bug.cgi?id=15418
--- drivers/acpi/ec.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/acpi/ec.c +3 -0
@@ -996,6 +996,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { ec_flag_msi, "MSI hardware", { DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, { + ec_flag_msi, "MSI hardware", { + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, + { ec_validate_ecdt, "ASUS hardware", { DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, {},
Signature · 1 line
1.7.4.4
PATCH 173/209 orinoco: fix TKIP countermeasure behaviour
In reply to Paul GortmakerFrom: David Kilroy <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 0a54917c3fc295cb61f3fb52373c173fd3b69f48 upstream.
Enable the port when disabling countermeasures, and disable it on enabling countermeasures.
This bug causes the response of the system to certain attacks to be ineffective.
It also prevents wpa_supplicant from getting scan results, as wpa_supplicant disables countermeasures on startup - preventing the hardware from scanning.
wpa_supplicant works with ap_mode=2 despite this bug because the commit handler re-enables the port.
The log tends to look like:
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID
Scan requested (ret=0) - scan timeout 5 seconds
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
Scan timeout - try to get results
Failed to get scan results
Failed to get scan results - try scanning again
Setting scan request: 1 sec 0 usec
Starting AP scan for wildcard SSID
Scan requested (ret=-1) - scan timeout 5 seconds
Failed to initiate AP scan.
Reported by: Giacomo Comes <[email protected]> Signed-off by: David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/wext.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/orinoco/wext.c +2 -2
@@ -1023,10 +1023,10 @@ static int orinoco_ioctl_set_auth(struct net_device *dev,*/ if (param->value) { priv->tkip_cm_active =1 ; - ret =hermes_enable_port (hw,0 ); + ret =hermes_disable_port (hw,0 ); }else { priv->tkip_cm_active =0 ; - ret =hermes_disable_port (hw,0 ); + ret =hermes_enable_port (hw,0 ); }break ;
Signature · 1 line
1.7.4.4
PATCH 174/209 orinoco: clear countermeasure setting on commit
In reply to Paul GortmakerFrom: David Kilroy <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ba34fcee476d11e7c9df95932787a22a96ff6e68 upstream.
... and interface up.
In these situations, you are usually trying to connect to a new AP, so keeping TKIP countermeasures active is confusing. This is already how the driver behaves (inadvertently). However, querying SIOCGIWAUTH may tell userspace that countermeasures are active when they aren't.
Clear the setting so that the reporting matches what the driver has done..
Signed-off by: David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/main.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/orinoco/main.c +6 -0
@@ -1764,6 +1764,12 @@ static int __orinoco_commit(struct orinoco_private *priv)struct net_device *dev = priv->ndev;int err =0 ; +/* If we've called commit, we are reconfiguring or bringing the +* interface up. Maintaining countermeasures across this would +* be confusing, so note that we've disabled them. The port will +* be enabled later in orinoco_commit or __orinoco_up. */ + priv->tkip_cm_active =0 ; + err =orinoco_hw_program_rids (priv);/* FIXME: what about netif_tx_lock */
Signature · 1 line
1.7.4.4
PATCH 175/209 md: fix bug with re-adding of partially recovered device.
In reply to Paul GortmakerFrom: NeilBrown <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 1a855a0606653d2d82506281e2c686bacb4b2f45 upstream.
With v0.90 metadata, a hot-spare does not become a full member of the array until recovery is complete. So if we re-add such a device to the array, we know that all of it is as up-to-date as the event count would suggest, and so it a bitmap-based recovery is possible.
However with v1.x metadata, the hot-spare immediately becomes a full member of the array, but it record how much of the device has been recovered. If the array is stopped and re-assembled recovery starts from this point.
When such a device is hot-added to an array we currently lose the 'how much is recovered' information and incorrectly included it as a full in-sync member (after bitmap-based fixup).
This is wrong and unsafe and could corrupt data.
So be more careful about setting saved_raid_disk - which is what guides the re-adding of devices back into an array. The new code matches the code in slot_store which does a similar thing, which is encouraging.
This is suitable for any -stable kernel.
--- drivers/md/md.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/md/md.c +5 -2
@@ -5008,7 +5008,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) PTR_ERR(rdev));return PTR_ERR (rdev); } -/* set save_raid_disk if appropriate */ +/* set saved_raid_disk if appropriate */ if (!mddev->persistent) {if (info->state & (1 <<MD_DISK_SYNC ) && info->raid_disk < mddev->raid_disks)
@@ -5018,7 +5018,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) }else super_types[mddev->major_version].validate_super (mddev, rdev); - rdev->saved_raid_disk = rdev->raid_disk; +if (test_bit (In_sync, &rdev->flags)) + rdev->saved_raid_disk = rdev->raid_disk; +else + rdev->saved_raid_disk =-1 ;clear_bit (In_sync, &rdev->flags);/* just to be sure */ if (info->state & (1 <<MD_DISK_WRITEMOSTLY ))
Signature · 1 line
1.7.4.4
PATCH 176/209 tracing: Fix panic when lseek() called on "trace" opened for writing
In reply to Paul GortmakerFrom: Slava Pestov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 364829b1263b44aa60383824e4c1289d83d78ca7 upstream.
The file_ops struct for the "trace" special file defined llseek as seq_lseek(). However, if the file was opened for writing only, seq_open() was not called, and the seek would dereference a null pointer, file->private_data.
This patch introduces a new wrapper for seq_lseek() which checks if the file descriptor is opened for reading first. If not, it does nothing.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
kernel/trace/trace.c +9 -1
@@ -2341,11 +2341,19 @@ tracing_write_stub(struct file *filp, const char __user *ubuf,return count; } +static loff_t tracing_seek (struct file *file,loff_t offset,int origin) +{ +if (file->f_mode &FMODE_READ ) +return seq_lseek (file, offset, origin); +else +return 0 ; +} +static const struct file_operations tracing_fops = { .open = tracing_open, .read = seq_read, .write = tracing_write_stub, - .llseek = seq_lseek, + .llseek = tracing_seek, .release = tracing_release, };
Signature · 1 line
1.7.4.4
PATCH 177/209 x86, gcc-4.6: Use gcc -m options when building vdso
In reply to Paul GortmakerFrom: H. Peter Anvin <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit de2a8cf98ecdde25231d6c5e7901e2cffaf32af9 upstream.
The vdso Makefile passes linker-style -m options not to the linker but to gcc. This happens to work with earlier gcc, but fails with gcc 4.6. Pass gcc-style -m options, instead.
Note: all currently supported versions of gcc supports -m32, so there is no reason to conditionalize it any more.
LKML-Reference: <tip-*@git.kernel.org>
--- arch/x86/vdso/Makefile | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/vdso/Makefile +2 -2
@@ -25,7 +25,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) export CPPFLAGS_vdso.lds += -P -C -VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \ +VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
@@ -69,7 +69,7 @@ vdso32.so-$(VDSO32-y) += sysenter vdso32-images = $(vdso32.so-y:%=vdso32-%.so) CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) -VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1 +VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1 # This makes sure the $(obj) subdirectory exists even though vdso32/ # is not a kbuild sub-make subdirectory.
Signature · 1 line
1.7.4.4
PATCH 178/209 x86: Enable the intr-remap fault handling after local APIC setup
In reply to Paul GortmakerFrom: Kenji Kaneshige <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 7f7fbf45c6b748074546f7f16b9488ca71de99c1 upstream.
Interrupt-remapping gets enabled very early in the boot, as it determines the apic mode that the processor can use. And the current code enables the vt-d fault handling before the setup_local_APIC(). And hence the APIC LDR registers and data structure in the memory may not be initialized. So the vt-d fault handling in logical xapic/x2apic modes were broken.
Fix this by enabling the vt-d fault handling in the end_local_APIC_setup()
A cleaner fix of enabling fault handling while enabling intr-remapping will be addressed for v2.6.38. [ Enabling intr-remapping determines the usage of x2apic mode and the apic mode determines the fault-handling configuration. ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 8 ++++++++ arch/x86/kernel/apic/probe_64.c | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/apic.c +8 -0
@@ -1340,6 +1340,14 @@ void __cpuinit end_local_APIC_setup(void)setup_apic_nmi_watchdog (NULL );apic_pm_activate (); + +/* +* Now that local APIC setup is completed for BP, configure the fault +* handling for interrupt remapping. +*/ +if (!smp_processor_id () && intr_remapping_enabled) +enable_drhd_fault_handling (); + }#ifdef CONFIG_X86_X2APIC
arch/x86/kernel/apic/probe_64.c +0 -7
@@ -76,13 +76,6 @@ void __init default_setup_apic_routing(void)/* need to update phys_pkg_id */ apic->phys_pkg_id = apicid_phys_pkg_id; } - -/* -* Now that apic routing model is selected, configure the -* fault handling for intr remapping. -*/ -if (intr_remapping_enabled) -enable_drhd_fault_handling (); }/* Same for both flat and physical. */
Signature · 1 line
1.7.4.4
PATCH 179/209 x86, vt-d: Handle previous faults after enabling fault handling
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 7f99d946e71e71d484b7543b49e990508e70d0c0 upstream.
Fault handling is getting enabled after enabling the interrupt-remapping (as the success of interrupt-remapping can affect the apic mode and hence the fault handling mode).
Hence there can potentially be some faults between the window of enabling interrupt-remapping in the vt-d and the fault-handling of the vt-d units.
Handle any previous faults after enabling the vt-d fault handling.
For v2.6.38 cleanup, need to check if we can remove the dmar_fault() in the enable_intr_remapping() and see if we can enable fault handling along with enabling intr-remapping.
LKML-Reference: <[email protected]>
--- drivers/pci/dmar.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/pci/dmar.c +5 -0
@@ -1424,6 +1424,11 @@ int __init enable_drhd_fault_handling(void) (unsigned long long)drhd->reg_base_addr, ret);return -1 ; } + +/* +* Clear any previous faults. +*/ +dmar_fault (iommu->irq, iommu); }return 0 ;
Signature · 1 line
1.7.4.4
PATCH 180/209 x86, vt-d: Fix the vt-d fault handling irq migration in the x2apic mode
In reply to Paul GortmakerFrom: Kenji Kaneshige <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 086e8ced65d9bcc4a8e8f1cd39b09640f2883f90 upstream.
In x2apic mode, we need to set the upper address register of the fault handling interrupt register of the vt-d hardware. Without this irq migration of the vt-d fault handling interrupt is broken.
LKML-Reference: <1291225233.2648.39.camel@sbsiddha-MOBL3>
--- arch/x86/kernel/apic/io_apic.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -0
@@ -3642,6 +3642,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) msg.data |=MSI_DATA_VECTOR (cfg->vector); msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK ; msg.address_lo |=MSI_ADDR_DEST_ID (dest); + msg.address_hi =MSI_ADDR_BASE_HI |MSI_ADDR_EXT_DEST_ID (dest);dmar_msi_write (irq, &msg);
Signature · 1 line
1.7.4.4
PATCH 181/209 x86, vt-d: Quirk for masking vtd spec errors to platform error handling logic
In reply to Paul GortmakerFrom: Suresh Siddha <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 254e42006c893f45bca48f313536fcba12206418 upstream.
On platforms with Intel 7500 chipset, there were some reports of system hang/NMI's during kexec/kdump in the presence of interrupt-remapping enabled.
During kdump, there is a window where the devices might be still using old kernel's interrupt information, while the kdump kernel is coming up. This can cause vt-d faults as the interrupt configuration from the old kernel map to null IRTE entries in the new kernel etc. (with out interrupt-remapping enabled, we still have the same issue but in this case we will see benign spurious interrupt hit the new kernel).
Based on platform config settings, these platforms seem to generate NMI/SMI when a vt-d fault happens and there were reports that the resulting SMI causes the system to hang.
Fix it by masking vt-d spec defined errors to platform error reporting logic. VT-d spec related errors are already handled by the VT-d OS code, so need to report the same error through other channels.
LKML-Reference: <[email protected]>
--- drivers/pci/quirks.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
drivers/pci/quirks.c +23 -0
@@ -2665,6 +2665,29 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mDECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5C832 , ricoh_mmc_fixup_r5c832);#endif /*CONFIG_MMC_RICOH_MMC*/ +#if defined(CONFIG_DMAR ) || defined(CONFIG_INTR_REMAP ) +#define VTUNCERRMSK_REG 0x1ac +#define VTD_MSK_SPEC_ERRORS (1 << 31) +/* +* This is a quirk for masking vt-d spec defined errors to platform error +* handling logic. With out this, platforms using Intel 7500, 5500 chipsets +* (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based +* on the RAS config settings of the platform) when a vt-d fault happens. +* The resulting SMI caused the system to hang. +* +* VT-d spec related errors are already handled by the VT-d OS code, so no +* need to report the same error through other channels. +*/ +static void vtd_mask_spec_errors (struct pci_dev *dev) +{ +u32 word; + +pci_read_config_dword (dev,VTUNCERRMSK_REG , &word); +pci_write_config_dword (dev,VTUNCERRMSK_REG , word |VTD_MSK_SPEC_ERRORS ); +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x342e , vtd_mask_spec_errors); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x3c28 , vtd_mask_spec_errors); +#endif static void pci_do_fixups (struct pci_dev *dev,struct pci_fixup *f,struct pci_fixup *end)
Signature · 1 line
1.7.4.4
PATCH 182/209 HID: hidraw: fix window in hidraw_release
In reply to Paul GortmakerFrom: Jiri Slaby <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit cb174681a9ececa6702f114b85bdf82144b6a5af upstream.
There is a window between hidraw_table check and its dereference. In that window, the device may be unplugged and removed form the system and we will then dereference NULL.
Lock that place properly so that either we get NULL and jump out or we can work with real pointer.
[PG: slightly/trivially reworked for backport to 34]
--- drivers/hid/hidraw.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/hid/hidraw.c +8 -5
@@ -212,11 +212,12 @@ static int hidraw_release(struct inode * inode, struct file * file)unsigned int minor =iminor (inode);struct hidraw *dev;struct hidraw_list *list = file->private_data; +int ret; +mutex_lock (&minors_lock);if (!hidraw_table[minor]) { -printk (KERN_EMERG "hidraw device with minor %d doesn't exist\n" , - minor); -return -ENODEV ; + ret = -ENODEV ; + goto unlock; }list_del (&list->node);
@@ -230,10 +231,12 @@ static int hidraw_release(struct inode * inode, struct file * file)kfree (list->hidraw); } } -kfree (list); + ret =0 ; +unlock: +mutex_unlock (&minors_lock); -return 0 ; +return ret; } static long hidraw_ioctl(struct file *file, unsigned int cmd,
Signature · 1 line
1.7.4.4
PATCH 183/209 bfa: fix system crash when reading sysfs fc_host statistics
In reply to Paul GortmakerFrom: Krishna Gudipati <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 7873ca4e4401f0ecd8868bf1543113467e6bae61 upstream.
The port data structure related to fc_host statistics collection is not initialized. This causes system crash when reading the fc_host statistics. The fix is to initialize port structure during driver attach.
--- drivers/scsi/bfa/bfa_core.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/scsi/bfa/bfa_core.c +22 -0
@@ -84,11 +84,32 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo)for (i =0 ; hal_mods[i]; i++) hal_mods[i]->meminfo (cfg, &km_len, &dm_len); + dm_len +=bfa_port_meminfo (); meminfo->meminfo[BFA_MEM_TYPE_KVA -1 ].mem_len = km_len; meminfo->meminfo[BFA_MEM_TYPE_DMA -1 ].mem_len = dm_len; } +static void +bfa_com_port_attach (struct bfa_s *bfa,struct bfa_meminfo_s *mi) +{ +struct bfa_port_s *port = &bfa->modules.port; +uint32_t dm_len; +uint8_t *dm_kva; +uint64_t dm_pa; + + dm_len =bfa_port_meminfo (); + dm_kva =bfa_meminfo_dma_virt (mi); + dm_pa =bfa_meminfo_dma_phys (mi); + +memset (port,0 ,sizeof (struct bfa_port_s )); +bfa_port_attach (port, &bfa->ioc, bfa, bfa->trcmod, bfa->logm); +bfa_port_mem_claim (port, dm_kva, dm_pa); + +bfa_meminfo_dma_virt (mi) = dm_kva + dm_len; +bfa_meminfo_dma_phys (mi) = dm_pa + dm_len; +} +/** * Use this function to do attach the driver instance with the BFA * library. This function will not trigger any HW initialization
@@ -140,6 +161,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,for (i =0 ; hal_mods[i]; i++) hal_mods[i]->attach (bfa, bfad, cfg, meminfo, pcidev); +bfa_com_port_attach (bfa, meminfo); }/**
Signature · 1 line
1.7.4.4
PATCH 184/209 install_special_mapping skips security_file_mmap check.
In reply to Paul GortmakerFrom: Tavis Ormandy <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 462e635e5b73ba9a4c03913b77138cd57ce4b050 upstream.
The install_special_mapping routine (used, for example, to setup the vdso) skips the security check before insert_vm_struct, allowing a local attacker to bypass the mmap_min_addr security restriction by limiting the available pages for special mappings.
bprm_mm_init() also skips the check, and although I don't think this can be used to bypass any restrictions, I don't see any reason not to have the security check.
$ uname -m
x86_64
$ cat /proc/sys/vm/mmap_min_addr
65536
$ cat install_special_mapping.s
section .bss
resb BSS_SIZE
section .text
global _start
_start:
mov eax, __NR_pause
int 0x80
$ nasm -D__NR_pause=29 -DBSS_SIZE=0xfffed000 -f elf -o install_special_mapping.o install_special_mapping.s
$ ld -m elf_i386 -Ttext=0x10000 -Tbss=0x11000 -o install_special_mapping install_special_mapping.o
$ ./install_special_mapping &
[1] 14303
$ cat /proc/14303/maps
0000f000-00010000 r-xp 00000000 00:00 0 [vdso]
00010000-00011000 r-xp 00001000 00:19 2453665 /home/taviso/install_special_mapping
00011000-ffffe000 rwxp 00000000 00:00 0 [stack]It's worth noting that Red Hat are shipping with mmap_min_addr set to 4096.
--- fs/exec.c | 5 +++++ mm/mmap.c | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)
fs/exec.c +5 -0
@@ -268,6 +268,11 @@ static int __bprm_mm_init(struct linux_binprm *bprm) vma->vm_flags =VM_STACK_FLAGS ; vma->vm_page_prot =vm_get_page_prot (vma->vm_flags);INIT_LIST_HEAD (&vma->anon_vma_chain); + + err =security_file_mmap (NULL ,0 ,0 ,0 , vma->vm_start,1 ); +if (err) + goto err; + err =insert_vm_struct (mm, vma);if (err) goto err;
mm/mmap.c +12 -4
@@ -2443,6 +2443,7 @@ int install_special_mapping(struct mm_struct *mm, unsigned long addr, unsigned long len, unsigned long vm_flags, struct page **pages) { + int ret;struct vm_area_struct *vma; vma =kmem_cache_zalloc (vm_area_cachep,GFP_KERNEL );
@@ -2460,16 +2461,23 @@ int install_special_mapping(struct mm_struct *mm, vma->vm_ops = &special_mapping_vmops; vma->vm_private_data = pages; -if (unlikely (insert_vm_struct (mm, vma))) { -kmem_cache_free (vm_area_cachep, vma); -return -ENOMEM ; - } + ret =security_file_mmap (NULL ,0 ,0 ,0 , vma->vm_start,1 ); +if (ret) + goto out; + + ret =insert_vm_struct (mm, vma); +if (ret) + goto out; mm->total_vm += len >>PAGE_SHIFT ;perf_event_mmap (vma);return 0 ; + +out: +kmem_cache_free (vm_area_cachep, vma); +return ret; }static DEFINE_MUTEX (mm_all_locks_mutex);
Signature · 1 line
1.7.4.4
PATCH 185/209 USB: misc: uss720.c: add another vendor/product ID
In reply to Paul GortmakerFrom: Thomas Sailer <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ecc1624a2fff45780959efbcb73ace18fdb3c58d upstream.
Fabio Battaglia report that he has another cable that works with this driver, so this patch adds its vendor/product ID.
--- drivers/usb/misc/uss720.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/usb/misc/uss720.c +3 -1
@@ -3,7 +3,7 @@/* * uss720.c -- USS720 USB Parport Cable. * -* Copyright (C) 1999, 2005 +* Copyright (C) 1999, 2005, 2010 * Thomas Sailer ([email protected]) * * This program is free software; you can redistribute it and/or modify
@@ -776,6 +776,8 @@ static const struct usb_device_id uss720_table[] = { { USB_DEVICE(0x0557, 0x2001) }, { USB_DEVICE(0x0729, 0x1284) }, { USB_DEVICE(0x1293, 0x0002) }, + { USB_DEVICE(0x1293, 0x0002) }, + { USB_DEVICE(0x050d, 0x0002) }, { } /* Terminating entry */ };
Signature · 1 line
1.7.4.4
PATCH 186/209 USB: ftdi_sio: Add D.O.Tec PID
In reply to Paul GortmakerFrom: Florian Faber <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 5363cdc3c5da9bd431552cf5989ab481596f0c6d upstream.
Add FTDI PID to identify D.O.Tec devices correctly.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -802,6 +802,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { }, /* Optional parameter entry */
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -1088,6 +1088,11 @@#define MJSG_HD_RADIO_PID 0x937C/* +* D.O.Tec products (http://www.directout.eu) +*/ +#define FTDI_DOTEC_PID 0x9868 + +/* * Xverve Signalyzer tools (http://www.signalyzer.com/) */ #define XVERVE_SIGNALYZER_ST_PID 0xBCA0
Signature · 1 line
1.7.4.4
PATCH 187/209 USB: usb-storage: unusual_devs entry for the Samsung YP-CP3
In reply to Paul GortmakerFrom: Vitaly Kuznetsov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit d73a9b3001f29271c2e9f2a806b05a431c5d9591 upstream.
Add an unusual_devs entry for the Samsung YP-CP3 MP4 player.
User was getting the following errors in dmesg:
usb 2-6: reset high speed USB device using ehci_hcd and address 2 usb 2-6: reset high speed USB device using ehci_hcd and address 2 usb 2-6: reset high speed USB device using ehci_hcd and address 2 usb 2-6: USB disconnect, address 2
sd 3:0:0:0: [sdb] Assuming drive cache: write through sdb:<2>ldm_validate_partition_table(): Disk read failed. Dev sdb: unable to read RDB block 0
unable to read partition table
[PG: change USB_ --> US_ to match 2.6.34.x naming conventions]
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -490,6 +490,13 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x0220, US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_MAX_SECTORS_64), +/* Reported by Vitaly Kuznetsov <[email protected]> */ +UNUSUAL_DEV (0x04e8 ,0x5122 ,0x0000 ,0x9999 , +"Samsung" , +"YP-CP3" , +US_SC_DEVICE ,US_PR_DEVICE ,NULL , + US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), +/* Entry and supporting patch by Theodore Kilgore <[email protected]>. * Device uses standards-violating 32-byte Bulk Command Block Wrappers and * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011.
Signature · 1 line
1.7.4.4
PATCH 188/209 p54usb: add 5 more USBIDs
In reply to Paul GortmakerFrom: Christian Lamparter <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 16cad7fba037b34ca32cc0adac65bc089d969fb8 upstream.
This patch adds five more USBIDs to the table.
Source:
http://www.linuxant.com/pipermail/driverloader/2005q3/002307.html
http://wireless.kernel.org/en/users/Drivers/p54/devices (by M. Davis)
--- drivers/net/wireless/p54/p54usb.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/wireless/p54/p54usb.c +5 -0
@@ -43,6 +43,7 @@ MODULE_FIRMWARE("isl3887usb");static struct usb_device_id p54u_table[]__devinitdata = {/* Version 1 devices (pci chip + net2280) */ + {USB_DEVICE (0x0411 ,0x0050 )},/* Buffalo WLI2-USB2-G54 */ {USB_DEVICE (0x045e ,0x00c2 )},/* Microsoft MN-710 */ {USB_DEVICE (0x0506 ,0x0a11 )},/* 3COM 3CRWE254G72 */ {USB_DEVICE (0x06b9 ,0x0120 )},/* Thomson SpeedTouch 120g */
@@ -56,9 +57,12 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ + {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ + {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ + {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */ {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */ {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */
@@ -93,6 +97,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ + {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ {USB_DEVICE(0x413c, 0x8102)}, /* Spinnaker DUT */ {USB_DEVICE(0x413c, 0x8104)}, /* Cohiba Proto board */
Signature · 1 line
1.7.4.4
PATCH 189/209 p54usb: New USB ID for Gemtek WUBI-100GW
In reply to Paul GortmakerFrom: Eduardo Costa <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 56e6417b49132d4f56e9f2241d31942b90b46315 upstream.
This USB ID is for the WUBI-100GW 802.11g Wireless LAN USB Device that uses p54usb.
--- drivers/net/wireless/p54/p54usb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/p54/p54usb.c +1 -0
@@ -61,6 +61,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ {USB_DEVICE(0x124a, 0x4023)}, /* Shuttle PN15, Airvast WM168g, IOGear GWU513 */ {USB_DEVICE(0x1435, 0x0210)}, /* Inventel UR054G */ + {USB_DEVICE(0x15a9, 0x0002)}, /* Gemtek WUBI-100GW 802.11g */ {USB_DEVICE(0x1630, 0x0005)}, /* 2Wire 802.11g USB (v1) / Z-Com */ {USB_DEVICE(0x182d, 0x096b)}, /* Sitecom WL-107 */ {USB_DEVICE(0x1915, 0x2234)}, /* Linksys WUSB54G OEM */
Signature · 1 line
1.7.4.4
PATCH 190/209 sound: Prevent buffer overflow in OSS load_mixer_volumes
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit d81a12bc29ae4038770e05dce4ab7f26fd5880fb upstream.
The load_mixer_volumes() function, which can be triggered by unprivileged users via the SOUND_MIXER_SETLEVELS ioctl, is vulnerable to a buffer overflow. Because the provided "name" argument isn't guaranteed to be NULL terminated at the expected 32 bytes, it's possible to overflow past the end of the last element in the mixer_vols array. Further exploitation can result in an arbitrary kernel write (via subsequent calls to load_mixer_volumes()) leading to privilege escalation, or arbitrary kernel reads via get_mixer_levels(). In addition, the strcmp() may leak bytes beyond the mixer_vols array.
--- sound/oss/soundcard.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
sound/oss/soundcard.c +2 -2
@@ -86,7 +86,7 @@ int *load_mixer_volumes(char *name, int *levels, int present)int i, n;for (i =0 ; i < num_mixer_volumes; i++) { -if (strcmp (name, mixer_vols[i].name) ==0 ) { +if (strncmp (name, mixer_vols[i].name,32 ) ==0 ) {if (present) mixer_vols[i].num = i;return mixer_vols[i].levels;
@@ -98,7 +98,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) } n = num_mixer_volumes++; -strcpy (mixer_vols[n].name, name); +strncpy (mixer_vols[n].name, name,32 );if (present) mixer_vols[n].num = n;
Signature · 1 line
1.7.4.4
PATCH 191/209 mv_xor: fix race in tasklet function
In reply to Paul GortmakerFrom: Saeed Bishara <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 8333f65ef094e47020cd01452b4637e7daf5a77f upstream.
use mv_xor_slot_cleanup() instead of __mv_xor_slot_cleanup() as the former function aquires the spin lock that needed to protect the drivers data.
--- drivers/dma/mv_xor.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/mv_xor.c +1 -1
@@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)static void mv_xor_tasklet (unsigned long data) {struct mv_xor_chan *chan = (struct mv_xor_chan *) data; -__mv_xor_slot_cleanup (chan); +mv_xor_slot_cleanup (chan); } static struct mv_xor_desc_slot *
Signature · 1 line
1.7.4.4
PATCH 192/209 ima: fix add LSM rule bug
In reply to Paul GortmakerFrom: Mimi Zohar <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 867c20265459d30a01b021a9c1e81fb4c5832aa9 upstream.
If security_filter_rule_init() doesn't return a rule, then not everything is as fine as the return code implies.
This bug only occurs when the LSM (eg. SELinux) is disabled at runtime.
Adding an empty LSM rule causes ima_match_rules() to always succeed, ignoring any remaining rules.
default IMA TCB policy:
# PROC_SUPER_MAGIC
dont_measure fsmagic=0x9fa0
# SYSFS_MAGIC
dont_measure fsmagic=0x62656572
# DEBUGFS_MAGIC
dont_measure fsmagic=0x64626720
# TMPFS_MAGIC
dont_measure fsmagic=0x01021994
# SECURITYFS_MAGIC
dont_measure fsmagic=0x73636673
< LSM specific rule >
dont_measure obj_type=var_log_t
measure func=BPRM_CHECK
measure func=FILE_MMAP mask=MAY_EXEC
measure func=FILE_CHECK mask=MAY_READ uid=0
Thus without the patch, with the boot parameters 'tcb selinux=0', adding the above 'dont_measure obj_type=var_log_t' rule to the default IMA TCB measurement policy, would result in nothing being measured. The patch prevents the default TCB policy from being replaced.
--- security/integrity/ima/ima_policy.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
security/integrity/ima/ima_policy.c +2 -0
@@ -250,6 +250,8 @@ static int ima_lsm_rule_init(struct ima_measure_rule_entry *entry, result =security_filter_rule_init (entry->lsm[lsm_rule].type, Audit_equal, args, &entry->lsm[lsm_rule].rule); +if (!entry->lsm[lsm_rule].rule) +return -EINVAL ;return result; }
Signature · 1 line
1.7.4.4
PATCH 193/209 ALSA: hda: Use LPIB quirk for Dell Inspiron m101z/1120
In reply to Paul GortmakerFrom: Daniel T Chen <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit e03fa055bc126e536c7f65862e08a9b143138ea9 upstream.
Sjoerd Simons reports that, without using position_fix=1, recording experiences overruns. Work around that by applying the LPIB quirk for his hardware.
--- sound/pci/hda/hda_intel.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
sound/pci/hda/hda_intel.c +1 -0
@@ -2267,6 +2267,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {SND_PCI_QUIRK (0x1028 ,0x01cc ,"Dell D820" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1028 ,0x01de ,"Dell Precision 390" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1028 ,0x01f6 ,"Dell Latitude 131L" ,POS_FIX_LPIB ), +SND_PCI_QUIRK (0x1028 ,0x0470 ,"Dell Inspiron 1120" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x103c ,0x306d ,"HP dv3" ,POS_FIX_LPIB ),SND_PCI_QUIRK (0x1043 ,0x813d ,"ASUS P5AD2" ,POS_FIX_LPIB ), SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
Signature · 1 line
1.7.4.4
PATCH 194/209 block: Deprecate QUEUE_FLAG_CLUSTER and use queue_limits instead
In reply to Paul GortmakerFrom: Martin K. Petersen <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit e692cb668fdd5a712c6ed2a2d6f2a36ee83997b4 upstream.
When stacking devices, a request_queue is not always available. This forced us to have a no_cluster flag in the queue_limits that could be used as a carrier until the request_queue had been set up for a metadevice.
There were several problems with that approach. First of all it was up to the stacking device to remember to set queue flag after stacking had completed. Also, the queue flag and the queue limits had to be kept in sync at all times. We got that wrong, which could lead to us issuing commands that went beyond the max scatterlist limit set by the driver.
The proper fix is to avoid having two flags for tracking the same thing. We deprecate QUEUE_FLAG_CLUSTER and use the queue limit directly in the block layer merging functions. The queue_limit 'no_cluster' is turned into 'cluster' to avoid double negatives and to ease stacking. Clustering defaults to being enabled as before. The queue flag logic is removed from the stacking function, and explicitly setting the cluster flag is no longer necessary in DM and MD.
--- block/blk-merge.c | 6 +++--- block/blk-settings.c | 25 ++----------------------- block/blk-sysfs.c | 2 +- drivers/md/dm-table.c | 5 ----- drivers/md/md.c | 3 --- drivers/scsi/scsi_lib.c | 3 +-- include/linux/blkdev.h | 9 ++++++--- 7 files changed, 13 insertions(+), 40 deletions(-)
block/blk-merge.c +3 -3
@@ -22,7 +22,7 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q,return 0 ; fbio = bio; - cluster =test_bit (QUEUE_FLAG_CLUSTER , &q->queue_flags); + cluster =blk_queue_cluster (q); seg_size =0 ; phys_size = nr_phys_segs =0 ;for_each_bio (bio) {
@@ -88,7 +88,7 @@ EXPORT_SYMBOL(blk_recount_segments);static int blk_phys_contig_segment (struct request_queue *q,struct bio *bio,struct bio *nxt) { -if (!test_bit (QUEUE_FLAG_CLUSTER , &q->queue_flags)) +if (!blk_queue_cluster (q))return 0 ; if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
@@ -124,7 +124,7 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,int nsegs, cluster; nsegs =0 ; - cluster =test_bit (QUEUE_FLAG_CLUSTER , &q->queue_flags); + cluster =blk_queue_cluster (q);/* * for each bio in rq
block/blk-settings.c +2 -23
@@ -108,7 +108,7 @@ void blk_set_default_limits(struct queue_limits *lim) lim->alignment_offset =0 ; lim->io_opt =0 ; lim->misaligned =0 ; - lim->no_cluster =0 ; + lim->cluster =1 ; }EXPORT_SYMBOL (blk_set_default_limits);
@@ -451,15 +451,6 @@ EXPORT_SYMBOL(blk_queue_io_opt);void blk_queue_stack_limits (struct request_queue *t,struct request_queue *b) {blk_stack_limits (&t->limits, &b->limits,0 ); - -if (!t->queue_lock) -WARN_ON_ONCE (1 ); -else if (!test_bit (QUEUE_FLAG_CLUSTER , &b->queue_flags)) { -unsigned long flags; -spin_lock_irqsave (t->queue_lock, flags); -queue_flag_clear (QUEUE_FLAG_CLUSTER , t); -spin_unlock_irqrestore (t->queue_lock, flags); - } }EXPORT_SYMBOL (blk_queue_stack_limits);
@@ -530,7 +521,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, t->io_min =max (t->io_min, b->io_min); t->io_opt =lcm (t->io_opt, b->io_opt); - t->no_cluster |= b->no_cluster; + t->cluster &= b->cluster; t->discard_zeroes_data &= b->discard_zeroes_data;/* Physical block size a multiple of the logical block size? */
@@ -626,7 +617,6 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, sector_t offset) {struct request_queue *t = disk->queue; -struct request_queue *b =bdev_get_queue (bdev);if (bdev_stack_limits (&t->limits, bdev, offset >>9 ) <0 ) {char top[BDEVNAME_SIZE ], bottom[BDEVNAME_SIZE ];
@@ -637,17 +627,6 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,printk (KERN_NOTICE "%s: Warning: Device %s is misaligned\n" , top, bottom); } - -if (!t->queue_lock) -WARN_ON_ONCE (1 ); -else if (!test_bit (QUEUE_FLAG_CLUSTER , &b->queue_flags)) { -unsigned long flags; - -spin_lock_irqsave (t->queue_lock, flags); -if (!test_bit (QUEUE_FLAG_CLUSTER , &b->queue_flags)) -queue_flag_clear (QUEUE_FLAG_CLUSTER , t); -spin_unlock_irqrestore (t->queue_lock, flags); - } }EXPORT_SYMBOL (disk_stack_limits);
block/blk-sysfs.c +1 -1
@@ -114,7 +114,7 @@ static ssize_t queue_max_segments_show(struct request_queue *q, char *page)static ssize_t queue_max_segment_size_show (struct request_queue *q,char *page) { -if (test_bit (QUEUE_FLAG_CLUSTER , &q->queue_flags)) +if (blk_queue_cluster (q))return queue_var_show (queue_max_segment_size (q), (page));return queue_var_show (PAGE_CACHE_SIZE , (page));
drivers/md/dm-table.c +0 -5
@@ -1081,11 +1081,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,*/ q->limits = *limits; -if (limits->no_cluster) -queue_flag_clear_unlocked (QUEUE_FLAG_CLUSTER , q); -else -queue_flag_set_unlocked (QUEUE_FLAG_CLUSTER , q); -dm_table_set_integrity (t);/*
drivers/md/md.c +0 -3
@@ -4185,9 +4185,6 @@ static int md_alloc(dev_t dev, char *name) goto abort; mddev->queue->queuedata = mddev; -/* Can be unlocked because the queue is new: no concurrency */ -queue_flag_set_unlocked (QUEUE_FLAG_CLUSTER , mddev->queue); -blk_queue_make_request (mddev->queue, md_make_request); disk =alloc_disk (1 << shift);
drivers/scsi/scsi_lib.c +1 -2
@@ -1640,9 +1640,8 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost,blk_queue_max_segment_size (q,dma_get_max_seg_size (dev)); -/* New queue, no concurrency on queue_flags */ if (!shost->use_clustering) -queue_flag_clear_unlocked (QUEUE_FLAG_CLUSTER , q); + q->limits.cluster =0 ;/* * set a reasonable default alignment on word boundaries: the
include/linux/blkdev.h +6 -3
@@ -321,7 +321,7 @@ struct queue_limits {unsigned char misaligned;unsigned char discard_misaligned; -unsigned char no_cluster; +unsigned char cluster;signed char discard_zeroes_data; };
@@ -444,7 +444,6 @@ struct request_queue#endif }; -#define QUEUE_FLAG_CLUSTER 0/* cluster several segments into 1 */ #define QUEUE_FLAG_QUEUED 1/* uses generic tag queueing */ #define QUEUE_FLAG_STOPPED 2/* queue is stopped */ #define QUEUE_FLAG_SYNCFULL 3/* read queue has been filled */
@@ -465,7 +464,6 @@ struct request_queue#define QUEUE_FLAG_NOXMERGES 17/* No extended merges */ #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ - (1 << QUEUE_FLAG_CLUSTER) | \ (1 << QUEUE_FLAG_STACKABLE) | \ (1 << QUEUE_FLAG_SAME_COMP))
@@ -632,6 +630,11 @@ enum {#define rq_data_dir (rq) ((rq)->cmd_flags & 1) +static inline unsigned int blk_queue_cluster (struct request_queue *q) +{ +return q->limits.cluster; +} +/* * We regard a request as sync, if either a read or a sync write */
Signature · 1 line
1.7.4.4
PATCH 195/209 posix-cpu-timers: workaround to suppress the problems with mt exec
In reply to Paul GortmakerFrom: Oleg Nesterov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit e0a70217107e6f9844628120412cb27bb4cea194 upstream.
posix-cpu-timers.c correctly assumes that the dying process does posix_cpu_timers_exit_group() and removes all !CPUCLOCK_PERTHREAD timers from signal->cpu_timers list.
But, it also assumes that timer->it.cpu.task is always the group leader, and thus the dead ->task means the dead thread group.
This is obviously not true after de_thread() changes the leader. After that almost every posix_cpu_timer_ method has problems.
It is not simple to fix this bug correctly. First of all, I think that timer->it.cpu should use struct pid instead of task_struct. Also, the locking should be reworked completely. In particular, tasklist_lock should not be used at all. This all needs a lot of nontrivial and hard-to-test changes.
Change __exit_signal() to do posix_cpu_timers_exit_group() when the old leader dies during exec. This is not the fix, just the temporary hack to hide the problem for 2.6.37 and stable. IOW, this is obviously wrong but this is what we currently have anyway:
cpu timers do not work after mt exec.
In theory this change adds another race. The exiting leader can detach the timers which were attached to the new leader. However, the window between de_thread() and release_task() is small, we can pretend that sys_timer_create() was called before de_thread().
--- kernel/exit.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
kernel/exit.c +8 -0
@@ -95,6 +95,14 @@ static void __exit_signal(struct task_struct *tsk)posix_cpu_timers_exit_group (tsk); else {/* +* This can only happen if the caller is de_thread(). +* FIXME: this is the temporary hack, we should teach +* posix-cpu-timers to handle this case correctly. +*/ +if (unlikely (has_group_leader_pid (tsk))) +posix_cpu_timers_exit_group (tsk); + +/* * If there is any task waiting for the group exit * then notify it: */
Signature · 1 line
1.7.4.4
PATCH 196/209 md: fix regression with re-adding devices to arrays with no metadata
In reply to Paul GortmakerFrom: NeilBrown <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit bf572541ab44240163eaa2d486b06f306a31d45a upstream.
Commit 1a855a0606 (2.6.37-rc4) fixed a problem where devices were re-added when they shouldn't be but caused a regression in a less common case that means sometimes devices cannot be re-added when they should be.
In particular, when re-adding a device to an array without metadata we should always access the device, but after the above commit we didn't.
This patch sets the In_sync flag in that case so that the re-add succeeds.
This patch is suitable for any -stable kernel to which 1a855a0606 was applied.
--- drivers/md/md.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/md/md.c +3 -2
@@ -5008,9 +5008,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)/* set saved_raid_disk if appropriate */ if (!mddev->persistent) {if (info->state & (1 <<MD_DISK_SYNC ) && - info->raid_disk < mddev->raid_disks) + info->raid_disk < mddev->raid_disks) { rdev->raid_disk = info->raid_disk; -else +set_bit (In_sync, &rdev->flags); + }else rdev->raid_disk =-1 ; }else super_types[mddev->major_version].
Signature · 1 line
1.7.4.4
PATCH 197/209 av7110: check for negative array offset
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit cb26a24ee9706473f31d34cc259f4dcf45cd0644 upstream
info->num comes from the user. It's type int. If the user passes in a negative value that would cause memory corruption.
--- drivers/media/dvb/ttpci/av7110_ca.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/dvb/ttpci/av7110_ca.c +1 -1
@@ -278,7 +278,7 @@ static int dvb_ca_ioctl(struct inode *inode, struct file *file, {ca_slot_info_t *info=(ca_slot_info_t *)parg; -if (info->num >1 ) +if (info->num <0 || info->num >1 )return -EINVAL ; av7110->ci_slot[info->num].num = info->num; av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
Signature · 1 line
1.7.4.4
PATCH 198/209 x25: Do not reference freed memory.
In reply to Paul GortmakerFrom: David S. Miller <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 96642d42f076101ba98866363d908cab706d156c upstream.
In x25_link_free(), we destroy 'nb' before dereferencing 'nb->dev'. Don't do this, because 'nb' might be freed by then.
--- net/x25/x25_link.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
net/x25/x25_link.c +4 -1
@@ -392,9 +392,12 @@ void __exit x25_link_free(void)write_lock_bh (&x25_neigh_list_lock);list_for_each_safe (entry, tmp, &x25_neigh_list) { +struct net_device *dev; + nb = list_entry(entry, struct x25_neigh, node); + dev = nb->dev;__x25_remove_neigh (nb); -dev_put (nb->dev); +dev_put (dev); }write_unlock_bh (&x25_neigh_list_lock); }
Signature · 1 line
1.7.4.4
PATCH 199/209 drm: fix unsigned vs signed comparison issue in modeset ctl ioctl.
In reply to Paul GortmakerFrom: Dave Airlie <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 1922756124ddd53846877416d92ba4a802bc658f upstream.
This fixes CVE-2011-1013.
--- drivers/gpu/drm/drm_irq.c | 3 ++- include/drm/drmP.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_irq.c +2 -1
@@ -545,7 +545,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_modeset_ctl *modeset = data; -int crtc, ret =0 ; +int ret =0 ; +unsigned int crtc;/* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs)
include/drm/drmP.h +1 -1
@@ -1022,7 +1022,7 @@ struct drm_device {struct pci_controller *hose;#endif struct drm_sg_mem *sg;/**< Scatter gather memory */ -int num_crtcs;/**< Number of CRTCs on this device */ +unsigned int num_crtcs;/**< Number of CRTCs on this device */ void *dev_private;/**< device private data */ void *mm_private;struct address_space *dev_mapping;
Signature · 1 line
1.7.4.4
PATCH 200/209 net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 8909c9ad8ff03611c9c96c9a92656213e4bb495b upstream.
Since a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c any process with CAP_NET_ADMIN may load any module from /lib/modules/. This doesn't mean that CAP_NET_ADMIN is a superset of CAP_SYS_MODULE as modules are limited to /lib/modules/**. However, CAP_NET_ADMIN capability shouldn't allow anybody load any module not related to networking.
This patch restricts an ability of autoloading modules to netdev modules with explicit aliases. This fixes CVE-2011-1019.
Arnd Bergmann suggested to leave untouched the old pre-v2.6.32 behavior of loading netdev modules by name (without any prefix) for processes with CAP_SYS_MODULE to maintain the compatibility with network scripts that use autoloading netdev modules by aliases like "eth0", "wlan0".
Currently there are only three users of the feature in the upstream
kernel: ipip, ip_gre and sit.
root@albatros:~# capsh --drop=$(seq -s, 0 11),$(seq -s, 13 34) --
root@albatros:~# grep Cap /proc/$$/status
CapInh: 0000000000000000
CapPrm: fffffff800001000
CapEff: fffffff800001000
CapBnd: fffffff800001000
root@albatros:~# modprobe xfs
FATAL: Error inserting xfs
(/lib/modules/2.6.38-rc6-00001-g2bf4ca3/kernel/fs/xfs/xfs.ko): Operation not permitted
root@albatros:~# lsmod | grep xfs
root@albatros:~# ifconfig xfs
xfs: error fetching interface information: Device not found
root@albatros:~# lsmod | grep xfs
root@albatros:~# lsmod | grep sit
root@albatros:~# ifconfig sit
sit: error fetching interface information: Device not found
root@albatros:~# lsmod | grep sit
root@albatros:~# ifconfig sit0
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1 root@albatros:~# lsmod | grep sit
sit 10457 0
tunnel4 2957 1 sitFor CAP_SYS_MODULE module loading is still relaxed:
root@albatros:~# grep Cap /proc/$$/status
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
root@albatros:~# ifconfig xfs
xfs: error fetching interface information: Device not found
root@albatros:~# lsmod | grep xfs
xfs 745319 0Reference: https://lkml.org/lkml/2011/2/24/203
[PG: in 2.6.34, the bare MODULE_ALIAS for ipip/tunl0 and ip_gre/gre0 didn't exist, but this adds the limited scope MODULE_ALIAS_NETDEV ones]
--- include/linux/netdevice.h | 3 +++ net/core/dev.c | 12 ++++++++++-- net/ipv4/ip_gre.c | 1 + net/ipv4/ipip.c | 1 + net/ipv6/sit.c | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-)
include/linux/netdevice.h +3 -0
@@ -2214,6 +2214,9 @@ do { \ #define netif_info(priv, type, dev, fmt, args...) \ netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) +#define MODULE_ALIAS_NETDEV (device) \ + MODULE_ALIAS("netdev-" device) +#if defined(DEBUG ) #define netif_dbg(priv, type, dev, format, args...) \ netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
net/core/dev.c +10 -2
@@ -1104,13 +1104,21 @@ EXPORT_SYMBOL(netdev_bonding_change);void dev_load (struct net *net,const char *name) {struct net_device *dev; +int no_module;rcu_read_lock (); dev =dev_get_by_name_rcu (net, name);rcu_read_unlock (); -if (!dev &&capable (CAP_NET_ADMIN )) -request_module ("%s" , name); + no_module = !dev; +if (no_module &&capable (CAP_NET_ADMIN )) + no_module =request_module ("netdev-%s" , name); +if (no_module &&capable (CAP_SYS_MODULE )) { +if (!request_module ("%s" , name)) +pr_err ("Loading kernel module for a network device " +"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s " +"instead\n" , name); + } }EXPORT_SYMBOL (dev_load);
net/ipv4/ip_gre.c +1 -0
@@ -1709,3 +1709,4 @@ module_exit(ipgre_fini);MODULE_LICENSE ("GPL" );MODULE_ALIAS_RTNL_LINK ("gre" );MODULE_ALIAS_RTNL_LINK ("gretap" ); +MODULE_ALIAS_NETDEV ("gre0" );
net/ipv4/ipip.c +1 -0
@@ -853,3 +853,4 @@ static void __exit ipip_fini(void)module_init (ipip_init);module_exit (ipip_fini);MODULE_LICENSE ("GPL" ); +MODULE_ALIAS_NETDEV ("tunl0" );
net/ipv6/sit.c +1 -1
@@ -1241,4 +1241,4 @@ static int __init sit_init(void)module_init (sit_init);module_exit (sit_cleanup);MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("sit0" ); +MODULE_ALIAS_NETDEV ("sit0" );
Signature · 1 line
1.7.4.4
PATCH 201/209 ip6ip6: autoload ip6 tunnel
In reply to Paul GortmakerFrom: stephen hemminger <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 6dfbd87a20a737641ef228230c77f4262434fa24 upstream.
Add necessary alias to autoload ip6ip6 tunnel module.
--- net/ipv6/ip6_tunnel.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/ipv6/ip6_tunnel.c +1 -0
@@ -57,6 +57,7 @@MODULE_AUTHOR ("Ville Nuorvala" );MODULE_DESCRIPTION ("IPv6 tunneling device" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS_NETDEV ("ip6tnl0" );#define IPV6_TLV_TEL_DST_SIZE 8
Signature · 1 line
1.7.4.4
PATCH 202/209 hwmon: (w83627ehf) Fix max_output and step_output readings
In reply to Paul GortmakerFrom: Guenter Roeck <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
[extraction from commit da2e025590cf7038440132d4bbc967a579b11112 upstream]
The value of max_output and step_output registers isn't read from the respective registers. As a result, zero values are returned to the user through the respective sysfs attributes, instead of the actual fan control settings.
The problem is fixed by updating the fan max output and fan step output information from data in registers.
--- drivers/hwmon/w83627ehf.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
drivers/hwmon/w83627ehf.c +12 -1
@@ -524,7 +524,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) } } -for (i =0 ; i <4 ; i++) { +for (i =0 ; i < data->pwm_num; i++) {/* pwmcfg, tolerance mapped for i=0, i=1 to same reg */ if (i !=1 ) { pwmcfg = w83627ehf_read_value(data,
@@ -546,6 +546,17 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) W83627EHF_REG_FAN_STOP_OUTPUT[i]); data->fan_stop_time[i] =w83627ehf_read_value (data,W83627EHF_REG_FAN_STOP_TIME [i]); + +if (W83627EHF_REG_FAN_MAX_OUTPUT [i] !=0xff ) + data->fan_max_output[i] = +w83627ehf_read_value (data, +W83627EHF_REG_FAN_MAX_OUTPUT [i]); + +if (W83627EHF_REG_FAN_STEP_OUTPUT [i] !=0xff ) + data->fan_step_output[i] = +w83627ehf_read_value (data, +W83627EHF_REG_FAN_STEP_OUTPUT [i]); + data->target_temp[i] =w83627ehf_read_value (data, W83627EHF_REG_TARGET[i]) &
Signature · 1 line
1.7.4.4
PATCH 203/209 sunrpc/cache: fix module refcnt leak in a failure path
In reply to Paul GortmakerFrom: Li Zefan <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit a5990ea1254cd186b38744507aeec3136a0c1c95 upstream
Don't forget to release the module refcnt if seq_open() returns failure.
--- net/sunrpc/cache.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
net/sunrpc/cache.c +3 -1
@@ -1233,8 +1233,10 @@ static int content_open(struct inode *inode, struct file *file,if (!cd || !try_module_get (cd->owner))return -EACCES ; han =__seq_open_private (file, &cache_content_op,sizeof (*han)); -if (han ==NULL ) +if (han ==NULL ) { +module_put (cd->owner);return -ENOMEM ; + } han->cd = cd;return 0 ;
Signature · 1 line
1.7.4.4
PATCH 204/209 sctp: Fix out-of-bounds reading in sctp_asoc_get_hmac()
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 51e97a12bef19b7e43199fc153cf9bd5f2140362 upstream
The sctp_asoc_get_hmac() function iterates through a peer's hmac_ids array and attempts to ensure that only a supported hmac entry is returned. The current code fails to do this properly - if the last id in the array is out of range (greater than SCTP_AUTH_HMAC_ID_MAX), the id integer remains set after exiting the loop, and the address of an out-of-bounds entry will be returned and subsequently used in the parent function, causing potentially ugly memory corruption. This patch resets the id integer to 0 on encountering an invalid id so that NULL will be returned after finishing the loop if no valid ids are found.
--- net/sctp/auth.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
net/sctp/auth.c +6 -2
@@ -543,16 +543,20 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc) id =ntohs (hmacs->hmac_ids[i]);/* Check the id is in the supported range */ -if (id >SCTP_AUTH_HMAC_ID_MAX ) +if (id >SCTP_AUTH_HMAC_ID_MAX ) { + id =0 ;continue ; + }/* See is we support the id. Supported IDs have name and * length fields set, so that we can allocated and use * them. We can safely just check for name, for without the * name, we can't allocate the TFM. */ -if (!sctp_hmac_list[id].hmac_name) +if (!sctp_hmac_list[id].hmac_name) { + id =0 ;continue ; + }break ; }
Signature · 1 line
1.7.4.4
PATCH 205/209 block: check for proper length of iov entries earlier in blk_rq_map_user_iov()
In reply to Paul GortmakerFrom: Xiaotian Feng <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 5478755616ae2ef1ce144dded589b62b2a50d575 upstream.
commit 9284bcf checks for proper length of iov entries in blk_rq_map_user_iov(). But if the map is unaligned, kernel will break out the loop without checking for the proper length. So we need to check the proper length before the unalign check.
--- block/blk-map.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
block/blk-map.c +3 -2
@@ -201,12 +201,13 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,for (i =0 ; i < iov_count; i++) {unsigned long uaddr = (unsigned long )iov[i].iov_base; +if (!iov[i].iov_len) +return -EINVAL ; +if (uaddr &queue_dma_alignment (q)) { unaligned =1 ;break ; } -if (!iov[i].iov_len) -return -EINVAL ; }if (unaligned || (q->dma_pad_mask & len) || map_data)
Signature · 1 line
1.7.4.4
PATCH 206/209 ALSA: caiaq - Fix possible string-buffer overflow
In reply to Paul GortmakerFrom: Takashi Iwai <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit eaae55dac6b64c0616046436b294e69fc5311581 upstream
Use strlcpy() to assure not to overflow the string array sizes by too long USB device name string.
--- sound/usb/caiaq/audio.c | 2 +- sound/usb/caiaq/midi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/caiaq/audio.c +1 -1
@@ -640,7 +640,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) } dev->pcm->private_data = dev; -strcpy (dev->pcm->name, dev->product_name); +strlcpy (dev->pcm->name, dev->product_name,sizeof (dev->pcm->name));memset (dev->sub_playback,0 ,sizeof (dev->sub_playback));memset (dev->sub_capture,0 ,sizeof (dev->sub_capture));
sound/usb/caiaq/midi.c +1 -1
@@ -136,7 +136,7 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)if (ret <0 )return ret; -strcpy (rmidi->name, device->product_name); +strlcpy (rmidi->name, device->product_name,sizeof (rmidi->name)); rmidi->info_flags =SNDRV_RAWMIDI_INFO_DUPLEX ; rmidi->private_data = device;
Signature · 1 line
1.7.4.4
PATCH 207/209 Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code
In reply to Paul GortmakerFrom: Julien Tinnes <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit da48524eb20662618854bb3df2db01fc65f3070c upstream.
Userland should be able to trust the pid and uid of the sender of a signal if the si_code is SI_TKILL.
Unfortunately, the kernel has historically allowed sigqueueinfo() to send any si_code at all (as long as it was negative - to distinguish it from kernel-generated signals like SIGILL etc), so it could spoof a SI_TKILL with incorrect siginfo values.
Happily, it looks like glibc has always set si_code to the appropriate SI_QUEUE, so there are probably no actual user code that ever uses anything but the appropriate SI_QUEUE flag.
So just tighten the check for si_code (we used to allow any negative value), and add a (one-time) warning in case there are binaries out there that might depend on using other si_code values.
--- kernel/signal.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
kernel/signal.c +12 -4
@@ -2409,9 +2409,13 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,return -EFAULT ;/* Not even root can pretend to send signals from the kernel. -Nor can they impersonate a kill(), which adds source info. */ -if (info.si_code >=0 ) +* Nor can they impersonate a kill()/tgkill(), which adds source info. +*/ +if (info.si_code !=SI_QUEUE ) { +/* We used to allow any < 0 si_code */ +WARN_ON_ONCE (info.si_code <0 );return -EPERM ; + } info.si_signo = sig;/* POSIX.1b doesn't mention process groups. */
@@ -2425,9 +2429,13 @@ long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)return -EINVAL ;/* Not even root can pretend to send signals from the kernel. -Nor can they impersonate a kill(), which adds source info. */ -if (info->si_code >=0 ) +* Nor can they impersonate a kill()/tgkill(), which adds source info. +*/ +if (info->si_code !=SI_QUEUE ) { +/* We used to allow any < 0 si_code */ +WARN_ON_ONCE (info->si_code <0 );return -EPERM ; + } info->si_signo = sig;return do_send_specific (tgid, pid, sig, info);
Signature · 1 line
1.7.4.4
PATCH 208/209 Relax si_code check in rt_sigqueueinfo and rt_tgsigqueueinfo
In reply to Paul GortmakerFrom: Roland Dreier <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit 243b422af9ea9af4ead07a8ad54c90d4f9b6081a upstream.
Commit da48524eb206 ("Prevent rt_sigqueueinfo and rt_tgsigqueueinfo from spoofing the signal code") made the check on si_code too strict. There are several legitimate places where glibc wants to queue a negative si_code different from SI_QUEUE:
- This was first noticed with glibc's aio implementation, which wants to queue a signal with si_code SI_ASYNCIO; the current kernel causes glibc's tst-aio4 test to fail because rt_sigqueueinfo() fails with EPERM.
- Further examination of the glibc source shows that getaddrinfo_a() wants to use SI_ASYNCNL (which the kernel does not even define). The timer_create() fallback code wants to queue signals with SI_TIMER.
As suggested by Oleg Nesterov <[email protected]>, loosen the check to forbid only the problematic SI_TKILL case.
--- kernel/signal.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/signal.c +2 -2
@@ -2411,7 +2411,7 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,/* Not even root can pretend to send signals from the kernel. * Nor can they impersonate a kill()/tgkill(), which adds source info. */ -if (info.si_code !=SI_QUEUE ) { +if (info.si_code >=0 || info.si_code ==SI_TKILL ) {/* We used to allow any < 0 si_code */ WARN_ON_ONCE (info.si_code <0 );return -EPERM ;
@@ -2431,7 +2431,7 @@ long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)/* Not even root can pretend to send signals from the kernel. * Nor can they impersonate a kill()/tgkill(), which adds source info. */ -if (info->si_code !=SI_QUEUE ) { +if (info->si_code >=0 || info->si_code ==SI_TKILL ) {/* We used to allow any < 0 si_code */ WARN_ON_ONCE (info->si_code <0 );return -EPERM ;
Signature · 1 line
1.7.4.4
PATCH 209/209 niu: Fix kernel buffer overflow for ETHTOOL_GRXCLSRLALL
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
=====================================================================
| This is a commit scheduled for the next v2.6.34 longterm release. | | If you see a problem with using this for longterm, please comment.|
=====================================================================
commit ee9c5cfad29c8a13199962614b9b16f1c4137ac9 upstream.
niu_get_ethtool_tcam_all() assumes that its output buffer is the right size, and warns before returning if it is not. However, the output buffer size is under user control and ETHTOOL_GRXCLSRLALL is an unprivileged ethtool command. Therefore this is at least a local denial-of-service vulnerability.
Change it to check before writing each entry and to return an error if the buffer is already full.
Compile-tested only.
--- drivers/net/niu.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
drivers/net/niu.c +6 -10
@@ -7263,32 +7263,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np,struct niu_parent *parent = np->parent;struct niu_tcam_entry *tp;int i, idx, cnt; -u16 n_entries;unsigned long flags; - +int ret =0 ;/* put the tcam size here */ nfc->data =tcam_get_size (np);niu_lock_parent (np, flags); - n_entries = nfc->rule_cnt;for (cnt =0 , i =0 ; i < nfc->data; i++) { idx =tcam_get_index (np, i); tp = &parent->tcam[idx];if (!tp->valid)continue ; +if (cnt == nfc->rule_cnt) { + ret = -EMSGSIZE ; +break ; + } rule_locs[cnt] = i; cnt++; }niu_unlock_parent (np, flags); -if (n_entries != cnt) { -/* print warning, this should not happen */ -netdev_info (np->dev,"niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n" , - np->parent->index, __func__, n_entries, cnt); - } - -return 0 ; +return ret; } static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
Signature · 1 line
1.7.4.4