Contents of /trunk/kernel-alx/patches-3.4/0114-3.4.15-all-fixes.patch
Parent Directory | Revision Log
Revision 1946 -
(show annotations)
(download)
Wed Nov 14 15:25:09 2012 UTC (11 years, 10 months ago) by niro
File size: 81054 byte(s)
Wed Nov 14 15:25:09 2012 UTC (11 years, 10 months ago) by niro
File size: 81054 byte(s)
3.4.18-alx-r1
1 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig |
2 | index 352322a..e14ae11 100644 |
3 | --- a/arch/arm/Kconfig |
4 | +++ b/arch/arm/Kconfig |
5 | @@ -1405,6 +1405,16 @@ config PL310_ERRATA_769419 |
6 | on systems with an outer cache, the store buffer is drained |
7 | explicitly. |
8 | |
9 | +config ARM_ERRATA_775420 |
10 | + bool "ARM errata: A data cache maintenance operation which aborts, might lead to deadlock" |
11 | + depends on CPU_V7 |
12 | + help |
13 | + This option enables the workaround for the 775420 Cortex-A9 (r2p2, |
14 | + r2p6,r2p8,r2p10,r3p0) erratum. In case a date cache maintenance |
15 | + operation aborts with MMU exception, it might cause the processor |
16 | + to deadlock. This workaround puts DSB before executing ISB if |
17 | + an abort may occur on cache maintenance. |
18 | + |
19 | endmenu |
20 | |
21 | source "arch/arm/common/Kconfig" |
22 | diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h |
23 | index 3d5fc41..bf53047 100644 |
24 | --- a/arch/arm/include/asm/vfpmacros.h |
25 | +++ b/arch/arm/include/asm/vfpmacros.h |
26 | @@ -28,7 +28,7 @@ |
27 | ldr \tmp, =elf_hwcap @ may not have MVFR regs |
28 | ldr \tmp, [\tmp, #0] |
29 | tst \tmp, #HWCAP_VFPv3D16 |
30 | - ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} |
31 | + ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} |
32 | addne \base, \base, #32*4 @ step over unused register space |
33 | #else |
34 | VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 |
35 | @@ -52,7 +52,7 @@ |
36 | ldr \tmp, =elf_hwcap @ may not have MVFR regs |
37 | ldr \tmp, [\tmp, #0] |
38 | tst \tmp, #HWCAP_VFPv3D16 |
39 | - stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} |
40 | + stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} |
41 | addne \base, \base, #32*4 @ step over unused register space |
42 | #else |
43 | VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 |
44 | diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S |
45 | index a655d3d..82ab2c5 100644 |
46 | --- a/arch/arm/mm/cache-v7.S |
47 | +++ b/arch/arm/mm/cache-v7.S |
48 | @@ -211,6 +211,9 @@ ENTRY(v7_coherent_user_range) |
49 | * isn't mapped, just try the next page. |
50 | */ |
51 | 9001: |
52 | +#ifdef CONFIG_ARM_ERRATA_775420 |
53 | + dsb |
54 | +#endif |
55 | mov r12, r12, lsr #12 |
56 | mov r12, r12, lsl #12 |
57 | add r12, r12, #4096 |
58 | diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c |
59 | index f4546e9..23817a6 100644 |
60 | --- a/arch/mips/kernel/kgdb.c |
61 | +++ b/arch/mips/kernel/kgdb.c |
62 | @@ -283,6 +283,15 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd, |
63 | struct pt_regs *regs = args->regs; |
64 | int trap = (regs->cp0_cause & 0x7c) >> 2; |
65 | |
66 | +#ifdef CONFIG_KPROBES |
67 | + /* |
68 | + * Return immediately if the kprobes fault notifier has set |
69 | + * DIE_PAGE_FAULT. |
70 | + */ |
71 | + if (cmd == DIE_PAGE_FAULT) |
72 | + return NOTIFY_DONE; |
73 | +#endif /* CONFIG_KPROBES */ |
74 | + |
75 | /* Userspace events, ignore. */ |
76 | if (user_mode(regs)) |
77 | return NOTIFY_DONE; |
78 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
79 | index 40edfc3..5910054 100644 |
80 | --- a/arch/x86/xen/enlighten.c |
81 | +++ b/arch/x86/xen/enlighten.c |
82 | @@ -942,7 +942,16 @@ static void xen_write_cr4(unsigned long cr4) |
83 | |
84 | native_write_cr4(cr4); |
85 | } |
86 | - |
87 | +#ifdef CONFIG_X86_64 |
88 | +static inline unsigned long xen_read_cr8(void) |
89 | +{ |
90 | + return 0; |
91 | +} |
92 | +static inline void xen_write_cr8(unsigned long val) |
93 | +{ |
94 | + BUG_ON(val); |
95 | +} |
96 | +#endif |
97 | static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) |
98 | { |
99 | int ret; |
100 | @@ -1111,6 +1120,11 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { |
101 | .read_cr4_safe = native_read_cr4_safe, |
102 | .write_cr4 = xen_write_cr4, |
103 | |
104 | +#ifdef CONFIG_X86_64 |
105 | + .read_cr8 = xen_read_cr8, |
106 | + .write_cr8 = xen_write_cr8, |
107 | +#endif |
108 | + |
109 | .wbinvd = native_wbinvd, |
110 | |
111 | .read_msr = native_read_msr_safe, |
112 | @@ -1121,6 +1135,8 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = { |
113 | .read_tsc = native_read_tsc, |
114 | .read_pmc = native_read_pmc, |
115 | |
116 | + .read_tscp = native_read_tscp, |
117 | + |
118 | .iret = xen_iret, |
119 | .irq_enable_sysexit = xen_sysexit, |
120 | #ifdef CONFIG_X86_64 |
121 | diff --git a/block/blk-core.c b/block/blk-core.c |
122 | index 1f61b74..85fd410 100644 |
123 | --- a/block/blk-core.c |
124 | +++ b/block/blk-core.c |
125 | @@ -601,7 +601,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, |
126 | q->request_fn = rfn; |
127 | q->prep_rq_fn = NULL; |
128 | q->unprep_rq_fn = NULL; |
129 | - q->queue_flags = QUEUE_FLAG_DEFAULT; |
130 | + q->queue_flags |= QUEUE_FLAG_DEFAULT; |
131 | |
132 | /* Override internal queue lock with supplied lock pointer */ |
133 | if (lock) |
134 | diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c |
135 | index 7edaccc..a51df96 100644 |
136 | --- a/drivers/acpi/ec.c |
137 | +++ b/drivers/acpi/ec.c |
138 | @@ -71,9 +71,6 @@ enum ec_command { |
139 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
140 | #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ |
141 | |
142 | -#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts |
143 | - per one transaction */ |
144 | - |
145 | enum { |
146 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
147 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ |
148 | @@ -87,6 +84,15 @@ static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; |
149 | module_param(ec_delay, uint, 0644); |
150 | MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes"); |
151 | |
152 | +/* |
153 | + * If the number of false interrupts per one transaction exceeds |
154 | + * this threshold, will think there is a GPE storm happened and |
155 | + * will disable the GPE for normal transaction. |
156 | + */ |
157 | +static unsigned int ec_storm_threshold __read_mostly = 8; |
158 | +module_param(ec_storm_threshold, uint, 0644); |
159 | +MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm"); |
160 | + |
161 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
162 | /* External interfaces use first EC only, so remember */ |
163 | typedef int (*acpi_ec_query_func) (void *data); |
164 | @@ -319,7 +325,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) |
165 | msleep(1); |
166 | /* It is safe to enable the GPE outside of the transaction. */ |
167 | acpi_enable_gpe(NULL, ec->gpe); |
168 | - } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { |
169 | + } else if (t->irq_count > ec_storm_threshold) { |
170 | pr_info(PREFIX "GPE storm detected, " |
171 | "transactions will use polling mode\n"); |
172 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); |
173 | @@ -924,6 +930,17 @@ static int ec_flag_msi(const struct dmi_system_id *id) |
174 | return 0; |
175 | } |
176 | |
177 | +/* |
178 | + * Clevo M720 notebook actually works ok with IRQ mode, if we lifted |
179 | + * the GPE storm threshold back to 20 |
180 | + */ |
181 | +static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) |
182 | +{ |
183 | + pr_debug("Setting the EC GPE storm threshold to 20\n"); |
184 | + ec_storm_threshold = 20; |
185 | + return 0; |
186 | +} |
187 | + |
188 | static struct dmi_system_id __initdata ec_dmi_table[] = { |
189 | { |
190 | ec_skip_dsdt_scan, "Compal JFL92", { |
191 | @@ -955,10 +972,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { |
192 | { |
193 | ec_validate_ecdt, "ASUS hardware", { |
194 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL}, |
195 | + { |
196 | + ec_enlarge_storm_threshold, "CLEVO hardware", { |
197 | + DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."), |
198 | + DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL}, |
199 | {}, |
200 | }; |
201 | |
202 | - |
203 | int __init acpi_ec_ecdt_probe(void) |
204 | { |
205 | acpi_status status; |
206 | diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c |
207 | index 08427ab..27f8ddf 100644 |
208 | --- a/drivers/char/tpm/tpm.c |
209 | +++ b/drivers/char/tpm/tpm.c |
210 | @@ -1186,17 +1186,20 @@ ssize_t tpm_write(struct file *file, const char __user *buf, |
211 | size_t size, loff_t *off) |
212 | { |
213 | struct tpm_chip *chip = file->private_data; |
214 | - size_t in_size = size, out_size; |
215 | + size_t in_size = size; |
216 | + ssize_t out_size; |
217 | |
218 | /* cannot perform a write until the read has cleared |
219 | - either via tpm_read or a user_read_timer timeout */ |
220 | - while (atomic_read(&chip->data_pending) != 0) |
221 | - msleep(TPM_TIMEOUT); |
222 | - |
223 | - mutex_lock(&chip->buffer_mutex); |
224 | + either via tpm_read or a user_read_timer timeout. |
225 | + This also prevents splitted buffered writes from blocking here. |
226 | + */ |
227 | + if (atomic_read(&chip->data_pending) != 0) |
228 | + return -EBUSY; |
229 | |
230 | if (in_size > TPM_BUFSIZE) |
231 | - in_size = TPM_BUFSIZE; |
232 | + return -E2BIG; |
233 | + |
234 | + mutex_lock(&chip->buffer_mutex); |
235 | |
236 | if (copy_from_user |
237 | (chip->data_buffer, (void __user *) buf, in_size)) { |
238 | @@ -1206,6 +1209,10 @@ ssize_t tpm_write(struct file *file, const char __user *buf, |
239 | |
240 | /* atomic tpm command send and result receive */ |
241 | out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE); |
242 | + if (out_size < 0) { |
243 | + mutex_unlock(&chip->buffer_mutex); |
244 | + return out_size; |
245 | + } |
246 | |
247 | atomic_set(&chip->data_pending, out_size); |
248 | mutex_unlock(&chip->buffer_mutex); |
249 | diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c |
250 | index 2e6b245..b8e4809 100644 |
251 | --- a/drivers/firewire/core-cdev.c |
252 | +++ b/drivers/firewire/core-cdev.c |
253 | @@ -471,8 +471,8 @@ static int ioctl_get_info(struct client *client, union ioctl_arg *arg) |
254 | client->bus_reset_closure = a->bus_reset_closure; |
255 | if (a->bus_reset != 0) { |
256 | fill_bus_reset_event(&bus_reset, client); |
257 | - ret = copy_to_user(u64_to_uptr(a->bus_reset), |
258 | - &bus_reset, sizeof(bus_reset)); |
259 | + /* unaligned size of bus_reset is 36 bytes */ |
260 | + ret = copy_to_user(u64_to_uptr(a->bus_reset), &bus_reset, 36); |
261 | } |
262 | if (ret == 0 && list_empty(&client->link)) |
263 | list_add_tail(&client->link, &client->device->client_list); |
264 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
265 | index 498bcbe..f3b06f0 100644 |
266 | --- a/drivers/gpu/drm/i915/intel_display.c |
267 | +++ b/drivers/gpu/drm/i915/intel_display.c |
268 | @@ -5318,7 +5318,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, |
269 | /* default to 8bpc */ |
270 | pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN); |
271 | if (is_dp) { |
272 | - if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { |
273 | + if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { |
274 | pipeconf |= PIPECONF_BPP_6 | |
275 | PIPECONF_DITHER_EN | |
276 | PIPECONF_DITHER_TYPE_SP; |
277 | @@ -5782,7 +5782,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, |
278 | /* determine panel color depth */ |
279 | temp = I915_READ(PIPECONF(pipe)); |
280 | temp &= ~PIPE_BPC_MASK; |
281 | - dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, mode); |
282 | + dither = intel_choose_pipe_bpp_dither(crtc, &pipe_bpp, adjusted_mode); |
283 | switch (pipe_bpp) { |
284 | case 18: |
285 | temp |= PIPE_6BPC; |
286 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
287 | index 42db254..1461e2c 100644 |
288 | --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
289 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
290 | @@ -973,11 +973,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, |
291 | static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder) |
292 | { |
293 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
294 | - struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv; |
295 | - if (tmds) { |
296 | - if (tmds->i2c_bus) |
297 | - radeon_i2c_destroy(tmds->i2c_bus); |
298 | - } |
299 | + /* don't destroy the i2c bus record here, this will be done in radeon_i2c_fini */ |
300 | kfree(radeon_encoder->enc_priv); |
301 | drm_encoder_cleanup(encoder); |
302 | kfree(radeon_encoder); |
303 | diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
304 | index 1f7e8cd..4a038cd 100644 |
305 | --- a/drivers/md/raid10.c |
306 | +++ b/drivers/md/raid10.c |
307 | @@ -3019,7 +3019,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, |
308 | else { |
309 | bad_sectors -= (sector - first_bad); |
310 | if (max_sync > bad_sectors) |
311 | - max_sync = max_sync; |
312 | + max_sync = bad_sectors; |
313 | continue; |
314 | } |
315 | } |
316 | diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h |
317 | index b83897f..1ab8067 100644 |
318 | --- a/drivers/net/ethernet/intel/e1000e/e1000.h |
319 | +++ b/drivers/net/ethernet/intel/e1000e/e1000.h |
320 | @@ -175,13 +175,13 @@ struct e1000_info; |
321 | /* |
322 | * in the case of WTHRESH, it appears at least the 82571/2 hardware |
323 | * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when |
324 | - * WTHRESH=4, and since we want 64 bytes at a time written back, set |
325 | - * it to 5 |
326 | + * WTHRESH=4, so a setting of 5 gives the most efficient bus |
327 | + * utilization but to avoid possible Tx stalls, set it to 1 |
328 | */ |
329 | #define E1000_TXDCTL_DMA_BURST_ENABLE \ |
330 | (E1000_TXDCTL_GRAN | /* set descriptor granularity */ \ |
331 | E1000_TXDCTL_COUNT_DESC | \ |
332 | - (5 << 16) | /* wthresh must be +1 more than desired */\ |
333 | + (1 << 16) | /* wthresh must be +1 more than desired */\ |
334 | (1 << 8) | /* hthresh */ \ |
335 | 0x1f) /* pthresh */ |
336 | |
337 | diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
338 | index 5621d5b..7e88aaf 100644 |
339 | --- a/drivers/net/ethernet/intel/e1000e/netdev.c |
340 | +++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
341 | @@ -2806,7 +2806,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter) |
342 | * set up some performance related parameters to encourage the |
343 | * hardware to use the bus more efficiently in bursts, depends |
344 | * on the tx_int_delay to be enabled, |
345 | - * wthresh = 5 ==> burst write a cacheline (64 bytes) at a time |
346 | + * wthresh = 1 ==> burst write is disabled to avoid Tx stalls |
347 | * hthresh = 1 ==> prefetch when one or more available |
348 | * pthresh = 0x1f ==> prefetch if internal cache 31 or less |
349 | * BEWARE: this seems to work but should be considered first if |
350 | diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c |
351 | index 6264182..5eb53c9 100644 |
352 | --- a/drivers/net/wireless/ath/ath9k/beacon.c |
353 | +++ b/drivers/net/wireless/ath/ath9k/beacon.c |
354 | @@ -121,7 +121,7 @@ static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb) |
355 | |
356 | if (ath_tx_start(hw, skb, &txctl) != 0) { |
357 | ath_dbg(common, XMIT, "CABQ TX failed\n"); |
358 | - dev_kfree_skb_any(skb); |
359 | + ieee80211_free_txskb(hw, skb); |
360 | } |
361 | } |
362 | |
363 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
364 | index d5dabcb..91e2c4f 100644 |
365 | --- a/drivers/net/wireless/ath/ath9k/main.c |
366 | +++ b/drivers/net/wireless/ath/ath9k/main.c |
367 | @@ -1147,7 +1147,7 @@ static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
368 | |
369 | return; |
370 | exit: |
371 | - dev_kfree_skb_any(skb); |
372 | + ieee80211_free_txskb(hw, skb); |
373 | } |
374 | |
375 | static void ath9k_stop(struct ieee80211_hw *hw) |
376 | diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c |
377 | index 4d57139..b78773b 100644 |
378 | --- a/drivers/net/wireless/ath/ath9k/xmit.c |
379 | +++ b/drivers/net/wireless/ath/ath9k/xmit.c |
380 | @@ -64,8 +64,7 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, |
381 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, |
382 | struct ath_txq *txq, |
383 | struct ath_atx_tid *tid, |
384 | - struct sk_buff *skb, |
385 | - bool dequeue); |
386 | + struct sk_buff *skb); |
387 | |
388 | enum { |
389 | MCS_HT20, |
390 | @@ -201,7 +200,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) |
391 | fi = get_frame_info(skb); |
392 | bf = fi->bf; |
393 | |
394 | - if (bf && fi->retries) { |
395 | + if (!bf) { |
396 | + bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
397 | + if (!bf) { |
398 | + ieee80211_free_txskb(sc->hw, skb); |
399 | + continue; |
400 | + } |
401 | + } |
402 | + |
403 | + if (fi->retries) { |
404 | list_add_tail(&bf->list, &bf_head); |
405 | ath_tx_update_baw(sc, tid, bf->bf_state.seqno); |
406 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); |
407 | @@ -812,10 +819,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, |
408 | fi = get_frame_info(skb); |
409 | bf = fi->bf; |
410 | if (!fi->bf) |
411 | - bf = ath_tx_setup_buffer(sc, txq, tid, skb, true); |
412 | + bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
413 | |
414 | - if (!bf) |
415 | + if (!bf) { |
416 | + __skb_unlink(skb, &tid->buf_q); |
417 | + ieee80211_free_txskb(sc->hw, skb); |
418 | continue; |
419 | + } |
420 | |
421 | bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; |
422 | seqno = bf->bf_state.seqno; |
423 | @@ -1717,9 +1727,11 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, |
424 | return; |
425 | } |
426 | |
427 | - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); |
428 | - if (!bf) |
429 | + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); |
430 | + if (!bf) { |
431 | + ieee80211_free_txskb(sc->hw, skb); |
432 | return; |
433 | + } |
434 | |
435 | bf->bf_state.bf_type = BUF_AMPDU; |
436 | INIT_LIST_HEAD(&bf_head); |
437 | @@ -1743,11 +1755,6 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, |
438 | struct ath_buf *bf; |
439 | |
440 | bf = fi->bf; |
441 | - if (!bf) |
442 | - bf = ath_tx_setup_buffer(sc, txq, tid, skb, false); |
443 | - |
444 | - if (!bf) |
445 | - return; |
446 | |
447 | INIT_LIST_HEAD(&bf_head); |
448 | list_add_tail(&bf->list, &bf_head); |
449 | @@ -1820,8 +1827,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) |
450 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, |
451 | struct ath_txq *txq, |
452 | struct ath_atx_tid *tid, |
453 | - struct sk_buff *skb, |
454 | - bool dequeue) |
455 | + struct sk_buff *skb) |
456 | { |
457 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
458 | struct ath_frame_info *fi = get_frame_info(skb); |
459 | @@ -1833,7 +1839,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, |
460 | bf = ath_tx_get_buffer(sc); |
461 | if (!bf) { |
462 | ath_dbg(common, XMIT, "TX buffers are full\n"); |
463 | - goto error; |
464 | + return NULL; |
465 | } |
466 | |
467 | ATH_TXBUF_RESET(bf); |
468 | @@ -1862,18 +1868,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, |
469 | ath_err(ath9k_hw_common(sc->sc_ah), |
470 | "dma_mapping_error() on TX\n"); |
471 | ath_tx_return_buffer(sc, bf); |
472 | - goto error; |
473 | + return NULL; |
474 | } |
475 | |
476 | fi->bf = bf; |
477 | |
478 | return bf; |
479 | - |
480 | -error: |
481 | - if (dequeue) |
482 | - __skb_unlink(skb, &tid->buf_q); |
483 | - dev_kfree_skb_any(skb); |
484 | - return NULL; |
485 | } |
486 | |
487 | /* FIXME: tx power */ |
488 | @@ -1902,9 +1902,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb, |
489 | */ |
490 | ath_tx_send_ampdu(sc, tid, skb, txctl); |
491 | } else { |
492 | - bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); |
493 | - if (!bf) |
494 | + bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb); |
495 | + if (!bf) { |
496 | + if (txctl->paprd) |
497 | + dev_kfree_skb_any(skb); |
498 | + else |
499 | + ieee80211_free_txskb(sc->hw, skb); |
500 | return; |
501 | + } |
502 | |
503 | bf->bf_state.bfs_paprd = txctl->paprd; |
504 | |
505 | diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c |
506 | index 8a5e25d..b0fefc4 100644 |
507 | --- a/drivers/scsi/hpsa.c |
508 | +++ b/drivers/scsi/hpsa.c |
509 | @@ -548,12 +548,42 @@ static void set_performant_mode(struct ctlr_info *h, struct CommandList *c) |
510 | c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1); |
511 | } |
512 | |
513 | +static int is_firmware_flash_cmd(u8 *cdb) |
514 | +{ |
515 | + return cdb[0] == BMIC_WRITE && cdb[6] == BMIC_FLASH_FIRMWARE; |
516 | +} |
517 | + |
518 | +/* |
519 | + * During firmware flash, the heartbeat register may not update as frequently |
520 | + * as it should. So we dial down lockup detection during firmware flash. and |
521 | + * dial it back up when firmware flash completes. |
522 | + */ |
523 | +#define HEARTBEAT_SAMPLE_INTERVAL_DURING_FLASH (240 * HZ) |
524 | +#define HEARTBEAT_SAMPLE_INTERVAL (30 * HZ) |
525 | +static void dial_down_lockup_detection_during_fw_flash(struct ctlr_info *h, |
526 | + struct CommandList *c) |
527 | +{ |
528 | + if (!is_firmware_flash_cmd(c->Request.CDB)) |
529 | + return; |
530 | + atomic_inc(&h->firmware_flash_in_progress); |
531 | + h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL_DURING_FLASH; |
532 | +} |
533 | + |
534 | +static void dial_up_lockup_detection_on_fw_flash_complete(struct ctlr_info *h, |
535 | + struct CommandList *c) |
536 | +{ |
537 | + if (is_firmware_flash_cmd(c->Request.CDB) && |
538 | + atomic_dec_and_test(&h->firmware_flash_in_progress)) |
539 | + h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; |
540 | +} |
541 | + |
542 | static void enqueue_cmd_and_start_io(struct ctlr_info *h, |
543 | struct CommandList *c) |
544 | { |
545 | unsigned long flags; |
546 | |
547 | set_performant_mode(h, c); |
548 | + dial_down_lockup_detection_during_fw_flash(h, c); |
549 | spin_lock_irqsave(&h->lock, flags); |
550 | addQ(&h->reqQ, c); |
551 | h->Qdepth++; |
552 | @@ -3049,6 +3079,7 @@ static inline int bad_tag(struct ctlr_info *h, u32 tag_index, |
553 | static inline void finish_cmd(struct CommandList *c, u32 raw_tag) |
554 | { |
555 | removeQ(c); |
556 | + dial_up_lockup_detection_on_fw_flash_complete(c->h, c); |
557 | if (likely(c->cmd_type == CMD_SCSI)) |
558 | complete_scsi_command(c); |
559 | else if (c->cmd_type == CMD_IOCTL_PEND) |
560 | @@ -4189,9 +4220,6 @@ static void controller_lockup_detected(struct ctlr_info *h) |
561 | spin_unlock_irqrestore(&h->lock, flags); |
562 | } |
563 | |
564 | -#define HEARTBEAT_SAMPLE_INTERVAL (10 * HZ) |
565 | -#define HEARTBEAT_CHECK_MINIMUM_INTERVAL (HEARTBEAT_SAMPLE_INTERVAL / 2) |
566 | - |
567 | static void detect_controller_lockup(struct ctlr_info *h) |
568 | { |
569 | u64 now; |
570 | @@ -4202,7 +4230,7 @@ static void detect_controller_lockup(struct ctlr_info *h) |
571 | now = get_jiffies_64(); |
572 | /* If we've received an interrupt recently, we're ok. */ |
573 | if (time_after64(h->last_intr_timestamp + |
574 | - (HEARTBEAT_CHECK_MINIMUM_INTERVAL), now)) |
575 | + (h->heartbeat_sample_interval), now)) |
576 | return; |
577 | |
578 | /* |
579 | @@ -4211,7 +4239,7 @@ static void detect_controller_lockup(struct ctlr_info *h) |
580 | * otherwise don't care about signals in this thread. |
581 | */ |
582 | if (time_after64(h->last_heartbeat_timestamp + |
583 | - (HEARTBEAT_CHECK_MINIMUM_INTERVAL), now)) |
584 | + (h->heartbeat_sample_interval), now)) |
585 | return; |
586 | |
587 | /* If heartbeat has not changed since we last looked, we're not ok. */ |
588 | @@ -4253,6 +4281,7 @@ static void add_ctlr_to_lockup_detector_list(struct ctlr_info *h) |
589 | { |
590 | unsigned long flags; |
591 | |
592 | + h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; |
593 | spin_lock_irqsave(&lockup_detector_lock, flags); |
594 | list_add_tail(&h->lockup_list, &hpsa_ctlr_list); |
595 | spin_unlock_irqrestore(&lockup_detector_lock, flags); |
596 | diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h |
597 | index 7b28d54..6f30a6f 100644 |
598 | --- a/drivers/scsi/hpsa.h |
599 | +++ b/drivers/scsi/hpsa.h |
600 | @@ -123,6 +123,8 @@ struct ctlr_info { |
601 | u64 last_intr_timestamp; |
602 | u32 last_heartbeat; |
603 | u64 last_heartbeat_timestamp; |
604 | + u32 heartbeat_sample_interval; |
605 | + atomic_t firmware_flash_in_progress; |
606 | u32 lockup_detected; |
607 | struct list_head lockup_list; |
608 | }; |
609 | diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h |
610 | index 8049815..cdd742e 100644 |
611 | --- a/drivers/scsi/hpsa_cmd.h |
612 | +++ b/drivers/scsi/hpsa_cmd.h |
613 | @@ -162,6 +162,7 @@ struct SenseSubsystem_info { |
614 | #define BMIC_WRITE 0x27 |
615 | #define BMIC_CACHE_FLUSH 0xc2 |
616 | #define HPSA_CACHE_FLUSH 0x01 /* C2 was already being used by HPSA */ |
617 | +#define BMIC_FLASH_FIRMWARE 0xF7 |
618 | |
619 | /* Command List Structure */ |
620 | union SCSI3Addr { |
621 | diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c |
622 | index 182d5a5..f4cc413 100644 |
623 | --- a/drivers/scsi/scsi_debug.c |
624 | +++ b/drivers/scsi/scsi_debug.c |
625 | @@ -2054,7 +2054,7 @@ static void unmap_region(sector_t lba, unsigned int len) |
626 | block = lba + alignment; |
627 | rem = do_div(block, granularity); |
628 | |
629 | - if (rem == 0 && lba + granularity <= end && block < map_size) { |
630 | + if (rem == 0 && lba + granularity < end && block < map_size) { |
631 | clear_bit(block, map_storep); |
632 | if (scsi_debug_lbprz) |
633 | memset(fake_storep + |
634 | diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c |
635 | index 83a1972..40a4570 100644 |
636 | --- a/drivers/scsi/storvsc_drv.c |
637 | +++ b/drivers/scsi/storvsc_drv.c |
638 | @@ -1211,7 +1211,12 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) |
639 | /* |
640 | * At this point, all outstanding requests in the adapter |
641 | * should have been flushed out and return to us |
642 | + * There is a potential race here where the host may be in |
643 | + * the process of responding when we return from here. |
644 | + * Just wait for all in-transit packets to be accounted for |
645 | + * before we return from here. |
646 | */ |
647 | + storvsc_wait_to_drain(stor_device); |
648 | |
649 | return SUCCESS; |
650 | } |
651 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
652 | index e326d17..23e122a 100644 |
653 | --- a/drivers/target/iscsi/iscsi_target.c |
654 | +++ b/drivers/target/iscsi/iscsi_target.c |
655 | @@ -3196,7 +3196,6 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) |
656 | len += 1; |
657 | |
658 | if ((len + payload_len) > buffer_len) { |
659 | - spin_unlock(&tiqn->tiqn_tpg_lock); |
660 | end_of_buf = 1; |
661 | goto eob; |
662 | } |
663 | @@ -3349,6 +3348,7 @@ static int iscsit_send_reject( |
664 | hdr->opcode = ISCSI_OP_REJECT; |
665 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; |
666 | hton24(hdr->dlength, ISCSI_HDR_LEN); |
667 | + hdr->ffffffff = 0xffffffff; |
668 | cmd->stat_sn = conn->stat_sn++; |
669 | hdr->statsn = cpu_to_be32(cmd->stat_sn); |
670 | hdr->exp_cmdsn = cpu_to_be32(conn->sess->exp_cmd_sn); |
671 | diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h |
672 | index d1c4bc2..1596aec 100644 |
673 | --- a/drivers/target/iscsi/iscsi_target_core.h |
674 | +++ b/drivers/target/iscsi/iscsi_target_core.h |
675 | @@ -25,10 +25,10 @@ |
676 | #define NA_DATAOUT_TIMEOUT_RETRIES 5 |
677 | #define NA_DATAOUT_TIMEOUT_RETRIES_MAX 15 |
678 | #define NA_DATAOUT_TIMEOUT_RETRIES_MIN 1 |
679 | -#define NA_NOPIN_TIMEOUT 5 |
680 | +#define NA_NOPIN_TIMEOUT 15 |
681 | #define NA_NOPIN_TIMEOUT_MAX 60 |
682 | #define NA_NOPIN_TIMEOUT_MIN 3 |
683 | -#define NA_NOPIN_RESPONSE_TIMEOUT 5 |
684 | +#define NA_NOPIN_RESPONSE_TIMEOUT 30 |
685 | #define NA_NOPIN_RESPONSE_TIMEOUT_MAX 60 |
686 | #define NA_NOPIN_RESPONSE_TIMEOUT_MIN 3 |
687 | #define NA_RANDOM_DATAIN_PDU_OFFSETS 0 |
688 | diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c |
689 | index 879d8d0..c3d7bf54 100644 |
690 | --- a/drivers/target/iscsi/iscsi_target_tpg.c |
691 | +++ b/drivers/target/iscsi/iscsi_target_tpg.c |
692 | @@ -672,6 +672,12 @@ int iscsit_ta_generate_node_acls( |
693 | pr_debug("iSCSI_TPG[%hu] - Generate Initiator Portal Group ACLs: %s\n", |
694 | tpg->tpgt, (a->generate_node_acls) ? "Enabled" : "Disabled"); |
695 | |
696 | + if (flag == 1 && a->cache_dynamic_acls == 0) { |
697 | + pr_debug("Explicitly setting cache_dynamic_acls=1 when " |
698 | + "generate_node_acls=1\n"); |
699 | + a->cache_dynamic_acls = 1; |
700 | + } |
701 | + |
702 | return 0; |
703 | } |
704 | |
705 | @@ -711,6 +717,12 @@ int iscsit_ta_cache_dynamic_acls( |
706 | return -EINVAL; |
707 | } |
708 | |
709 | + if (a->generate_node_acls == 1 && flag == 0) { |
710 | + pr_debug("Skipping cache_dynamic_acls=0 when" |
711 | + " generate_node_acls=1\n"); |
712 | + return 0; |
713 | + } |
714 | + |
715 | a->cache_dynamic_acls = flag; |
716 | pr_debug("iSCSI_TPG[%hu] - Cache Dynamic Initiator Portal Group" |
717 | " ACLs %s\n", tpg->tpgt, (a->cache_dynamic_acls) ? |
718 | diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c |
719 | index cbb6653..3f90d4b 100644 |
720 | --- a/drivers/target/target_core_configfs.c |
721 | +++ b/drivers/target/target_core_configfs.c |
722 | @@ -3115,6 +3115,7 @@ static int __init target_core_init_configfs(void) |
723 | GFP_KERNEL); |
724 | if (!target_cg->default_groups) { |
725 | pr_err("Unable to allocate target_cg->default_groups\n"); |
726 | + ret = -ENOMEM; |
727 | goto out_global; |
728 | } |
729 | |
730 | @@ -3130,6 +3131,7 @@ static int __init target_core_init_configfs(void) |
731 | GFP_KERNEL); |
732 | if (!hba_cg->default_groups) { |
733 | pr_err("Unable to allocate hba_cg->default_groups\n"); |
734 | + ret = -ENOMEM; |
735 | goto out_global; |
736 | } |
737 | config_group_init_type_name(&alua_group, |
738 | @@ -3145,6 +3147,7 @@ static int __init target_core_init_configfs(void) |
739 | GFP_KERNEL); |
740 | if (!alua_cg->default_groups) { |
741 | pr_err("Unable to allocate alua_cg->default_groups\n"); |
742 | + ret = -ENOMEM; |
743 | goto out_global; |
744 | } |
745 | |
746 | @@ -3156,14 +3159,17 @@ static int __init target_core_init_configfs(void) |
747 | * Add core/alua/lu_gps/default_lu_gp |
748 | */ |
749 | lu_gp = core_alua_allocate_lu_gp("default_lu_gp", 1); |
750 | - if (IS_ERR(lu_gp)) |
751 | + if (IS_ERR(lu_gp)) { |
752 | + ret = -ENOMEM; |
753 | goto out_global; |
754 | + } |
755 | |
756 | lu_gp_cg = &alua_lu_gps_group; |
757 | lu_gp_cg->default_groups = kzalloc(sizeof(struct config_group) * 2, |
758 | GFP_KERNEL); |
759 | if (!lu_gp_cg->default_groups) { |
760 | pr_err("Unable to allocate lu_gp_cg->default_groups\n"); |
761 | + ret = -ENOMEM; |
762 | goto out_global; |
763 | } |
764 | |
765 | diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c |
766 | index 2156188..18d06be 100644 |
767 | --- a/drivers/tty/vt/vt.c |
768 | +++ b/drivers/tty/vt/vt.c |
769 | @@ -3475,6 +3475,19 @@ int con_debug_enter(struct vc_data *vc) |
770 | kdb_set(2, setargs); |
771 | } |
772 | } |
773 | + if (vc->vc_cols < 999) { |
774 | + int colcount; |
775 | + char cols[4]; |
776 | + const char *setargs[3] = { |
777 | + "set", |
778 | + "COLUMNS", |
779 | + cols, |
780 | + }; |
781 | + if (kdbgetintenv(setargs[0], &colcount)) { |
782 | + snprintf(cols, 4, "%i", vc->vc_cols); |
783 | + kdb_set(2, setargs); |
784 | + } |
785 | + } |
786 | #endif /* CONFIG_KGDB_KDB */ |
787 | return ret; |
788 | } |
789 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
790 | index 1b632cb..7f2fac1 100644 |
791 | --- a/drivers/usb/class/cdc-acm.c |
792 | +++ b/drivers/usb/class/cdc-acm.c |
793 | @@ -1551,6 +1551,9 @@ static const struct usb_device_id acm_ids[] = { |
794 | Maybe we should define a new |
795 | quirk for this. */ |
796 | }, |
797 | + { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ |
798 | + .driver_info = NO_UNION_NORMAL, |
799 | + }, |
800 | { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ |
801 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
802 | }, |
803 | diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c |
804 | index 9d7bcd9..be6952e 100644 |
805 | --- a/drivers/usb/gadget/at91_udc.c |
806 | +++ b/drivers/usb/gadget/at91_udc.c |
807 | @@ -1735,7 +1735,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) |
808 | int retval; |
809 | struct resource *res; |
810 | |
811 | - if (!dev->platform_data) { |
812 | + if (!dev->platform_data && !pdev->dev.of_node) { |
813 | /* small (so we copy it) but critical! */ |
814 | DBG("missing platform_data\n"); |
815 | return -ENODEV; |
816 | diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c |
817 | index a159b63..85d8110 100644 |
818 | --- a/drivers/video/udlfb.c |
819 | +++ b/drivers/video/udlfb.c |
820 | @@ -647,7 +647,7 @@ static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf, |
821 | result = fb_sys_write(info, buf, count, ppos); |
822 | |
823 | if (result > 0) { |
824 | - int start = max((int)(offset / info->fix.line_length) - 1, 0); |
825 | + int start = max((int)(offset / info->fix.line_length), 0); |
826 | int lines = min((u32)((result / info->fix.line_length) + 1), |
827 | (u32)info->var.yres); |
828 | |
829 | diff --git a/drivers/video/via/via_clock.c b/drivers/video/via/via_clock.c |
830 | index af8f26b..db1e392 100644 |
831 | --- a/drivers/video/via/via_clock.c |
832 | +++ b/drivers/video/via/via_clock.c |
833 | @@ -25,6 +25,7 @@ |
834 | |
835 | #include <linux/kernel.h> |
836 | #include <linux/via-core.h> |
837 | +#include <asm/olpc.h> |
838 | #include "via_clock.h" |
839 | #include "global.h" |
840 | #include "debug.h" |
841 | @@ -289,6 +290,10 @@ static void dummy_set_pll(struct via_pll_config config) |
842 | printk(KERN_INFO "Using undocumented set PLL.\n%s", via_slap); |
843 | } |
844 | |
845 | +static void noop_set_clock_state(u8 state) |
846 | +{ |
847 | +} |
848 | + |
849 | void via_clock_init(struct via_clock *clock, int gfx_chip) |
850 | { |
851 | switch (gfx_chip) { |
852 | @@ -346,4 +351,18 @@ void via_clock_init(struct via_clock *clock, int gfx_chip) |
853 | break; |
854 | |
855 | } |
856 | + |
857 | + if (machine_is_olpc()) { |
858 | + /* The OLPC XO-1.5 cannot suspend/resume reliably if the |
859 | + * IGA1/IGA2 clocks are set as on or off (memory rot |
860 | + * occasionally happens during suspend under such |
861 | + * configurations). |
862 | + * |
863 | + * The only known stable scenario is to leave this bits as-is, |
864 | + * which in their default states are documented to enable the |
865 | + * clock only when it is needed. |
866 | + */ |
867 | + clock->set_primary_clock_state = noop_set_clock_state; |
868 | + clock->set_secondary_clock_state = noop_set_clock_state; |
869 | + } |
870 | } |
871 | diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c |
872 | index 75e5f1c..8c4292f 100644 |
873 | --- a/fs/autofs4/root.c |
874 | +++ b/fs/autofs4/root.c |
875 | @@ -392,10 +392,12 @@ static struct vfsmount *autofs4_d_automount(struct path *path) |
876 | ino->flags |= AUTOFS_INF_PENDING; |
877 | spin_unlock(&sbi->fs_lock); |
878 | status = autofs4_mount_wait(dentry); |
879 | - if (status) |
880 | - return ERR_PTR(status); |
881 | spin_lock(&sbi->fs_lock); |
882 | ino->flags &= ~AUTOFS_INF_PENDING; |
883 | + if (status) { |
884 | + spin_unlock(&sbi->fs_lock); |
885 | + return ERR_PTR(status); |
886 | + } |
887 | } |
888 | done: |
889 | if (!(ino->flags & AUTOFS_INF_EXPIRING)) { |
890 | diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
891 | index fbb2a64..4098ccf 100644 |
892 | --- a/fs/ceph/export.c |
893 | +++ b/fs/ceph/export.c |
894 | @@ -89,7 +89,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, |
895 | * FIXME: we should try harder by querying the mds for the ino. |
896 | */ |
897 | static struct dentry *__fh_to_dentry(struct super_block *sb, |
898 | - struct ceph_nfs_fh *fh) |
899 | + struct ceph_nfs_fh *fh, int fh_len) |
900 | { |
901 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; |
902 | struct inode *inode; |
903 | @@ -97,6 +97,9 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, |
904 | struct ceph_vino vino; |
905 | int err; |
906 | |
907 | + if (fh_len < sizeof(*fh) / 4) |
908 | + return ERR_PTR(-ESTALE); |
909 | + |
910 | dout("__fh_to_dentry %llx\n", fh->ino); |
911 | vino.ino = fh->ino; |
912 | vino.snap = CEPH_NOSNAP; |
913 | @@ -140,7 +143,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, |
914 | * convert connectable fh to dentry |
915 | */ |
916 | static struct dentry *__cfh_to_dentry(struct super_block *sb, |
917 | - struct ceph_nfs_confh *cfh) |
918 | + struct ceph_nfs_confh *cfh, int fh_len) |
919 | { |
920 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; |
921 | struct inode *inode; |
922 | @@ -148,6 +151,9 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb, |
923 | struct ceph_vino vino; |
924 | int err; |
925 | |
926 | + if (fh_len < sizeof(*cfh) / 4) |
927 | + return ERR_PTR(-ESTALE); |
928 | + |
929 | dout("__cfh_to_dentry %llx (%llx/%x)\n", |
930 | cfh->ino, cfh->parent_ino, cfh->parent_name_hash); |
931 | |
932 | @@ -197,9 +203,11 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid, |
933 | int fh_len, int fh_type) |
934 | { |
935 | if (fh_type == 1) |
936 | - return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw); |
937 | + return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw, |
938 | + fh_len); |
939 | else |
940 | - return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw); |
941 | + return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw, |
942 | + fh_len); |
943 | } |
944 | |
945 | /* |
946 | @@ -220,6 +228,8 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb, |
947 | |
948 | if (fh_type == 1) |
949 | return ERR_PTR(-ESTALE); |
950 | + if (fh_len < sizeof(*cfh) / 4) |
951 | + return ERR_PTR(-ESTALE); |
952 | |
953 | pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino, |
954 | cfh->parent_name_hash); |
955 | diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h |
956 | index 867b64c..56e3aa5 100644 |
957 | --- a/fs/ecryptfs/ecryptfs_kernel.h |
958 | +++ b/fs/ecryptfs/ecryptfs_kernel.h |
959 | @@ -568,6 +568,8 @@ struct ecryptfs_open_req { |
960 | struct inode *ecryptfs_get_inode(struct inode *lower_inode, |
961 | struct super_block *sb); |
962 | void ecryptfs_i_size_init(const char *page_virt, struct inode *inode); |
963 | +int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, |
964 | + struct inode *ecryptfs_inode); |
965 | int ecryptfs_decode_and_decrypt_filename(char **decrypted_name, |
966 | size_t *decrypted_name_size, |
967 | struct dentry *ecryptfs_dentry, |
968 | diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c |
969 | index 2b17f2f..d45ba45 100644 |
970 | --- a/fs/ecryptfs/file.c |
971 | +++ b/fs/ecryptfs/file.c |
972 | @@ -138,29 +138,50 @@ out: |
973 | return rc; |
974 | } |
975 | |
976 | -static void ecryptfs_vma_close(struct vm_area_struct *vma) |
977 | -{ |
978 | - filemap_write_and_wait(vma->vm_file->f_mapping); |
979 | -} |
980 | - |
981 | -static const struct vm_operations_struct ecryptfs_file_vm_ops = { |
982 | - .close = ecryptfs_vma_close, |
983 | - .fault = filemap_fault, |
984 | -}; |
985 | +struct kmem_cache *ecryptfs_file_info_cache; |
986 | |
987 | -static int ecryptfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
988 | +static int read_or_initialize_metadata(struct dentry *dentry) |
989 | { |
990 | + struct inode *inode = dentry->d_inode; |
991 | + struct ecryptfs_mount_crypt_stat *mount_crypt_stat; |
992 | + struct ecryptfs_crypt_stat *crypt_stat; |
993 | int rc; |
994 | |
995 | - rc = generic_file_mmap(file, vma); |
996 | + crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; |
997 | + mount_crypt_stat = &ecryptfs_superblock_to_private( |
998 | + inode->i_sb)->mount_crypt_stat; |
999 | + mutex_lock(&crypt_stat->cs_mutex); |
1000 | + |
1001 | + if (crypt_stat->flags & ECRYPTFS_POLICY_APPLIED && |
1002 | + crypt_stat->flags & ECRYPTFS_KEY_VALID) { |
1003 | + rc = 0; |
1004 | + goto out; |
1005 | + } |
1006 | + |
1007 | + rc = ecryptfs_read_metadata(dentry); |
1008 | if (!rc) |
1009 | - vma->vm_ops = &ecryptfs_file_vm_ops; |
1010 | + goto out; |
1011 | + |
1012 | + if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED) { |
1013 | + crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
1014 | + | ECRYPTFS_ENCRYPTED); |
1015 | + rc = 0; |
1016 | + goto out; |
1017 | + } |
1018 | + |
1019 | + if (!(mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED) && |
1020 | + !i_size_read(ecryptfs_inode_to_lower(inode))) { |
1021 | + rc = ecryptfs_initialize_file(dentry, inode); |
1022 | + if (!rc) |
1023 | + goto out; |
1024 | + } |
1025 | |
1026 | + rc = -EIO; |
1027 | +out: |
1028 | + mutex_unlock(&crypt_stat->cs_mutex); |
1029 | return rc; |
1030 | } |
1031 | |
1032 | -struct kmem_cache *ecryptfs_file_info_cache; |
1033 | - |
1034 | /** |
1035 | * ecryptfs_open |
1036 | * @inode: inode speciying file to open |
1037 | @@ -236,32 +257,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file) |
1038 | rc = 0; |
1039 | goto out; |
1040 | } |
1041 | - mutex_lock(&crypt_stat->cs_mutex); |
1042 | - if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED) |
1043 | - || !(crypt_stat->flags & ECRYPTFS_KEY_VALID)) { |
1044 | - rc = ecryptfs_read_metadata(ecryptfs_dentry); |
1045 | - if (rc) { |
1046 | - ecryptfs_printk(KERN_DEBUG, |
1047 | - "Valid headers not found\n"); |
1048 | - if (!(mount_crypt_stat->flags |
1049 | - & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { |
1050 | - rc = -EIO; |
1051 | - printk(KERN_WARNING "Either the lower file " |
1052 | - "is not in a valid eCryptfs format, " |
1053 | - "or the key could not be retrieved. " |
1054 | - "Plaintext passthrough mode is not " |
1055 | - "enabled; returning -EIO\n"); |
1056 | - mutex_unlock(&crypt_stat->cs_mutex); |
1057 | - goto out_put; |
1058 | - } |
1059 | - rc = 0; |
1060 | - crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
1061 | - | ECRYPTFS_ENCRYPTED); |
1062 | - mutex_unlock(&crypt_stat->cs_mutex); |
1063 | - goto out; |
1064 | - } |
1065 | - } |
1066 | - mutex_unlock(&crypt_stat->cs_mutex); |
1067 | + rc = read_or_initialize_metadata(ecryptfs_dentry); |
1068 | + if (rc) |
1069 | + goto out_put; |
1070 | ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = " |
1071 | "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino, |
1072 | (unsigned long long)i_size_read(inode)); |
1073 | @@ -277,8 +275,14 @@ out: |
1074 | |
1075 | static int ecryptfs_flush(struct file *file, fl_owner_t td) |
1076 | { |
1077 | - return file->f_mode & FMODE_WRITE |
1078 | - ? filemap_write_and_wait(file->f_mapping) : 0; |
1079 | + struct file *lower_file = ecryptfs_file_to_lower(file); |
1080 | + |
1081 | + if (lower_file->f_op && lower_file->f_op->flush) { |
1082 | + filemap_write_and_wait(file->f_mapping); |
1083 | + return lower_file->f_op->flush(lower_file, td); |
1084 | + } |
1085 | + |
1086 | + return 0; |
1087 | } |
1088 | |
1089 | static int ecryptfs_release(struct inode *inode, struct file *file) |
1090 | @@ -292,15 +296,7 @@ static int ecryptfs_release(struct inode *inode, struct file *file) |
1091 | static int |
1092 | ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
1093 | { |
1094 | - int rc = 0; |
1095 | - |
1096 | - rc = generic_file_fsync(file, start, end, datasync); |
1097 | - if (rc) |
1098 | - goto out; |
1099 | - rc = vfs_fsync_range(ecryptfs_file_to_lower(file), start, end, |
1100 | - datasync); |
1101 | -out: |
1102 | - return rc; |
1103 | + return vfs_fsync(ecryptfs_file_to_lower(file), datasync); |
1104 | } |
1105 | |
1106 | static int ecryptfs_fasync(int fd, struct file *file, int flag) |
1107 | @@ -369,7 +365,7 @@ const struct file_operations ecryptfs_main_fops = { |
1108 | #ifdef CONFIG_COMPAT |
1109 | .compat_ioctl = ecryptfs_compat_ioctl, |
1110 | #endif |
1111 | - .mmap = ecryptfs_file_mmap, |
1112 | + .mmap = generic_file_mmap, |
1113 | .open = ecryptfs_open, |
1114 | .flush = ecryptfs_flush, |
1115 | .release = ecryptfs_release, |
1116 | diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c |
1117 | index 6f5fb1a..11030b2 100644 |
1118 | --- a/fs/ecryptfs/inode.c |
1119 | +++ b/fs/ecryptfs/inode.c |
1120 | @@ -143,6 +143,31 @@ static int ecryptfs_interpose(struct dentry *lower_dentry, |
1121 | return 0; |
1122 | } |
1123 | |
1124 | +static int ecryptfs_do_unlink(struct inode *dir, struct dentry *dentry, |
1125 | + struct inode *inode) |
1126 | +{ |
1127 | + struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
1128 | + struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir); |
1129 | + struct dentry *lower_dir_dentry; |
1130 | + int rc; |
1131 | + |
1132 | + dget(lower_dentry); |
1133 | + lower_dir_dentry = lock_parent(lower_dentry); |
1134 | + rc = vfs_unlink(lower_dir_inode, lower_dentry); |
1135 | + if (rc) { |
1136 | + printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); |
1137 | + goto out_unlock; |
1138 | + } |
1139 | + fsstack_copy_attr_times(dir, lower_dir_inode); |
1140 | + set_nlink(inode, ecryptfs_inode_to_lower(inode)->i_nlink); |
1141 | + inode->i_ctime = dir->i_ctime; |
1142 | + d_drop(dentry); |
1143 | +out_unlock: |
1144 | + unlock_dir(lower_dir_dentry); |
1145 | + dput(lower_dentry); |
1146 | + return rc; |
1147 | +} |
1148 | + |
1149 | /** |
1150 | * ecryptfs_do_create |
1151 | * @directory_inode: inode of the new file's dentry's parent in ecryptfs |
1152 | @@ -182,8 +207,10 @@ ecryptfs_do_create(struct inode *directory_inode, |
1153 | } |
1154 | inode = __ecryptfs_get_inode(lower_dentry->d_inode, |
1155 | directory_inode->i_sb); |
1156 | - if (IS_ERR(inode)) |
1157 | + if (IS_ERR(inode)) { |
1158 | + vfs_unlink(lower_dir_dentry->d_inode, lower_dentry); |
1159 | goto out_lock; |
1160 | + } |
1161 | fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode); |
1162 | fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); |
1163 | out_lock: |
1164 | @@ -200,8 +227,8 @@ out: |
1165 | * |
1166 | * Returns zero on success |
1167 | */ |
1168 | -static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, |
1169 | - struct inode *ecryptfs_inode) |
1170 | +int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry, |
1171 | + struct inode *ecryptfs_inode) |
1172 | { |
1173 | struct ecryptfs_crypt_stat *crypt_stat = |
1174 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
1175 | @@ -265,7 +292,9 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, |
1176 | * that this on disk file is prepared to be an ecryptfs file */ |
1177 | rc = ecryptfs_initialize_file(ecryptfs_dentry, ecryptfs_inode); |
1178 | if (rc) { |
1179 | - drop_nlink(ecryptfs_inode); |
1180 | + ecryptfs_do_unlink(directory_inode, ecryptfs_dentry, |
1181 | + ecryptfs_inode); |
1182 | + make_bad_inode(ecryptfs_inode); |
1183 | unlock_new_inode(ecryptfs_inode); |
1184 | iput(ecryptfs_inode); |
1185 | goto out; |
1186 | @@ -477,27 +506,7 @@ out_lock: |
1187 | |
1188 | static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) |
1189 | { |
1190 | - int rc = 0; |
1191 | - struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
1192 | - struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir); |
1193 | - struct dentry *lower_dir_dentry; |
1194 | - |
1195 | - dget(lower_dentry); |
1196 | - lower_dir_dentry = lock_parent(lower_dentry); |
1197 | - rc = vfs_unlink(lower_dir_inode, lower_dentry); |
1198 | - if (rc) { |
1199 | - printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); |
1200 | - goto out_unlock; |
1201 | - } |
1202 | - fsstack_copy_attr_times(dir, lower_dir_inode); |
1203 | - set_nlink(dentry->d_inode, |
1204 | - ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink); |
1205 | - dentry->d_inode->i_ctime = dir->i_ctime; |
1206 | - d_drop(dentry); |
1207 | -out_unlock: |
1208 | - unlock_dir(lower_dir_dentry); |
1209 | - dput(lower_dentry); |
1210 | - return rc; |
1211 | + return ecryptfs_do_unlink(dir, dentry, dentry->d_inode); |
1212 | } |
1213 | |
1214 | static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry, |
1215 | @@ -1007,12 +1016,6 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) |
1216 | goto out; |
1217 | } |
1218 | |
1219 | - if (S_ISREG(inode->i_mode)) { |
1220 | - rc = filemap_write_and_wait(inode->i_mapping); |
1221 | - if (rc) |
1222 | - goto out; |
1223 | - fsstack_copy_attr_all(inode, lower_inode); |
1224 | - } |
1225 | memcpy(&lower_ia, ia, sizeof(lower_ia)); |
1226 | if (ia->ia_valid & ATTR_FILE) |
1227 | lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); |
1228 | diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c |
1229 | index 6895493..0f04d2e 100644 |
1230 | --- a/fs/ecryptfs/main.c |
1231 | +++ b/fs/ecryptfs/main.c |
1232 | @@ -162,6 +162,7 @@ void ecryptfs_put_lower_file(struct inode *inode) |
1233 | inode_info = ecryptfs_inode_to_private(inode); |
1234 | if (atomic_dec_and_mutex_lock(&inode_info->lower_file_count, |
1235 | &inode_info->lower_file_mutex)) { |
1236 | + filemap_write_and_wait(inode->i_mapping); |
1237 | fput(inode_info->lower_file); |
1238 | inode_info->lower_file = NULL; |
1239 | mutex_unlock(&inode_info->lower_file_mutex); |
1240 | diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c |
1241 | index a46b3a8..bd1d57f 100644 |
1242 | --- a/fs/ecryptfs/mmap.c |
1243 | +++ b/fs/ecryptfs/mmap.c |
1244 | @@ -66,18 +66,6 @@ static int ecryptfs_writepage(struct page *page, struct writeback_control *wbc) |
1245 | { |
1246 | int rc; |
1247 | |
1248 | - /* |
1249 | - * Refuse to write the page out if we are called from reclaim context |
1250 | - * since our writepage() path may potentially allocate memory when |
1251 | - * calling into the lower fs vfs_write() which may in turn invoke |
1252 | - * us again. |
1253 | - */ |
1254 | - if (current->flags & PF_MEMALLOC) { |
1255 | - redirty_page_for_writepage(wbc, page); |
1256 | - rc = 0; |
1257 | - goto out; |
1258 | - } |
1259 | - |
1260 | rc = ecryptfs_encrypt_page(page); |
1261 | if (rc) { |
1262 | ecryptfs_printk(KERN_WARNING, "Error encrypting " |
1263 | @@ -498,7 +486,6 @@ static int ecryptfs_write_end(struct file *file, |
1264 | struct ecryptfs_crypt_stat *crypt_stat = |
1265 | &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
1266 | int rc; |
1267 | - int need_unlock_page = 1; |
1268 | |
1269 | ecryptfs_printk(KERN_DEBUG, "Calling fill_zeros_to_end_of_page" |
1270 | "(page w/ index = [0x%.16lx], to = [%d])\n", index, to); |
1271 | @@ -519,26 +506,26 @@ static int ecryptfs_write_end(struct file *file, |
1272 | "zeros in page with index = [0x%.16lx]\n", index); |
1273 | goto out; |
1274 | } |
1275 | - set_page_dirty(page); |
1276 | - unlock_page(page); |
1277 | - need_unlock_page = 0; |
1278 | + rc = ecryptfs_encrypt_page(page); |
1279 | + if (rc) { |
1280 | + ecryptfs_printk(KERN_WARNING, "Error encrypting page (upper " |
1281 | + "index [0x%.16lx])\n", index); |
1282 | + goto out; |
1283 | + } |
1284 | if (pos + copied > i_size_read(ecryptfs_inode)) { |
1285 | i_size_write(ecryptfs_inode, pos + copied); |
1286 | ecryptfs_printk(KERN_DEBUG, "Expanded file size to " |
1287 | "[0x%.16llx]\n", |
1288 | (unsigned long long)i_size_read(ecryptfs_inode)); |
1289 | - balance_dirty_pages_ratelimited(mapping); |
1290 | - rc = ecryptfs_write_inode_size_to_metadata(ecryptfs_inode); |
1291 | - if (rc) { |
1292 | - printk(KERN_ERR "Error writing inode size to metadata; " |
1293 | - "rc = [%d]\n", rc); |
1294 | - goto out; |
1295 | - } |
1296 | } |
1297 | - rc = copied; |
1298 | + rc = ecryptfs_write_inode_size_to_metadata(ecryptfs_inode); |
1299 | + if (rc) |
1300 | + printk(KERN_ERR "Error writing inode size to metadata; " |
1301 | + "rc = [%d]\n", rc); |
1302 | + else |
1303 | + rc = copied; |
1304 | out: |
1305 | - if (need_unlock_page) |
1306 | - unlock_page(page); |
1307 | + unlock_page(page); |
1308 | page_cache_release(page); |
1309 | return rc; |
1310 | } |
1311 | diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c |
1312 | index 70ba891..fdef7f0 100644 |
1313 | --- a/fs/gfs2/export.c |
1314 | +++ b/fs/gfs2/export.c |
1315 | @@ -168,6 +168,8 @@ static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid, |
1316 | case GFS2_SMALL_FH_SIZE: |
1317 | case GFS2_LARGE_FH_SIZE: |
1318 | case GFS2_OLD_FH_SIZE: |
1319 | + if (fh_len < GFS2_SMALL_FH_SIZE) |
1320 | + return NULL; |
1321 | this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32; |
1322 | this.no_formal_ino |= be32_to_cpu(fh[1]); |
1323 | this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32; |
1324 | @@ -187,6 +189,8 @@ static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid, |
1325 | switch (fh_type) { |
1326 | case GFS2_LARGE_FH_SIZE: |
1327 | case GFS2_OLD_FH_SIZE: |
1328 | + if (fh_len < GFS2_LARGE_FH_SIZE) |
1329 | + return NULL; |
1330 | parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32; |
1331 | parent.no_formal_ino |= be32_to_cpu(fh[5]); |
1332 | parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32; |
1333 | diff --git a/fs/isofs/export.c b/fs/isofs/export.c |
1334 | index dd4687f..516eb21 100644 |
1335 | --- a/fs/isofs/export.c |
1336 | +++ b/fs/isofs/export.c |
1337 | @@ -179,7 +179,7 @@ static struct dentry *isofs_fh_to_parent(struct super_block *sb, |
1338 | { |
1339 | struct isofs_fid *ifid = (struct isofs_fid *)fid; |
1340 | |
1341 | - if (fh_type != 2) |
1342 | + if (fh_len < 2 || fh_type != 2) |
1343 | return NULL; |
1344 | |
1345 | return isofs_export_iget(sb, |
1346 | diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c |
1347 | index f2b9a57..9626bc8 100644 |
1348 | --- a/fs/jbd/commit.c |
1349 | +++ b/fs/jbd/commit.c |
1350 | @@ -86,7 +86,12 @@ nope: |
1351 | static void release_data_buffer(struct buffer_head *bh) |
1352 | { |
1353 | if (buffer_freed(bh)) { |
1354 | + WARN_ON_ONCE(buffer_dirty(bh)); |
1355 | clear_buffer_freed(bh); |
1356 | + clear_buffer_mapped(bh); |
1357 | + clear_buffer_new(bh); |
1358 | + clear_buffer_req(bh); |
1359 | + bh->b_bdev = NULL; |
1360 | release_buffer_page(bh); |
1361 | } else |
1362 | put_bh(bh); |
1363 | @@ -853,17 +858,35 @@ restart_loop: |
1364 | * there's no point in keeping a checkpoint record for |
1365 | * it. */ |
1366 | |
1367 | - /* A buffer which has been freed while still being |
1368 | - * journaled by a previous transaction may end up still |
1369 | - * being dirty here, but we want to avoid writing back |
1370 | - * that buffer in the future after the "add to orphan" |
1371 | - * operation been committed, That's not only a performance |
1372 | - * gain, it also stops aliasing problems if the buffer is |
1373 | - * left behind for writeback and gets reallocated for another |
1374 | - * use in a different page. */ |
1375 | - if (buffer_freed(bh) && !jh->b_next_transaction) { |
1376 | - clear_buffer_freed(bh); |
1377 | - clear_buffer_jbddirty(bh); |
1378 | + /* |
1379 | + * A buffer which has been freed while still being journaled by |
1380 | + * a previous transaction. |
1381 | + */ |
1382 | + if (buffer_freed(bh)) { |
1383 | + /* |
1384 | + * If the running transaction is the one containing |
1385 | + * "add to orphan" operation (b_next_transaction != |
1386 | + * NULL), we have to wait for that transaction to |
1387 | + * commit before we can really get rid of the buffer. |
1388 | + * So just clear b_modified to not confuse transaction |
1389 | + * credit accounting and refile the buffer to |
1390 | + * BJ_Forget of the running transaction. If the just |
1391 | + * committed transaction contains "add to orphan" |
1392 | + * operation, we can completely invalidate the buffer |
1393 | + * now. We are rather throughout in that since the |
1394 | + * buffer may be still accessible when blocksize < |
1395 | + * pagesize and it is attached to the last partial |
1396 | + * page. |
1397 | + */ |
1398 | + jh->b_modified = 0; |
1399 | + if (!jh->b_next_transaction) { |
1400 | + clear_buffer_freed(bh); |
1401 | + clear_buffer_jbddirty(bh); |
1402 | + clear_buffer_mapped(bh); |
1403 | + clear_buffer_new(bh); |
1404 | + clear_buffer_req(bh); |
1405 | + bh->b_bdev = NULL; |
1406 | + } |
1407 | } |
1408 | |
1409 | if (buffer_jbddirty(bh)) { |
1410 | diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c |
1411 | index b2a7e52..841cabc 100644 |
1412 | --- a/fs/jbd/transaction.c |
1413 | +++ b/fs/jbd/transaction.c |
1414 | @@ -1845,15 +1845,16 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) |
1415 | * We're outside-transaction here. Either or both of j_running_transaction |
1416 | * and j_committing_transaction may be NULL. |
1417 | */ |
1418 | -static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1419 | +static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, |
1420 | + int partial_page) |
1421 | { |
1422 | transaction_t *transaction; |
1423 | struct journal_head *jh; |
1424 | int may_free = 1; |
1425 | - int ret; |
1426 | |
1427 | BUFFER_TRACE(bh, "entry"); |
1428 | |
1429 | +retry: |
1430 | /* |
1431 | * It is safe to proceed here without the j_list_lock because the |
1432 | * buffers cannot be stolen by try_to_free_buffers as long as we are |
1433 | @@ -1881,10 +1882,18 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1434 | * clear the buffer dirty bit at latest at the moment when the |
1435 | * transaction marking the buffer as freed in the filesystem |
1436 | * structures is committed because from that moment on the |
1437 | - * buffer can be reallocated and used by a different page. |
1438 | + * block can be reallocated and used by a different page. |
1439 | * Since the block hasn't been freed yet but the inode has |
1440 | * already been added to orphan list, it is safe for us to add |
1441 | * the buffer to BJ_Forget list of the newest transaction. |
1442 | + * |
1443 | + * Also we have to clear buffer_mapped flag of a truncated buffer |
1444 | + * because the buffer_head may be attached to the page straddling |
1445 | + * i_size (can happen only when blocksize < pagesize) and thus the |
1446 | + * buffer_head can be reused when the file is extended again. So we end |
1447 | + * up keeping around invalidated buffers attached to transactions' |
1448 | + * BJ_Forget list just to stop checkpointing code from cleaning up |
1449 | + * the transaction this buffer was modified in. |
1450 | */ |
1451 | transaction = jh->b_transaction; |
1452 | if (transaction == NULL) { |
1453 | @@ -1911,13 +1920,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1454 | * committed, the buffer won't be needed any |
1455 | * longer. */ |
1456 | JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget"); |
1457 | - ret = __dispose_buffer(jh, |
1458 | + may_free = __dispose_buffer(jh, |
1459 | journal->j_running_transaction); |
1460 | - journal_put_journal_head(jh); |
1461 | - spin_unlock(&journal->j_list_lock); |
1462 | - jbd_unlock_bh_state(bh); |
1463 | - spin_unlock(&journal->j_state_lock); |
1464 | - return ret; |
1465 | + goto zap_buffer; |
1466 | } else { |
1467 | /* There is no currently-running transaction. So the |
1468 | * orphan record which we wrote for this file must have |
1469 | @@ -1925,13 +1930,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1470 | * the committing transaction, if it exists. */ |
1471 | if (journal->j_committing_transaction) { |
1472 | JBUFFER_TRACE(jh, "give to committing trans"); |
1473 | - ret = __dispose_buffer(jh, |
1474 | + may_free = __dispose_buffer(jh, |
1475 | journal->j_committing_transaction); |
1476 | - journal_put_journal_head(jh); |
1477 | - spin_unlock(&journal->j_list_lock); |
1478 | - jbd_unlock_bh_state(bh); |
1479 | - spin_unlock(&journal->j_state_lock); |
1480 | - return ret; |
1481 | + goto zap_buffer; |
1482 | } else { |
1483 | /* The orphan record's transaction has |
1484 | * committed. We can cleanse this buffer */ |
1485 | @@ -1952,10 +1953,24 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1486 | } |
1487 | /* |
1488 | * The buffer is committing, we simply cannot touch |
1489 | - * it. So we just set j_next_transaction to the |
1490 | - * running transaction (if there is one) and mark |
1491 | - * buffer as freed so that commit code knows it should |
1492 | - * clear dirty bits when it is done with the buffer. |
1493 | + * it. If the page is straddling i_size we have to wait |
1494 | + * for commit and try again. |
1495 | + */ |
1496 | + if (partial_page) { |
1497 | + tid_t tid = journal->j_committing_transaction->t_tid; |
1498 | + |
1499 | + journal_put_journal_head(jh); |
1500 | + spin_unlock(&journal->j_list_lock); |
1501 | + jbd_unlock_bh_state(bh); |
1502 | + spin_unlock(&journal->j_state_lock); |
1503 | + log_wait_commit(journal, tid); |
1504 | + goto retry; |
1505 | + } |
1506 | + /* |
1507 | + * OK, buffer won't be reachable after truncate. We just set |
1508 | + * j_next_transaction to the running transaction (if there is |
1509 | + * one) and mark buffer as freed so that commit code knows it |
1510 | + * should clear dirty bits when it is done with the buffer. |
1511 | */ |
1512 | set_buffer_freed(bh); |
1513 | if (journal->j_running_transaction && buffer_jbddirty(bh)) |
1514 | @@ -1978,6 +1993,14 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) |
1515 | } |
1516 | |
1517 | zap_buffer: |
1518 | + /* |
1519 | + * This is tricky. Although the buffer is truncated, it may be reused |
1520 | + * if blocksize < pagesize and it is attached to the page straddling |
1521 | + * EOF. Since the buffer might have been added to BJ_Forget list of the |
1522 | + * running transaction, journal_get_write_access() won't clear |
1523 | + * b_modified and credit accounting gets confused. So clear b_modified |
1524 | + * here. */ |
1525 | + jh->b_modified = 0; |
1526 | journal_put_journal_head(jh); |
1527 | zap_buffer_no_jh: |
1528 | spin_unlock(&journal->j_list_lock); |
1529 | @@ -2026,7 +2049,8 @@ void journal_invalidatepage(journal_t *journal, |
1530 | if (offset <= curr_off) { |
1531 | /* This block is wholly outside the truncation point */ |
1532 | lock_buffer(bh); |
1533 | - may_free &= journal_unmap_buffer(journal, bh); |
1534 | + may_free &= journal_unmap_buffer(journal, bh, |
1535 | + offset > 0); |
1536 | unlock_buffer(bh); |
1537 | } |
1538 | curr_off = next_off; |
1539 | diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c |
1540 | index 7ef14b3..606a8dd 100644 |
1541 | --- a/fs/lockd/mon.c |
1542 | +++ b/fs/lockd/mon.c |
1543 | @@ -40,6 +40,7 @@ struct nsm_args { |
1544 | u32 proc; |
1545 | |
1546 | char *mon_name; |
1547 | + char *nodename; |
1548 | }; |
1549 | |
1550 | struct nsm_res { |
1551 | @@ -94,6 +95,7 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res, |
1552 | .vers = 3, |
1553 | .proc = NLMPROC_NSM_NOTIFY, |
1554 | .mon_name = nsm->sm_mon_name, |
1555 | + .nodename = utsname()->nodename, |
1556 | }; |
1557 | struct rpc_message msg = { |
1558 | .rpc_argp = &args, |
1559 | @@ -430,7 +432,7 @@ static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp) |
1560 | { |
1561 | __be32 *p; |
1562 | |
1563 | - encode_nsm_string(xdr, utsname()->nodename); |
1564 | + encode_nsm_string(xdr, argp->nodename); |
1565 | p = xdr_reserve_space(xdr, 4 + 4 + 4); |
1566 | *p++ = cpu_to_be32(argp->prog); |
1567 | *p++ = cpu_to_be32(argp->vers); |
1568 | diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c |
1569 | index 322d11c..01b090d 100644 |
1570 | --- a/fs/nfsd/nfs4idmap.c |
1571 | +++ b/fs/nfsd/nfs4idmap.c |
1572 | @@ -581,7 +581,7 @@ numeric_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namel |
1573 | /* Just to make sure it's null-terminated: */ |
1574 | memcpy(buf, name, namelen); |
1575 | buf[namelen] = '\0'; |
1576 | - ret = kstrtouint(name, 10, id); |
1577 | + ret = kstrtouint(buf, 10, id); |
1578 | return ret == 0; |
1579 | } |
1580 | |
1581 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
1582 | index e79c24e..a2f99d1 100644 |
1583 | --- a/fs/nfsd/nfs4state.c |
1584 | +++ b/fs/nfsd/nfs4state.c |
1585 | @@ -3783,6 +3783,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
1586 | memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); |
1587 | |
1588 | nfsd4_close_open_stateid(stp); |
1589 | + release_last_closed_stateid(oo); |
1590 | oo->oo_last_closed_stid = stp; |
1591 | |
1592 | /* place unused nfs4_stateowners on so_close_lru list to be |
1593 | diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c |
1594 | index 494c315..f99c1b4 100644 |
1595 | --- a/fs/reiserfs/inode.c |
1596 | +++ b/fs/reiserfs/inode.c |
1597 | @@ -1573,8 +1573,10 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, |
1598 | reiserfs_warning(sb, "reiserfs-13077", |
1599 | "nfsd/reiserfs, fhtype=%d, len=%d - odd", |
1600 | fh_type, fh_len); |
1601 | - fh_type = 5; |
1602 | + fh_type = fh_len; |
1603 | } |
1604 | + if (fh_len < 2) |
1605 | + return NULL; |
1606 | |
1607 | return reiserfs_get_dentry(sb, fid->raw[0], fid->raw[1], |
1608 | (fh_type == 3 || fh_type >= 5) ? fid->raw[2] : 0); |
1609 | @@ -1583,6 +1585,8 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid, |
1610 | struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid, |
1611 | int fh_len, int fh_type) |
1612 | { |
1613 | + if (fh_type > fh_len) |
1614 | + fh_type = fh_len; |
1615 | if (fh_type < 4) |
1616 | return NULL; |
1617 | |
1618 | diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c |
1619 | index 558910f..5703fb8 100644 |
1620 | --- a/fs/xfs/xfs_export.c |
1621 | +++ b/fs/xfs/xfs_export.c |
1622 | @@ -195,6 +195,9 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid, |
1623 | struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fid; |
1624 | struct inode *inode = NULL; |
1625 | |
1626 | + if (fh_len < xfs_fileid_length(fileid_type)) |
1627 | + return NULL; |
1628 | + |
1629 | switch (fileid_type) { |
1630 | case FILEID_INO32_GEN_PARENT: |
1631 | inode = xfs_nfs_get_inode(sb, fid->i32.parent_ino, |
1632 | diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h |
1633 | index 4792320..41d9cfa 100644 |
1634 | --- a/include/linux/netfilter/ipset/ip_set_timeout.h |
1635 | +++ b/include/linux/netfilter/ipset/ip_set_timeout.h |
1636 | @@ -30,6 +30,10 @@ ip_set_timeout_uget(struct nlattr *tb) |
1637 | { |
1638 | unsigned int timeout = ip_set_get_h32(tb); |
1639 | |
1640 | + /* Normalize to fit into jiffies */ |
1641 | + if (timeout > UINT_MAX/MSEC_PER_SEC) |
1642 | + timeout = UINT_MAX/MSEC_PER_SEC; |
1643 | + |
1644 | /* Userspace supplied TIMEOUT parameter: adjust crazy size */ |
1645 | return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; |
1646 | } |
1647 | diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
1648 | index 72522f0..2389959 100644 |
1649 | --- a/include/net/ip_vs.h |
1650 | +++ b/include/net/ip_vs.h |
1651 | @@ -1356,7 +1356,7 @@ static inline void ip_vs_notrack(struct sk_buff *skb) |
1652 | struct nf_conn *ct = nf_ct_get(skb, &ctinfo); |
1653 | |
1654 | if (!ct || !nf_ct_is_untracked(ct)) { |
1655 | - nf_reset(skb); |
1656 | + nf_conntrack_put(skb->nfct); |
1657 | skb->nfct = &nf_ct_untracked_get()->ct_general; |
1658 | skb->nfctinfo = IP_CT_NEW; |
1659 | nf_conntrack_get(skb->nfct); |
1660 | diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h |
1661 | index a88fb69..ea6f8a4 100644 |
1662 | --- a/include/net/netfilter/nf_conntrack_ecache.h |
1663 | +++ b/include/net/netfilter/nf_conntrack_ecache.h |
1664 | @@ -18,6 +18,7 @@ struct nf_conntrack_ecache { |
1665 | u16 ctmask; /* bitmask of ct events to be delivered */ |
1666 | u16 expmask; /* bitmask of expect events to be delivered */ |
1667 | u32 pid; /* netlink pid of destroyer */ |
1668 | + struct timer_list timeout; |
1669 | }; |
1670 | |
1671 | static inline struct nf_conntrack_ecache * |
1672 | diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c |
1673 | index bb9520f..572e604 100644 |
1674 | --- a/kernel/debug/kdb/kdb_io.c |
1675 | +++ b/kernel/debug/kdb/kdb_io.c |
1676 | @@ -552,6 +552,7 @@ int vkdb_printf(const char *fmt, va_list ap) |
1677 | { |
1678 | int diag; |
1679 | int linecount; |
1680 | + int colcount; |
1681 | int logging, saved_loglevel = 0; |
1682 | int saved_trap_printk; |
1683 | int got_printf_lock = 0; |
1684 | @@ -584,6 +585,10 @@ int vkdb_printf(const char *fmt, va_list ap) |
1685 | if (diag || linecount <= 1) |
1686 | linecount = 24; |
1687 | |
1688 | + diag = kdbgetintenv("COLUMNS", &colcount); |
1689 | + if (diag || colcount <= 1) |
1690 | + colcount = 80; |
1691 | + |
1692 | diag = kdbgetintenv("LOGGING", &logging); |
1693 | if (diag) |
1694 | logging = 0; |
1695 | @@ -690,7 +695,7 @@ kdb_printit: |
1696 | gdbstub_msg_write(kdb_buffer, retlen); |
1697 | } else { |
1698 | if (dbg_io_ops && !dbg_io_ops->is_console) { |
1699 | - len = strlen(kdb_buffer); |
1700 | + len = retlen; |
1701 | cp = kdb_buffer; |
1702 | while (len--) { |
1703 | dbg_io_ops->write_char(*cp); |
1704 | @@ -709,11 +714,29 @@ kdb_printit: |
1705 | printk(KERN_INFO "%s", kdb_buffer); |
1706 | } |
1707 | |
1708 | - if (KDB_STATE(PAGER) && strchr(kdb_buffer, '\n')) |
1709 | - kdb_nextline++; |
1710 | + if (KDB_STATE(PAGER)) { |
1711 | + /* |
1712 | + * Check printed string to decide how to bump the |
1713 | + * kdb_nextline to control when the more prompt should |
1714 | + * show up. |
1715 | + */ |
1716 | + int got = 0; |
1717 | + len = retlen; |
1718 | + while (len--) { |
1719 | + if (kdb_buffer[len] == '\n') { |
1720 | + kdb_nextline++; |
1721 | + got = 0; |
1722 | + } else if (kdb_buffer[len] == '\r') { |
1723 | + got = 0; |
1724 | + } else { |
1725 | + got++; |
1726 | + } |
1727 | + } |
1728 | + kdb_nextline += got / (colcount + 1); |
1729 | + } |
1730 | |
1731 | /* check for having reached the LINES number of printed lines */ |
1732 | - if (kdb_nextline == linecount) { |
1733 | + if (kdb_nextline >= linecount) { |
1734 | char buf1[16] = ""; |
1735 | #if defined(CONFIG_SMP) |
1736 | char buf2[32]; |
1737 | @@ -776,7 +799,7 @@ kdb_printit: |
1738 | kdb_grepping_flag = 0; |
1739 | kdb_printf("\n"); |
1740 | } else if (buf1[0] == ' ') { |
1741 | - kdb_printf("\n"); |
1742 | + kdb_printf("\r"); |
1743 | suspend_grep = 1; /* for this recursion */ |
1744 | } else if (buf1[0] == '\n') { |
1745 | kdb_nextline = linecount - 1; |
1746 | diff --git a/kernel/module.c b/kernel/module.c |
1747 | index 78ac6ec..61ea75e 100644 |
1748 | --- a/kernel/module.c |
1749 | +++ b/kernel/module.c |
1750 | @@ -2729,6 +2729,10 @@ static int check_module_license_and_versions(struct module *mod) |
1751 | if (strcmp(mod->name, "driverloader") == 0) |
1752 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE); |
1753 | |
1754 | + /* lve claims to be GPL but upstream won't provide source */ |
1755 | + if (strcmp(mod->name, "lve") == 0) |
1756 | + add_taint_module(mod, TAINT_PROPRIETARY_MODULE); |
1757 | + |
1758 | #ifdef CONFIG_MODVERSIONS |
1759 | if ((mod->num_syms && !mod->crcs) |
1760 | || (mod->num_gpl_syms && !mod->gpl_crcs) |
1761 | diff --git a/kernel/timer.c b/kernel/timer.c |
1762 | index a297ffc..6dfdb72 100644 |
1763 | --- a/kernel/timer.c |
1764 | +++ b/kernel/timer.c |
1765 | @@ -63,6 +63,7 @@ EXPORT_SYMBOL(jiffies_64); |
1766 | #define TVR_SIZE (1 << TVR_BITS) |
1767 | #define TVN_MASK (TVN_SIZE - 1) |
1768 | #define TVR_MASK (TVR_SIZE - 1) |
1769 | +#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1)) |
1770 | |
1771 | struct tvec { |
1772 | struct list_head vec[TVN_SIZE]; |
1773 | @@ -356,11 +357,12 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) |
1774 | vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK); |
1775 | } else { |
1776 | int i; |
1777 | - /* If the timeout is larger than 0xffffffff on 64-bit |
1778 | - * architectures then we use the maximum timeout: |
1779 | + /* If the timeout is larger than MAX_TVAL (on 64-bit |
1780 | + * architectures or with CONFIG_BASE_SMALL=1) then we |
1781 | + * use the maximum timeout. |
1782 | */ |
1783 | - if (idx > 0xffffffffUL) { |
1784 | - idx = 0xffffffffUL; |
1785 | + if (idx > MAX_TVAL) { |
1786 | + idx = MAX_TVAL; |
1787 | expires = idx + base->timer_jiffies; |
1788 | } |
1789 | i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK; |
1790 | diff --git a/mm/shmem.c b/mm/shmem.c |
1791 | index 9d65a02..40383cd 100644 |
1792 | --- a/mm/shmem.c |
1793 | +++ b/mm/shmem.c |
1794 | @@ -2018,12 +2018,14 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb, |
1795 | { |
1796 | struct inode *inode; |
1797 | struct dentry *dentry = NULL; |
1798 | - u64 inum = fid->raw[2]; |
1799 | - inum = (inum << 32) | fid->raw[1]; |
1800 | + u64 inum; |
1801 | |
1802 | if (fh_len < 3) |
1803 | return NULL; |
1804 | |
1805 | + inum = fid->raw[2]; |
1806 | + inum = (inum << 32) | fid->raw[1]; |
1807 | + |
1808 | inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), |
1809 | shmem_match, fid->raw); |
1810 | if (inode) { |
1811 | diff --git a/net/core/pktgen.c b/net/core/pktgen.c |
1812 | index b81369b..8dae76f 100644 |
1813 | --- a/net/core/pktgen.c |
1814 | +++ b/net/core/pktgen.c |
1815 | @@ -2932,7 +2932,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev, |
1816 | sizeof(struct ipv6hdr) - sizeof(struct udphdr) - |
1817 | pkt_dev->pkt_overhead; |
1818 | |
1819 | - if (datalen < sizeof(struct pktgen_hdr)) { |
1820 | + if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) { |
1821 | datalen = sizeof(struct pktgen_hdr); |
1822 | if (net_ratelimit()) |
1823 | pr_info("increased datalen to %d\n", datalen); |
1824 | diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c |
1825 | index 57932c4..566be2d 100644 |
1826 | --- a/net/ipv4/netfilter/nf_nat_sip.c |
1827 | +++ b/net/ipv4/netfilter/nf_nat_sip.c |
1828 | @@ -148,7 +148,7 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, unsigned int dataoff, |
1829 | if (ct_sip_parse_header_uri(ct, *dptr, NULL, *datalen, |
1830 | hdr, NULL, &matchoff, &matchlen, |
1831 | &addr, &port) > 0) { |
1832 | - unsigned int matchend, poff, plen, buflen, n; |
1833 | + unsigned int olen, matchend, poff, plen, buflen, n; |
1834 | char buffer[sizeof("nnn.nnn.nnn.nnn:nnnnn")]; |
1835 | |
1836 | /* We're only interested in headers related to this |
1837 | @@ -163,11 +163,12 @@ static unsigned int ip_nat_sip(struct sk_buff *skb, unsigned int dataoff, |
1838 | goto next; |
1839 | } |
1840 | |
1841 | + olen = *datalen; |
1842 | if (!map_addr(skb, dataoff, dptr, datalen, matchoff, matchlen, |
1843 | &addr, port)) |
1844 | return NF_DROP; |
1845 | |
1846 | - matchend = matchoff + matchlen; |
1847 | + matchend = matchoff + matchlen + *datalen - olen; |
1848 | |
1849 | /* The maddr= parameter (RFC 2361) specifies where to send |
1850 | * the reply. */ |
1851 | @@ -501,7 +502,10 @@ static unsigned int ip_nat_sdp_media(struct sk_buff *skb, unsigned int dataoff, |
1852 | ret = nf_ct_expect_related(rtcp_exp); |
1853 | if (ret == 0) |
1854 | break; |
1855 | - else if (ret != -EBUSY) { |
1856 | + else if (ret == -EBUSY) { |
1857 | + nf_ct_unexpect_related(rtp_exp); |
1858 | + continue; |
1859 | + } else if (ret < 0) { |
1860 | nf_ct_unexpect_related(rtp_exp); |
1861 | port = 0; |
1862 | break; |
1863 | diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
1864 | index 97e7380..cbc5bfd 100644 |
1865 | --- a/net/netfilter/ipvs/ip_vs_ctl.c |
1866 | +++ b/net/netfilter/ipvs/ip_vs_ctl.c |
1867 | @@ -1521,11 +1521,12 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, |
1868 | { |
1869 | struct net_device *dev = ptr; |
1870 | struct net *net = dev_net(dev); |
1871 | + struct netns_ipvs *ipvs = net_ipvs(net); |
1872 | struct ip_vs_service *svc; |
1873 | struct ip_vs_dest *dest; |
1874 | unsigned int idx; |
1875 | |
1876 | - if (event != NETDEV_UNREGISTER) |
1877 | + if (event != NETDEV_UNREGISTER || !ipvs) |
1878 | return NOTIFY_DONE; |
1879 | IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name); |
1880 | EnterFunction(2); |
1881 | @@ -1551,7 +1552,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, |
1882 | } |
1883 | } |
1884 | |
1885 | - list_for_each_entry(dest, &net_ipvs(net)->dest_trash, n_list) { |
1886 | + list_for_each_entry(dest, &ipvs->dest_trash, n_list) { |
1887 | __ip_vs_dev_reset(dest, dev); |
1888 | } |
1889 | mutex_unlock(&__ip_vs_mutex); |
1890 | diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
1891 | index 729f157..9a171b2 100644 |
1892 | --- a/net/netfilter/nf_conntrack_core.c |
1893 | +++ b/net/netfilter/nf_conntrack_core.c |
1894 | @@ -249,12 +249,15 @@ static void death_by_event(unsigned long ul_conntrack) |
1895 | { |
1896 | struct nf_conn *ct = (void *)ul_conntrack; |
1897 | struct net *net = nf_ct_net(ct); |
1898 | + struct nf_conntrack_ecache *ecache = nf_ct_ecache_find(ct); |
1899 | + |
1900 | + BUG_ON(ecache == NULL); |
1901 | |
1902 | if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) { |
1903 | /* bad luck, let's retry again */ |
1904 | - ct->timeout.expires = jiffies + |
1905 | + ecache->timeout.expires = jiffies + |
1906 | (random32() % net->ct.sysctl_events_retry_timeout); |
1907 | - add_timer(&ct->timeout); |
1908 | + add_timer(&ecache->timeout); |
1909 | return; |
1910 | } |
1911 | /* we've got the event delivered, now it's dying */ |
1912 | @@ -268,6 +271,9 @@ static void death_by_event(unsigned long ul_conntrack) |
1913 | void nf_ct_insert_dying_list(struct nf_conn *ct) |
1914 | { |
1915 | struct net *net = nf_ct_net(ct); |
1916 | + struct nf_conntrack_ecache *ecache = nf_ct_ecache_find(ct); |
1917 | + |
1918 | + BUG_ON(ecache == NULL); |
1919 | |
1920 | /* add this conntrack to the dying list */ |
1921 | spin_lock_bh(&nf_conntrack_lock); |
1922 | @@ -275,10 +281,10 @@ void nf_ct_insert_dying_list(struct nf_conn *ct) |
1923 | &net->ct.dying); |
1924 | spin_unlock_bh(&nf_conntrack_lock); |
1925 | /* set a new timer to retry event delivery */ |
1926 | - setup_timer(&ct->timeout, death_by_event, (unsigned long)ct); |
1927 | - ct->timeout.expires = jiffies + |
1928 | + setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct); |
1929 | + ecache->timeout.expires = jiffies + |
1930 | (random32() % net->ct.sysctl_events_retry_timeout); |
1931 | - add_timer(&ct->timeout); |
1932 | + add_timer(&ecache->timeout); |
1933 | } |
1934 | EXPORT_SYMBOL_GPL(nf_ct_insert_dying_list); |
1935 | |
1936 | diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c |
1937 | index 4147ba3..e41ec84 100644 |
1938 | --- a/net/netfilter/nf_conntrack_expect.c |
1939 | +++ b/net/netfilter/nf_conntrack_expect.c |
1940 | @@ -361,23 +361,6 @@ static void evict_oldest_expect(struct nf_conn *master, |
1941 | } |
1942 | } |
1943 | |
1944 | -static inline int refresh_timer(struct nf_conntrack_expect *i) |
1945 | -{ |
1946 | - struct nf_conn_help *master_help = nfct_help(i->master); |
1947 | - const struct nf_conntrack_expect_policy *p; |
1948 | - |
1949 | - if (!del_timer(&i->timeout)) |
1950 | - return 0; |
1951 | - |
1952 | - p = &rcu_dereference_protected( |
1953 | - master_help->helper, |
1954 | - lockdep_is_held(&nf_conntrack_lock) |
1955 | - )->expect_policy[i->class]; |
1956 | - i->timeout.expires = jiffies + p->timeout * HZ; |
1957 | - add_timer(&i->timeout); |
1958 | - return 1; |
1959 | -} |
1960 | - |
1961 | static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) |
1962 | { |
1963 | const struct nf_conntrack_expect_policy *p; |
1964 | @@ -386,7 +369,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) |
1965 | struct nf_conn_help *master_help = nfct_help(master); |
1966 | struct nf_conntrack_helper *helper; |
1967 | struct net *net = nf_ct_exp_net(expect); |
1968 | - struct hlist_node *n; |
1969 | + struct hlist_node *n, *next; |
1970 | unsigned int h; |
1971 | int ret = 1; |
1972 | |
1973 | @@ -395,12 +378,12 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect) |
1974 | goto out; |
1975 | } |
1976 | h = nf_ct_expect_dst_hash(&expect->tuple); |
1977 | - hlist_for_each_entry(i, n, &net->ct.expect_hash[h], hnode) { |
1978 | + hlist_for_each_entry_safe(i, n, next, &net->ct.expect_hash[h], hnode) { |
1979 | if (expect_matches(i, expect)) { |
1980 | - /* Refresh timer: if it's dying, ignore.. */ |
1981 | - if (refresh_timer(i)) { |
1982 | - ret = 0; |
1983 | - goto out; |
1984 | + if (del_timer(&i->timeout)) { |
1985 | + nf_ct_unlink_expect(i); |
1986 | + nf_ct_expect_put(i); |
1987 | + break; |
1988 | } |
1989 | } else if (expect_clash(i, expect)) { |
1990 | ret = -EBUSY; |
1991 | diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c |
1992 | index d95f9c9..2195eb0 100644 |
1993 | --- a/net/netfilter/xt_hashlimit.c |
1994 | +++ b/net/netfilter/xt_hashlimit.c |
1995 | @@ -389,8 +389,7 @@ static void htable_put(struct xt_hashlimit_htable *hinfo) |
1996 | #define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ) |
1997 | |
1998 | /* Precision saver. */ |
1999 | -static inline u_int32_t |
2000 | -user2credits(u_int32_t user) |
2001 | +static u32 user2credits(u32 user) |
2002 | { |
2003 | /* If multiplying would overflow... */ |
2004 | if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY)) |
2005 | @@ -400,7 +399,7 @@ user2credits(u_int32_t user) |
2006 | return (user * HZ * CREDITS_PER_JIFFY) / XT_HASHLIMIT_SCALE; |
2007 | } |
2008 | |
2009 | -static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now) |
2010 | +static void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now) |
2011 | { |
2012 | dh->rateinfo.credit += (now - dh->rateinfo.prev) * CREDITS_PER_JIFFY; |
2013 | if (dh->rateinfo.credit > dh->rateinfo.credit_cap) |
2014 | @@ -535,8 +534,7 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) |
2015 | dh->rateinfo.prev = jiffies; |
2016 | dh->rateinfo.credit = user2credits(hinfo->cfg.avg * |
2017 | hinfo->cfg.burst); |
2018 | - dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg * |
2019 | - hinfo->cfg.burst); |
2020 | + dh->rateinfo.credit_cap = dh->rateinfo.credit; |
2021 | dh->rateinfo.cost = user2credits(hinfo->cfg.avg); |
2022 | } else { |
2023 | /* update expiration timeout */ |
2024 | diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c |
2025 | index 32b7a57..a4c1e45 100644 |
2026 | --- a/net/netfilter/xt_limit.c |
2027 | +++ b/net/netfilter/xt_limit.c |
2028 | @@ -88,8 +88,7 @@ limit_mt(const struct sk_buff *skb, struct xt_action_param *par) |
2029 | } |
2030 | |
2031 | /* Precision saver. */ |
2032 | -static u_int32_t |
2033 | -user2credits(u_int32_t user) |
2034 | +static u32 user2credits(u32 user) |
2035 | { |
2036 | /* If multiplying would overflow... */ |
2037 | if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY)) |
2038 | @@ -118,12 +117,12 @@ static int limit_mt_check(const struct xt_mtchk_param *par) |
2039 | |
2040 | /* For SMP, we only want to use one set of state. */ |
2041 | r->master = priv; |
2042 | + /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * |
2043 | + 128. */ |
2044 | + priv->prev = jiffies; |
2045 | + priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ |
2046 | if (r->cost == 0) { |
2047 | - /* User avg in seconds * XT_LIMIT_SCALE: convert to jiffies * |
2048 | - 128. */ |
2049 | - priv->prev = jiffies; |
2050 | - priv->credit = user2credits(r->avg * r->burst); /* Credits full. */ |
2051 | - r->credit_cap = user2credits(r->avg * r->burst); /* Credits full. */ |
2052 | + r->credit_cap = priv->credit; /* Credits full. */ |
2053 | r->cost = user2credits(r->avg); |
2054 | } |
2055 | return 0; |
2056 | diff --git a/net/netfilter/xt_set.c b/net/netfilter/xt_set.c |
2057 | index 0ec8138..c6f7db7 100644 |
2058 | --- a/net/netfilter/xt_set.c |
2059 | +++ b/net/netfilter/xt_set.c |
2060 | @@ -16,6 +16,7 @@ |
2061 | |
2062 | #include <linux/netfilter/x_tables.h> |
2063 | #include <linux/netfilter/xt_set.h> |
2064 | +#include <linux/netfilter/ipset/ip_set_timeout.h> |
2065 | |
2066 | MODULE_LICENSE("GPL"); |
2067 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); |
2068 | @@ -44,6 +45,14 @@ const struct ip_set_adt_opt n = { \ |
2069 | .cmdflags = cfs, \ |
2070 | .timeout = t, \ |
2071 | } |
2072 | +#define ADT_MOPT(n, f, d, fs, cfs, t) \ |
2073 | +struct ip_set_adt_opt n = { \ |
2074 | + .family = f, \ |
2075 | + .dim = d, \ |
2076 | + .flags = fs, \ |
2077 | + .cmdflags = cfs, \ |
2078 | + .timeout = t, \ |
2079 | +} |
2080 | |
2081 | /* Revision 0 interface: backward compatible with netfilter/iptables */ |
2082 | |
2083 | @@ -296,11 +305,15 @@ static unsigned int |
2084 | set_target_v2(struct sk_buff *skb, const struct xt_action_param *par) |
2085 | { |
2086 | const struct xt_set_info_target_v2 *info = par->targinfo; |
2087 | - ADT_OPT(add_opt, par->family, info->add_set.dim, |
2088 | - info->add_set.flags, info->flags, info->timeout); |
2089 | + ADT_MOPT(add_opt, par->family, info->add_set.dim, |
2090 | + info->add_set.flags, info->flags, info->timeout); |
2091 | ADT_OPT(del_opt, par->family, info->del_set.dim, |
2092 | info->del_set.flags, 0, UINT_MAX); |
2093 | |
2094 | + /* Normalize to fit into jiffies */ |
2095 | + if (add_opt.timeout != IPSET_NO_TIMEOUT && |
2096 | + add_opt.timeout > UINT_MAX/MSEC_PER_SEC) |
2097 | + add_opt.timeout = UINT_MAX/MSEC_PER_SEC; |
2098 | if (info->add_set.index != IPSET_INVALID_ID) |
2099 | ip_set_add(info->add_set.index, skb, par, &add_opt); |
2100 | if (info->del_set.index != IPSET_INVALID_ID) |
2101 | diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c |
2102 | index b88c6bf..00ff343 100644 |
2103 | --- a/net/sunrpc/xprtsock.c |
2104 | +++ b/net/sunrpc/xprtsock.c |
2105 | @@ -1028,6 +1028,16 @@ static void xs_udp_data_ready(struct sock *sk, int len) |
2106 | read_unlock_bh(&sk->sk_callback_lock); |
2107 | } |
2108 | |
2109 | +/* |
2110 | + * Helper function to force a TCP close if the server is sending |
2111 | + * junk and/or it has put us in CLOSE_WAIT |
2112 | + */ |
2113 | +static void xs_tcp_force_close(struct rpc_xprt *xprt) |
2114 | +{ |
2115 | + set_bit(XPRT_CONNECTION_CLOSE, &xprt->state); |
2116 | + xprt_force_disconnect(xprt); |
2117 | +} |
2118 | + |
2119 | static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct xdr_skb_reader *desc) |
2120 | { |
2121 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
2122 | @@ -1054,7 +1064,7 @@ static inline void xs_tcp_read_fraghdr(struct rpc_xprt *xprt, struct xdr_skb_rea |
2123 | /* Sanity check of the record length */ |
2124 | if (unlikely(transport->tcp_reclen < 8)) { |
2125 | dprintk("RPC: invalid TCP record fragment length\n"); |
2126 | - xprt_force_disconnect(xprt); |
2127 | + xs_tcp_force_close(xprt); |
2128 | return; |
2129 | } |
2130 | dprintk("RPC: reading TCP record fragment of length %d\n", |
2131 | @@ -1135,7 +1145,7 @@ static inline void xs_tcp_read_calldir(struct sock_xprt *transport, |
2132 | break; |
2133 | default: |
2134 | dprintk("RPC: invalid request message type\n"); |
2135 | - xprt_force_disconnect(&transport->xprt); |
2136 | + xs_tcp_force_close(&transport->xprt); |
2137 | } |
2138 | xs_tcp_check_fraghdr(transport); |
2139 | } |
2140 | @@ -1458,6 +1468,8 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt) |
2141 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) |
2142 | { |
2143 | smp_mb__before_clear_bit(); |
2144 | + clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
2145 | + clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state); |
2146 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
2147 | clear_bit(XPRT_CLOSING, &xprt->state); |
2148 | smp_mb__after_clear_bit(); |
2149 | @@ -1515,8 +1527,8 @@ static void xs_tcp_state_change(struct sock *sk) |
2150 | break; |
2151 | case TCP_CLOSE_WAIT: |
2152 | /* The server initiated a shutdown of the socket */ |
2153 | - xprt_force_disconnect(xprt); |
2154 | xprt->connect_cookie++; |
2155 | + xs_tcp_force_close(xprt); |
2156 | case TCP_CLOSING: |
2157 | /* |
2158 | * If the server closed down the connection, make sure that |
2159 | @@ -2159,8 +2171,7 @@ static void xs_tcp_setup_socket(struct work_struct *work) |
2160 | /* We're probably in TIME_WAIT. Get rid of existing socket, |
2161 | * and retry |
2162 | */ |
2163 | - set_bit(XPRT_CONNECTION_CLOSE, &xprt->state); |
2164 | - xprt_force_disconnect(xprt); |
2165 | + xs_tcp_force_close(xprt); |
2166 | break; |
2167 | case -ECONNREFUSED: |
2168 | case -ECONNRESET: |
2169 | diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c |
2170 | index 9473fca..8b0f996 100644 |
2171 | --- a/sound/pci/ac97/ac97_codec.c |
2172 | +++ b/sound/pci/ac97/ac97_codec.c |
2173 | @@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne |
2174 | tmp.index = ac97->num; |
2175 | kctl = snd_ctl_new1(&tmp, ac97); |
2176 | } |
2177 | + if (!kctl) |
2178 | + return -ENOMEM; |
2179 | if (reg >= AC97_PHONE && reg <= AC97_PCM) |
2180 | set_tlv_db_scale(kctl, db_scale_5bit_12db_max); |
2181 | else |
2182 | diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c |
2183 | index 7549240..a78fdf4 100644 |
2184 | --- a/sound/pci/emu10k1/emu10k1_main.c |
2185 | +++ b/sound/pci/emu10k1/emu10k1_main.c |
2186 | @@ -1416,6 +1416,15 @@ static struct snd_emu_chip_details emu_chip_details[] = { |
2187 | .ca0108_chip = 1, |
2188 | .spk71 = 1, |
2189 | .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */ |
2190 | + /* Tested by Maxim Kachur <mcdebugger@duganet.ru> 17th Oct 2012. */ |
2191 | + /* This is MAEM8986, 0202 is MAEM8980 */ |
2192 | + {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102, |
2193 | + .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]", |
2194 | + .id = "EMU1010", |
2195 | + .emu10k2_chip = 1, |
2196 | + .ca0108_chip = 1, |
2197 | + .spk71 = 1, |
2198 | + .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 PCIe */ |
2199 | /* Tested by James@superbug.co.uk 8th July 2005. */ |
2200 | /* This is MAEM8810, 0202 is MAEM8820 */ |
2201 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, |
2202 | diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c |
2203 | index c83ccdb..2bc6c51 100644 |
2204 | --- a/sound/pci/hda/patch_cirrus.c |
2205 | +++ b/sound/pci/hda/patch_cirrus.c |
2206 | @@ -1427,7 +1427,7 @@ static int patch_cs420x(struct hda_codec *codec) |
2207 | return 0; |
2208 | |
2209 | error: |
2210 | - kfree(codec->spec); |
2211 | + cs_free(codec); |
2212 | codec->spec = NULL; |
2213 | return err; |
2214 | } |
2215 | @@ -1984,7 +1984,7 @@ static int patch_cs4210(struct hda_codec *codec) |
2216 | return 0; |
2217 | |
2218 | error: |
2219 | - kfree(codec->spec); |
2220 | + cs_free(codec); |
2221 | codec->spec = NULL; |
2222 | return err; |
2223 | } |
2224 | @@ -2009,7 +2009,7 @@ static int patch_cs4213(struct hda_codec *codec) |
2225 | return 0; |
2226 | |
2227 | error: |
2228 | - kfree(codec->spec); |
2229 | + cs_free(codec); |
2230 | codec->spec = NULL; |
2231 | return err; |
2232 | } |
2233 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
2234 | index e7cb4bd..94b765b 100644 |
2235 | --- a/sound/pci/hda/patch_realtek.c |
2236 | +++ b/sound/pci/hda/patch_realtek.c |
2237 | @@ -602,6 +602,8 @@ static void alc_line_automute(struct hda_codec *codec) |
2238 | { |
2239 | struct alc_spec *spec = codec->spec; |
2240 | |
2241 | + if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
2242 | + return; |
2243 | /* check LO jack only when it's different from HP */ |
2244 | if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0]) |
2245 | return; |
2246 | @@ -2663,8 +2665,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, |
2247 | return "PCM"; |
2248 | break; |
2249 | } |
2250 | - if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) |
2251 | + if (ch >= ARRAY_SIZE(channel_name)) { |
2252 | + snd_BUG(); |
2253 | return "PCM"; |
2254 | + } |
2255 | |
2256 | return channel_name[ch]; |
2257 | } |
2258 | diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c |
2259 | index 32682c1..c8bff6d 100644 |
2260 | --- a/sound/soc/codecs/wm2200.c |
2261 | +++ b/sound/soc/codecs/wm2200.c |
2262 | @@ -1028,7 +1028,7 @@ SOC_DOUBLE_R_TLV("OUT2 Digital Volume", WM2200_DAC_DIGITAL_VOLUME_2L, |
2263 | WM2200_DAC_DIGITAL_VOLUME_2R, WM2200_OUT2L_VOL_SHIFT, 0x9f, 0, |
2264 | digital_tlv), |
2265 | SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT, |
2266 | - WM2200_SPK1R_MUTE_SHIFT, 1, 0), |
2267 | + WM2200_SPK1R_MUTE_SHIFT, 1, 1), |
2268 | }; |
2269 | |
2270 | WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE); |
2271 | @@ -2091,6 +2091,7 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, |
2272 | |
2273 | switch (wm2200->rev) { |
2274 | case 0: |
2275 | + case 1: |
2276 | ret = regmap_register_patch(wm2200->regmap, wm2200_reva_patch, |
2277 | ARRAY_SIZE(wm2200_reva_patch)); |
2278 | if (ret != 0) { |
2279 | diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c |
2280 | index 93bb8ee..9c2f090 100644 |
2281 | --- a/sound/soc/omap/omap-abe-twl6040.c |
2282 | +++ b/sound/soc/omap/omap-abe-twl6040.c |
2283 | @@ -181,7 +181,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) |
2284 | twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); |
2285 | twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); |
2286 | twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); |
2287 | - twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vinrator"); |
2288 | + twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator"); |
2289 | twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); |
2290 | twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); |
2291 | twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); |
2292 | diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c |
2293 | index 74ed2df..91b7287 100644 |
2294 | --- a/sound/soc/sh/fsi.c |
2295 | +++ b/sound/soc/sh/fsi.c |
2296 | @@ -20,6 +20,7 @@ |
2297 | #include <linux/sh_dma.h> |
2298 | #include <linux/slab.h> |
2299 | #include <linux/module.h> |
2300 | +#include <linux/workqueue.h> |
2301 | #include <sound/soc.h> |
2302 | #include <sound/sh_fsi.h> |
2303 | |
2304 | @@ -199,7 +200,7 @@ struct fsi_stream { |
2305 | */ |
2306 | struct dma_chan *chan; |
2307 | struct sh_dmae_slave slave; /* see fsi_handler_init() */ |
2308 | - struct tasklet_struct tasklet; |
2309 | + struct work_struct work; |
2310 | dma_addr_t dma; |
2311 | }; |
2312 | |
2313 | @@ -968,9 +969,9 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io) |
2314 | return io->dma + samples_to_bytes(runtime, io->buff_sample_pos); |
2315 | } |
2316 | |
2317 | -static void fsi_dma_do_tasklet(unsigned long data) |
2318 | +static void fsi_dma_do_work(struct work_struct *work) |
2319 | { |
2320 | - struct fsi_stream *io = (struct fsi_stream *)data; |
2321 | + struct fsi_stream *io = container_of(work, struct fsi_stream, work); |
2322 | struct fsi_priv *fsi = fsi_stream_to_priv(io); |
2323 | struct dma_chan *chan; |
2324 | struct snd_soc_dai *dai; |
2325 | @@ -1023,7 +1024,7 @@ static void fsi_dma_do_tasklet(unsigned long data) |
2326 | * FIXME |
2327 | * |
2328 | * In DMAEngine case, codec and FSI cannot be started simultaneously |
2329 | - * since FSI is using tasklet. |
2330 | + * since FSI is using the scheduler work queue. |
2331 | * Therefore, in capture case, probably FSI FIFO will have got |
2332 | * overflow error in this point. |
2333 | * in that case, DMA cannot start transfer until error was cleared. |
2334 | @@ -1047,7 +1048,7 @@ static bool fsi_dma_filter(struct dma_chan *chan, void *param) |
2335 | |
2336 | static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) |
2337 | { |
2338 | - tasklet_schedule(&io->tasklet); |
2339 | + schedule_work(&io->work); |
2340 | |
2341 | return 0; |
2342 | } |
2343 | @@ -1087,14 +1088,14 @@ static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io) |
2344 | if (!io->chan) |
2345 | return -EIO; |
2346 | |
2347 | - tasklet_init(&io->tasklet, fsi_dma_do_tasklet, (unsigned long)io); |
2348 | + INIT_WORK(&io->work, fsi_dma_do_work); |
2349 | |
2350 | return 0; |
2351 | } |
2352 | |
2353 | static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io) |
2354 | { |
2355 | - tasklet_kill(&io->tasklet); |
2356 | + cancel_work_sync(&io->work); |
2357 | |
2358 | fsi_stream_stop(fsi, io); |
2359 |