1 |
commit: 8a4471bfeb08692c493bc19741850ac8862cb669 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 2 19:19:14 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 2 19:19:14 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=8a4471bf |
7 |
|
8 |
Linux patch 4.4.221 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1220_linux-4.4.221.patch | 1954 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1958 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 5399fb2..0853ee6 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -923,6 +923,10 @@ Patch: 1219_linux-4.4.220.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.4.220 |
23 |
|
24 |
+Patch: 1220_linux-4.4.221.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.4.221 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1220_linux-4.4.221.patch b/1220_linux-4.4.221.patch |
33 |
new file mode 100644 |
34 |
index 0000000..1dad46d |
35 |
--- /dev/null |
36 |
+++ b/1220_linux-4.4.221.patch |
37 |
@@ -0,0 +1,1954 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index bbe2b37b2d23..ea97d0869c89 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 4 |
45 |
+-SUBLEVEL = 220 |
46 |
++SUBLEVEL = 221 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Blurry Fish Butt |
49 |
+ |
50 |
+diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile |
51 |
+index 6358ea48eaf9..2d78900ee282 100644 |
52 |
+--- a/arch/arm/mach-imx/Makefile |
53 |
++++ b/arch/arm/mach-imx/Makefile |
54 |
+@@ -91,8 +91,10 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a |
55 |
+ obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o |
56 |
+ obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o |
57 |
+ endif |
58 |
++ifeq ($(CONFIG_ARM_CPU_SUSPEND),y) |
59 |
+ AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a |
60 |
+ obj-$(CONFIG_SOC_IMX6) += resume-imx6.o |
61 |
++endif |
62 |
+ obj-$(CONFIG_SOC_IMX6) += pm-imx6.o |
63 |
+ |
64 |
+ obj-$(CONFIG_SOC_IMX50) += mach-imx50.o |
65 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
66 |
+index 2634b4556202..f9cb4536dd85 100644 |
67 |
+--- a/arch/x86/kvm/vmx.c |
68 |
++++ b/arch/x86/kvm/vmx.c |
69 |
+@@ -5441,7 +5441,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu, |
70 |
+ */ |
71 |
+ static void kvm_machine_check(void) |
72 |
+ { |
73 |
+-#if defined(CONFIG_X86_MCE) && defined(CONFIG_X86_64) |
74 |
++#if defined(CONFIG_X86_MCE) |
75 |
+ struct pt_regs regs = { |
76 |
+ .cs = 3, /* Fake ring 3 no matter what the guest ran on */ |
77 |
+ .flags = X86_EFLAGS_IF, |
78 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
79 |
+index dd9a861fd526..bea13c35979e 100644 |
80 |
+--- a/arch/x86/net/bpf_jit_comp.c |
81 |
++++ b/arch/x86/net/bpf_jit_comp.c |
82 |
+@@ -145,6 +145,19 @@ static bool is_ereg(u32 reg) |
83 |
+ BIT(BPF_REG_9)); |
84 |
+ } |
85 |
+ |
86 |
++/* |
87 |
++ * is_ereg_8l() == true if BPF register 'reg' is mapped to access x86-64 |
88 |
++ * lower 8-bit registers dil,sil,bpl,spl,r8b..r15b, which need extra byte |
89 |
++ * of encoding. al,cl,dl,bl have simpler encoding. |
90 |
++ */ |
91 |
++static bool is_ereg_8l(u32 reg) |
92 |
++{ |
93 |
++ return is_ereg(reg) || |
94 |
++ (1 << reg) & (BIT(BPF_REG_1) | |
95 |
++ BIT(BPF_REG_2) | |
96 |
++ BIT(BPF_REG_FP)); |
97 |
++} |
98 |
++ |
99 |
+ /* add modifiers if 'reg' maps to x64 registers r8..r15 */ |
100 |
+ static u8 add_1mod(u8 byte, u32 reg) |
101 |
+ { |
102 |
+@@ -731,9 +744,8 @@ st: if (is_imm8(insn->off)) |
103 |
+ /* STX: *(u8*)(dst_reg + off) = src_reg */ |
104 |
+ case BPF_STX | BPF_MEM | BPF_B: |
105 |
+ /* emit 'mov byte ptr [rax + off], al' */ |
106 |
+- if (is_ereg(dst_reg) || is_ereg(src_reg) || |
107 |
+- /* have to add extra byte for x86 SIL, DIL regs */ |
108 |
+- src_reg == BPF_REG_1 || src_reg == BPF_REG_2) |
109 |
++ if (is_ereg(dst_reg) || is_ereg_8l(src_reg)) |
110 |
++ /* Add extra byte for eregs or SIL,DIL,BPL in src_reg */ |
111 |
+ EMIT2(add_2mod(0x40, dst_reg, src_reg), 0x88); |
112 |
+ else |
113 |
+ EMIT1(0x88); |
114 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
115 |
+index 68836939f934..1a8dc76e117e 100644 |
116 |
+--- a/drivers/crypto/mxs-dcp.c |
117 |
++++ b/drivers/crypto/mxs-dcp.c |
118 |
+@@ -37,11 +37,11 @@ |
119 |
+ * Null hashes to align with hw behavior on imx6sl and ull |
120 |
+ * these are flipped for consistency with hw output |
121 |
+ */ |
122 |
+-const uint8_t sha1_null_hash[] = |
123 |
++static const uint8_t sha1_null_hash[] = |
124 |
+ "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf" |
125 |
+ "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda"; |
126 |
+ |
127 |
+-const uint8_t sha256_null_hash[] = |
128 |
++static const uint8_t sha256_null_hash[] = |
129 |
+ "\x55\xb8\x52\x78\x1b\x99\x95\xa4" |
130 |
+ "\x4c\x93\x9b\x64\xe4\x41\xae\x27" |
131 |
+ "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a" |
132 |
+diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c |
133 |
+index 6398e86a272b..182c3132cd30 100644 |
134 |
+--- a/drivers/iio/adc/xilinx-xadc-core.c |
135 |
++++ b/drivers/iio/adc/xilinx-xadc-core.c |
136 |
+@@ -660,7 +660,7 @@ static int xadc_trigger_set_state(struct iio_trigger *trigger, bool state) |
137 |
+ |
138 |
+ spin_lock_irqsave(&xadc->lock, flags); |
139 |
+ xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val); |
140 |
+- xadc_write_reg(xadc, XADC_AXI_REG_IPISR, val & XADC_AXI_INT_EOS); |
141 |
++ xadc_write_reg(xadc, XADC_AXI_REG_IPISR, XADC_AXI_INT_EOS); |
142 |
+ if (state) |
143 |
+ val |= XADC_AXI_INT_EOS; |
144 |
+ else |
145 |
+@@ -709,13 +709,14 @@ static int xadc_power_adc_b(struct xadc *xadc, unsigned int seq_mode) |
146 |
+ { |
147 |
+ uint16_t val; |
148 |
+ |
149 |
++ /* Powerdown the ADC-B when it is not needed. */ |
150 |
+ switch (seq_mode) { |
151 |
+ case XADC_CONF1_SEQ_SIMULTANEOUS: |
152 |
+ case XADC_CONF1_SEQ_INDEPENDENT: |
153 |
+- val = XADC_CONF2_PD_ADC_B; |
154 |
++ val = 0; |
155 |
+ break; |
156 |
+ default: |
157 |
+- val = 0; |
158 |
++ val = XADC_CONF2_PD_ADC_B; |
159 |
+ break; |
160 |
+ } |
161 |
+ |
162 |
+@@ -784,6 +785,16 @@ static int xadc_preenable(struct iio_dev *indio_dev) |
163 |
+ if (ret) |
164 |
+ goto err; |
165 |
+ |
166 |
++ /* |
167 |
++ * In simultaneous mode the upper and lower aux channels are samples at |
168 |
++ * the same time. In this mode the upper 8 bits in the sequencer |
169 |
++ * register are don't care and the lower 8 bits control two channels |
170 |
++ * each. As such we must set the bit if either the channel in the lower |
171 |
++ * group or the upper group is enabled. |
172 |
++ */ |
173 |
++ if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS) |
174 |
++ scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000; |
175 |
++ |
176 |
+ ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); |
177 |
+ if (ret) |
178 |
+ goto err; |
179 |
+diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c |
180 |
+index 7589d891b311..972935f1b2f7 100644 |
181 |
+--- a/drivers/mtd/chips/cfi_cmdset_0002.c |
182 |
++++ b/drivers/mtd/chips/cfi_cmdset_0002.c |
183 |
+@@ -1881,7 +1881,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, |
184 |
+ continue; |
185 |
+ } |
186 |
+ |
187 |
+- if (time_after(jiffies, timeo) && !chip_ready(map, adr)) |
188 |
++ /* |
189 |
++ * We check "time_after" and "!chip_good" before checking "chip_good" to avoid |
190 |
++ * the failure due to scheduling. |
191 |
++ */ |
192 |
++ if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) |
193 |
+ break; |
194 |
+ |
195 |
+ if (chip_good(map, adr, datum)) { |
196 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
197 |
+index 832ad1bd1f29..fd6492fd3dc0 100644 |
198 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
199 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
200 |
+@@ -3341,7 +3341,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) |
201 |
+ FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); |
202 |
+ ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, |
203 |
+ ¶m, &val); |
204 |
+- if (ret < 0) |
205 |
++ if (ret) |
206 |
+ return ret; |
207 |
+ *phy_fw_ver = val; |
208 |
+ return 0; |
209 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
210 |
+index 84767722065a..d5d4d109ee10 100644 |
211 |
+--- a/drivers/net/macvlan.c |
212 |
++++ b/drivers/net/macvlan.c |
213 |
+@@ -1561,7 +1561,7 @@ static int macvlan_device_event(struct notifier_block *unused, |
214 |
+ struct macvlan_dev, |
215 |
+ list); |
216 |
+ |
217 |
+- if (macvlan_sync_address(vlan->dev, dev->dev_addr)) |
218 |
++ if (vlan && macvlan_sync_address(vlan->dev, dev->dev_addr)) |
219 |
+ return NOTIFY_BAD; |
220 |
+ |
221 |
+ break; |
222 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
223 |
+index e51fb7cb7728..d0943415aeff 100644 |
224 |
+--- a/drivers/net/team/team.c |
225 |
++++ b/drivers/net/team/team.c |
226 |
+@@ -466,6 +466,9 @@ static const struct team_mode *team_mode_get(const char *kind) |
227 |
+ struct team_mode_item *mitem; |
228 |
+ const struct team_mode *mode = NULL; |
229 |
+ |
230 |
++ if (!try_module_get(THIS_MODULE)) |
231 |
++ return NULL; |
232 |
++ |
233 |
+ spin_lock(&mode_list_lock); |
234 |
+ mitem = __find_mode(kind); |
235 |
+ if (!mitem) { |
236 |
+@@ -481,6 +484,7 @@ static const struct team_mode *team_mode_get(const char *kind) |
237 |
+ } |
238 |
+ |
239 |
+ spin_unlock(&mode_list_lock); |
240 |
++ module_put(THIS_MODULE); |
241 |
+ return mode; |
242 |
+ } |
243 |
+ |
244 |
+diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c |
245 |
+index b4c7f956b6fa..388a9fa5c1d2 100644 |
246 |
+--- a/drivers/pwm/pwm-bcm2835.c |
247 |
++++ b/drivers/pwm/pwm-bcm2835.c |
248 |
+@@ -160,6 +160,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) |
249 |
+ |
250 |
+ pc->chip.dev = &pdev->dev; |
251 |
+ pc->chip.ops = &bcm2835_pwm_ops; |
252 |
++ pc->chip.base = -1; |
253 |
+ pc->chip.npwm = 2; |
254 |
+ |
255 |
+ platform_set_drvdata(pdev, pc); |
256 |
+diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c |
257 |
+index 6e99a63ffa29..df0723df1f99 100644 |
258 |
+--- a/drivers/pwm/pwm-rcar.c |
259 |
++++ b/drivers/pwm/pwm-rcar.c |
260 |
+@@ -232,24 +232,28 @@ static int rcar_pwm_probe(struct platform_device *pdev) |
261 |
+ rcar_pwm->chip.base = -1; |
262 |
+ rcar_pwm->chip.npwm = 1; |
263 |
+ |
264 |
++ pm_runtime_enable(&pdev->dev); |
265 |
++ |
266 |
+ ret = pwmchip_add(&rcar_pwm->chip); |
267 |
+ if (ret < 0) { |
268 |
+ dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); |
269 |
++ pm_runtime_disable(&pdev->dev); |
270 |
+ return ret; |
271 |
+ } |
272 |
+ |
273 |
+- pm_runtime_enable(&pdev->dev); |
274 |
+- |
275 |
+ return 0; |
276 |
+ } |
277 |
+ |
278 |
+ static int rcar_pwm_remove(struct platform_device *pdev) |
279 |
+ { |
280 |
+ struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); |
281 |
++ int ret; |
282 |
++ |
283 |
++ ret = pwmchip_remove(&rcar_pwm->chip); |
284 |
+ |
285 |
+ pm_runtime_disable(&pdev->dev); |
286 |
+ |
287 |
+- return pwmchip_remove(&rcar_pwm->chip); |
288 |
++ return ret; |
289 |
+ } |
290 |
+ |
291 |
+ static const struct of_device_id rcar_pwm_of_table[] = { |
292 |
+diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c |
293 |
+index 075c1a764ba2..6247a956cc08 100644 |
294 |
+--- a/drivers/pwm/pwm-renesas-tpu.c |
295 |
++++ b/drivers/pwm/pwm-renesas-tpu.c |
296 |
+@@ -423,16 +423,17 @@ static int tpu_probe(struct platform_device *pdev) |
297 |
+ tpu->chip.base = -1; |
298 |
+ tpu->chip.npwm = TPU_CHANNEL_MAX; |
299 |
+ |
300 |
++ pm_runtime_enable(&pdev->dev); |
301 |
++ |
302 |
+ ret = pwmchip_add(&tpu->chip); |
303 |
+ if (ret < 0) { |
304 |
+ dev_err(&pdev->dev, "failed to register PWM chip\n"); |
305 |
++ pm_runtime_disable(&pdev->dev); |
306 |
+ return ret; |
307 |
+ } |
308 |
+ |
309 |
+ dev_info(&pdev->dev, "TPU PWM %d registered\n", tpu->pdev->id); |
310 |
+ |
311 |
+- pm_runtime_enable(&pdev->dev); |
312 |
+- |
313 |
+ return 0; |
314 |
+ } |
315 |
+ |
316 |
+@@ -442,12 +443,10 @@ static int tpu_remove(struct platform_device *pdev) |
317 |
+ int ret; |
318 |
+ |
319 |
+ ret = pwmchip_remove(&tpu->chip); |
320 |
+- if (ret) |
321 |
+- return ret; |
322 |
+ |
323 |
+ pm_runtime_disable(&pdev->dev); |
324 |
+ |
325 |
+- return 0; |
326 |
++ return ret; |
327 |
+ } |
328 |
+ |
329 |
+ #ifdef CONFIG_OF |
330 |
+diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
331 |
+index b76ef5244b65..110ed37cbab6 100644 |
332 |
+--- a/drivers/remoteproc/remoteproc_core.c |
333 |
++++ b/drivers/remoteproc/remoteproc_core.c |
334 |
+@@ -288,7 +288,7 @@ void rproc_free_vring(struct rproc_vring *rvring) |
335 |
+ { |
336 |
+ int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); |
337 |
+ struct rproc *rproc = rvring->rvdev->rproc; |
338 |
+- int idx = rvring->rvdev->vring - rvring; |
339 |
++ int idx = rvring - rvring->rvdev->vring; |
340 |
+ struct fw_rsc_vdev *rsc; |
341 |
+ |
342 |
+ dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma); |
343 |
+diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c |
344 |
+index 6aae68412802..2389a1dc6d30 100644 |
345 |
+--- a/drivers/s390/cio/device.c |
346 |
++++ b/drivers/s390/cio/device.c |
347 |
+@@ -872,8 +872,10 @@ static void io_subchannel_register(struct ccw_device *cdev) |
348 |
+ * Now we know this subchannel will stay, we can throw |
349 |
+ * our delayed uevent. |
350 |
+ */ |
351 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
352 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
353 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
354 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
355 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
356 |
++ } |
357 |
+ /* make it known to the system */ |
358 |
+ ret = ccw_device_add(cdev); |
359 |
+ if (ret) { |
360 |
+@@ -1082,8 +1084,11 @@ static int io_subchannel_probe(struct subchannel *sch) |
361 |
+ * Throw the delayed uevent for the subchannel, register |
362 |
+ * the ccw_device and exit. |
363 |
+ */ |
364 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
365 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
366 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
367 |
++ /* should always be the case for the console */ |
368 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
369 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
370 |
++ } |
371 |
+ cdev = sch_get_cdev(sch); |
372 |
+ rc = ccw_device_add(cdev); |
373 |
+ if (rc) { |
374 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
375 |
+index 065fdc17bbfb..7a94c2d35239 100644 |
376 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
377 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
378 |
+@@ -2186,6 +2186,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
379 |
+ !pmb->u.mb.mbxStatus) { |
380 |
+ rpi = pmb->u.mb.un.varWords[0]; |
381 |
+ vpi = pmb->u.mb.un.varRegLogin.vpi; |
382 |
++ if (phba->sli_rev == LPFC_SLI_REV4) |
383 |
++ vpi -= phba->sli4_hba.max_cfg_param.vpi_base; |
384 |
+ lpfc_unreg_login(phba, vpi, rpi, pmb); |
385 |
+ pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
386 |
+ rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); |
387 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
388 |
+index 20cf01d6ded7..de10b461ec7e 100644 |
389 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
390 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
391 |
+@@ -2014,7 +2014,7 @@ static void __iscsi_unbind_session(struct work_struct *work) |
392 |
+ if (session->target_id == ISCSI_MAX_TARGET) { |
393 |
+ spin_unlock_irqrestore(&session->lock, flags); |
394 |
+ mutex_unlock(&ihost->mutex); |
395 |
+- return; |
396 |
++ goto unbind_session_exit; |
397 |
+ } |
398 |
+ |
399 |
+ target_id = session->target_id; |
400 |
+@@ -2026,6 +2026,8 @@ static void __iscsi_unbind_session(struct work_struct *work) |
401 |
+ ida_simple_remove(&iscsi_sess_ida, target_id); |
402 |
+ |
403 |
+ scsi_remove_target(&session->dev); |
404 |
++ |
405 |
++unbind_session_exit: |
406 |
+ iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); |
407 |
+ ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n"); |
408 |
+ } |
409 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
410 |
+index b831f08e2769..8ed4a44d3174 100644 |
411 |
+--- a/drivers/staging/comedi/comedi_fops.c |
412 |
++++ b/drivers/staging/comedi/comedi_fops.c |
413 |
+@@ -2592,8 +2592,10 @@ static int comedi_open(struct inode *inode, struct file *file) |
414 |
+ } |
415 |
+ |
416 |
+ cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); |
417 |
+- if (!cfp) |
418 |
++ if (!cfp) { |
419 |
++ comedi_dev_put(dev); |
420 |
+ return -ENOMEM; |
421 |
++ } |
422 |
+ |
423 |
+ cfp->dev = dev; |
424 |
+ |
425 |
+diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c |
426 |
+index fb08569c1ac1..08d4f14a5e40 100644 |
427 |
+--- a/drivers/staging/comedi/drivers/dt2815.c |
428 |
++++ b/drivers/staging/comedi/drivers/dt2815.c |
429 |
+@@ -101,6 +101,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
430 |
+ int ret; |
431 |
+ |
432 |
+ for (i = 0; i < insn->n; i++) { |
433 |
++ /* FIXME: lo bit 0 chooses voltage output or current output */ |
434 |
+ lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; |
435 |
+ hi = (data[i] & 0xff0) >> 4; |
436 |
+ |
437 |
+@@ -114,6 +115,8 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
438 |
+ if (ret) |
439 |
+ return ret; |
440 |
+ |
441 |
++ outb(hi, dev->iobase + DT2815_DATA); |
442 |
++ |
443 |
+ devpriv->ao_readback[chan] = data[i]; |
444 |
+ } |
445 |
+ return i; |
446 |
+diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c |
447 |
+index cb22b5efe2be..e0a19a1105bc 100644 |
448 |
+--- a/drivers/staging/vt6656/int.c |
449 |
++++ b/drivers/staging/vt6656/int.c |
450 |
+@@ -157,7 +157,8 @@ void vnt_int_process_data(struct vnt_private *priv) |
451 |
+ priv->wake_up_count = |
452 |
+ priv->hw->conf.listen_interval; |
453 |
+ |
454 |
+- --priv->wake_up_count; |
455 |
++ if (priv->wake_up_count) |
456 |
++ --priv->wake_up_count; |
457 |
+ |
458 |
+ /* Turn on wake up to listen next beacon */ |
459 |
+ if (priv->wake_up_count == 1) |
460 |
+diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c |
461 |
+index 66e658810229..7c2bddd6135e 100644 |
462 |
+--- a/drivers/staging/vt6656/main_usb.c |
463 |
++++ b/drivers/staging/vt6656/main_usb.c |
464 |
+@@ -762,12 +762,15 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
465 |
+ vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, |
466 |
+ TFTCTL_TSFCNTREN); |
467 |
+ |
468 |
+- vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
469 |
+- conf->sync_tsf, priv->current_tsf); |
470 |
+- |
471 |
+ vnt_mac_set_beacon_interval(priv, conf->beacon_int); |
472 |
+ |
473 |
+ vnt_reset_next_tbtt(priv, conf->beacon_int); |
474 |
++ |
475 |
++ vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
476 |
++ conf->sync_tsf, priv->current_tsf); |
477 |
++ |
478 |
++ vnt_update_next_tbtt(priv, |
479 |
++ conf->sync_tsf, conf->beacon_int); |
480 |
+ } else { |
481 |
+ vnt_clear_current_tsf(priv); |
482 |
+ |
483 |
+diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c |
484 |
+index 6e75095af681..2ecb2f7042a1 100644 |
485 |
+--- a/drivers/target/target_core_fabric_lib.c |
486 |
++++ b/drivers/target/target_core_fabric_lib.c |
487 |
+@@ -75,7 +75,7 @@ static int fc_get_pr_transport_id( |
488 |
+ * encoded TransportID. |
489 |
+ */ |
490 |
+ ptr = &se_nacl->initiatorname[0]; |
491 |
+- for (i = 0; i < 24; ) { |
492 |
++ for (i = 0; i < 23; ) { |
493 |
+ if (!strncmp(&ptr[i], ":", 1)) { |
494 |
+ i++; |
495 |
+ continue; |
496 |
+diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
497 |
+index e46d628998f5..acf6d143c753 100644 |
498 |
+--- a/drivers/tty/hvc/hvc_console.c |
499 |
++++ b/drivers/tty/hvc/hvc_console.c |
500 |
+@@ -289,10 +289,6 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) |
501 |
+ vtermnos[index] = vtermno; |
502 |
+ cons_ops[index] = ops; |
503 |
+ |
504 |
+- /* reserve all indices up to and including this index */ |
505 |
+- if (last_hvc < index) |
506 |
+- last_hvc = index; |
507 |
+- |
508 |
+ /* check if we need to re-register the kernel console */ |
509 |
+ hvc_check_console(index); |
510 |
+ |
511 |
+@@ -896,13 +892,22 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, |
512 |
+ cons_ops[i] == hp->ops) |
513 |
+ break; |
514 |
+ |
515 |
+- /* no matching slot, just use a counter */ |
516 |
+- if (i >= MAX_NR_HVC_CONSOLES) |
517 |
+- i = ++last_hvc; |
518 |
++ if (i >= MAX_NR_HVC_CONSOLES) { |
519 |
++ |
520 |
++ /* find 'empty' slot for console */ |
521 |
++ for (i = 0; i < MAX_NR_HVC_CONSOLES && vtermnos[i] != -1; i++) { |
522 |
++ } |
523 |
++ |
524 |
++ /* no matching slot, just use a counter */ |
525 |
++ if (i == MAX_NR_HVC_CONSOLES) |
526 |
++ i = ++last_hvc + MAX_NR_HVC_CONSOLES; |
527 |
++ } |
528 |
+ |
529 |
+ hp->index = i; |
530 |
+- cons_ops[i] = ops; |
531 |
+- vtermnos[i] = vtermno; |
532 |
++ if (i < MAX_NR_HVC_CONSOLES) { |
533 |
++ cons_ops[i] = ops; |
534 |
++ vtermnos[i] = vtermno; |
535 |
++ } |
536 |
+ |
537 |
+ list_add_tail(&(hp->next), &hvc_structs); |
538 |
+ spin_unlock(&hvc_structs_lock); |
539 |
+diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c |
540 |
+index ec6d20f25e8b..0d3cc3324f46 100644 |
541 |
+--- a/drivers/tty/rocket.c |
542 |
++++ b/drivers/tty/rocket.c |
543 |
+@@ -645,18 +645,21 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) |
544 |
+ info->port.ops = &rocket_port_ops; |
545 |
+ init_completion(&info->close_wait); |
546 |
+ info->flags &= ~ROCKET_MODE_MASK; |
547 |
+- switch (pc104[board][line]) { |
548 |
+- case 422: |
549 |
+- info->flags |= ROCKET_MODE_RS422; |
550 |
+- break; |
551 |
+- case 485: |
552 |
+- info->flags |= ROCKET_MODE_RS485; |
553 |
+- break; |
554 |
+- case 232: |
555 |
+- default: |
556 |
++ if (board < ARRAY_SIZE(pc104) && line < ARRAY_SIZE(pc104_1)) |
557 |
++ switch (pc104[board][line]) { |
558 |
++ case 422: |
559 |
++ info->flags |= ROCKET_MODE_RS422; |
560 |
++ break; |
561 |
++ case 485: |
562 |
++ info->flags |= ROCKET_MODE_RS485; |
563 |
++ break; |
564 |
++ case 232: |
565 |
++ default: |
566 |
++ info->flags |= ROCKET_MODE_RS232; |
567 |
++ break; |
568 |
++ } |
569 |
++ else |
570 |
+ info->flags |= ROCKET_MODE_RS232; |
571 |
+- break; |
572 |
+- } |
573 |
+ |
574 |
+ info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR; |
575 |
+ if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) { |
576 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
577 |
+index 963dd8a4b540..c422b4df97e8 100644 |
578 |
+--- a/drivers/usb/core/hub.c |
579 |
++++ b/drivers/usb/core/hub.c |
580 |
+@@ -1175,6 +1175,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
581 |
+ #ifdef CONFIG_PM |
582 |
+ udev->reset_resume = 1; |
583 |
+ #endif |
584 |
++ /* Don't set the change_bits when the device |
585 |
++ * was powered off. |
586 |
++ */ |
587 |
++ if (test_bit(port1, hub->power_bits)) |
588 |
++ set_bit(port1, hub->change_bits); |
589 |
+ |
590 |
+ } else { |
591 |
+ /* The power session is gone; tell hub_wq */ |
592 |
+@@ -2939,6 +2944,15 @@ static int check_port_resume_type(struct usb_device *udev, |
593 |
+ if (portchange & USB_PORT_STAT_C_ENABLE) |
594 |
+ usb_clear_port_feature(hub->hdev, port1, |
595 |
+ USB_PORT_FEAT_C_ENABLE); |
596 |
++ |
597 |
++ /* |
598 |
++ * Whatever made this reset-resume necessary may have |
599 |
++ * turned on the port1 bit in hub->change_bits. But after |
600 |
++ * a successful reset-resume we want the bit to be clear; |
601 |
++ * if it was on it would indicate that something happened |
602 |
++ * following the reset-resume. |
603 |
++ */ |
604 |
++ clear_bit(port1, hub->change_bits); |
605 |
+ } |
606 |
+ |
607 |
+ return status; |
608 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
609 |
+index adc696a76b20..747343c61398 100644 |
610 |
+--- a/drivers/usb/core/message.c |
611 |
++++ b/drivers/usb/core/message.c |
612 |
+@@ -306,9 +306,10 @@ static void sg_complete(struct urb *urb) |
613 |
+ */ |
614 |
+ spin_unlock(&io->lock); |
615 |
+ for (i = 0, found = 0; i < io->entries; i++) { |
616 |
+- if (!io->urbs[i] || !io->urbs[i]->dev) |
617 |
++ if (!io->urbs[i]) |
618 |
+ continue; |
619 |
+ if (found) { |
620 |
++ usb_block_urb(io->urbs[i]); |
621 |
+ retval = usb_unlink_urb(io->urbs[i]); |
622 |
+ if (retval != -EINPROGRESS && |
623 |
+ retval != -ENODEV && |
624 |
+@@ -519,12 +520,10 @@ void usb_sg_wait(struct usb_sg_request *io) |
625 |
+ int retval; |
626 |
+ |
627 |
+ io->urbs[i]->dev = io->dev; |
628 |
+- retval = usb_submit_urb(io->urbs[i], GFP_ATOMIC); |
629 |
+- |
630 |
+- /* after we submit, let completions or cancellations fire; |
631 |
+- * we handshake using io->status. |
632 |
+- */ |
633 |
+ spin_unlock_irq(&io->lock); |
634 |
++ |
635 |
++ retval = usb_submit_urb(io->urbs[i], GFP_NOIO); |
636 |
++ |
637 |
+ switch (retval) { |
638 |
+ /* maybe we retrying will recover */ |
639 |
+ case -ENXIO: /* hc didn't queue this one */ |
640 |
+@@ -582,30 +581,34 @@ EXPORT_SYMBOL_GPL(usb_sg_wait); |
641 |
+ void usb_sg_cancel(struct usb_sg_request *io) |
642 |
+ { |
643 |
+ unsigned long flags; |
644 |
++ int i, retval; |
645 |
+ |
646 |
+ spin_lock_irqsave(&io->lock, flags); |
647 |
++ if (io->status || io->count == 0) { |
648 |
++ spin_unlock_irqrestore(&io->lock, flags); |
649 |
++ return; |
650 |
++ } |
651 |
++ /* shut everything down */ |
652 |
++ io->status = -ECONNRESET; |
653 |
++ io->count++; /* Keep the request alive until we're done */ |
654 |
++ spin_unlock_irqrestore(&io->lock, flags); |
655 |
+ |
656 |
+- /* shut everything down, if it didn't already */ |
657 |
+- if (!io->status) { |
658 |
+- int i; |
659 |
+- |
660 |
+- io->status = -ECONNRESET; |
661 |
+- spin_unlock(&io->lock); |
662 |
+- for (i = 0; i < io->entries; i++) { |
663 |
+- int retval; |
664 |
++ for (i = io->entries - 1; i >= 0; --i) { |
665 |
++ usb_block_urb(io->urbs[i]); |
666 |
+ |
667 |
+- if (!io->urbs[i]->dev) |
668 |
+- continue; |
669 |
+- retval = usb_unlink_urb(io->urbs[i]); |
670 |
+- if (retval != -EINPROGRESS |
671 |
+- && retval != -ENODEV |
672 |
+- && retval != -EBUSY |
673 |
+- && retval != -EIDRM) |
674 |
+- dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
675 |
+- __func__, retval); |
676 |
+- } |
677 |
+- spin_lock(&io->lock); |
678 |
++ retval = usb_unlink_urb(io->urbs[i]); |
679 |
++ if (retval != -EINPROGRESS |
680 |
++ && retval != -ENODEV |
681 |
++ && retval != -EBUSY |
682 |
++ && retval != -EIDRM) |
683 |
++ dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
684 |
++ __func__, retval); |
685 |
+ } |
686 |
++ |
687 |
++ spin_lock_irqsave(&io->lock, flags); |
688 |
++ io->count--; |
689 |
++ if (!io->count) |
690 |
++ complete(&io->complete); |
691 |
+ spin_unlock_irqrestore(&io->lock, flags); |
692 |
+ } |
693 |
+ EXPORT_SYMBOL_GPL(usb_sg_cancel); |
694 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
695 |
+index 6c4bb47922ac..27d05f0134de 100644 |
696 |
+--- a/drivers/usb/core/quirks.c |
697 |
++++ b/drivers/usb/core/quirks.c |
698 |
+@@ -272,6 +272,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
699 |
+ /* Corsair K70 LUX */ |
700 |
+ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
701 |
+ |
702 |
++ /* Corsair K70 RGB RAPDIFIRE */ |
703 |
++ { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | |
704 |
++ USB_QUIRK_DELAY_CTRL_MSG }, |
705 |
++ |
706 |
+ /* MIDI keyboard WORLDE MINI */ |
707 |
+ { USB_DEVICE(0x1c75, 0x0204), .driver_info = |
708 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
709 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
710 |
+index 23a9557c8234..f5f4a9927417 100644 |
711 |
+--- a/drivers/usb/gadget/function/f_fs.c |
712 |
++++ b/drivers/usb/gadget/function/f_fs.c |
713 |
+@@ -1511,6 +1511,10 @@ static void ffs_data_reset(struct ffs_data *ffs) |
714 |
+ ffs->state = FFS_READ_DESCRIPTORS; |
715 |
+ ffs->setup_state = FFS_NO_SETUP; |
716 |
+ ffs->flags = 0; |
717 |
++ |
718 |
++ ffs->ms_os_descs_ext_prop_count = 0; |
719 |
++ ffs->ms_os_descs_ext_prop_name_len = 0; |
720 |
++ ffs->ms_os_descs_ext_prop_data_len = 0; |
721 |
+ } |
722 |
+ |
723 |
+ |
724 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
725 |
+index d6199507f861..3a65272fbed8 100644 |
726 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
727 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
728 |
+@@ -546,7 +546,7 @@ static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req, |
729 |
+ { |
730 |
+ struct bdc *bdc = ep->bdc; |
731 |
+ |
732 |
+- if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) |
733 |
++ if (req == NULL) |
734 |
+ return; |
735 |
+ |
736 |
+ dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status); |
737 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c |
738 |
+index b9d50020c684..22da70fada5e 100644 |
739 |
+--- a/drivers/usb/misc/sisusbvga/sisusb.c |
740 |
++++ b/drivers/usb/misc/sisusbvga/sisusb.c |
741 |
+@@ -1243,20 +1243,20 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, |
742 |
+ |
743 |
+ #ifdef INCL_SISUSB_CON |
744 |
+ int |
745 |
+-sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) |
746 |
++sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) |
747 |
+ { |
748 |
+ return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
749 |
+ } |
750 |
+ |
751 |
+ int |
752 |
+-sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) |
753 |
++sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 *data) |
754 |
+ { |
755 |
+ return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
756 |
+ } |
757 |
+ #endif |
758 |
+ |
759 |
+ int |
760 |
+-sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) |
761 |
++sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, u8 index, u8 data) |
762 |
+ { |
763 |
+ int ret; |
764 |
+ ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); |
765 |
+@@ -1265,7 +1265,7 @@ sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data) |
766 |
+ } |
767 |
+ |
768 |
+ int |
769 |
+-sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) |
770 |
++sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, u8 index, u8 *data) |
771 |
+ { |
772 |
+ int ret; |
773 |
+ ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index); |
774 |
+@@ -1274,7 +1274,7 @@ sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data) |
775 |
+ } |
776 |
+ |
777 |
+ int |
778 |
+-sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
779 |
++sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, u8 idx, |
780 |
+ u8 myand, u8 myor) |
781 |
+ { |
782 |
+ int ret; |
783 |
+@@ -1289,7 +1289,7 @@ sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
784 |
+ } |
785 |
+ |
786 |
+ static int |
787 |
+-sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx, |
788 |
++sisusb_setidxregmask(struct sisusb_usb_data *sisusb, u32 port, u8 idx, |
789 |
+ u8 data, u8 mask) |
790 |
+ { |
791 |
+ int ret; |
792 |
+@@ -1303,13 +1303,13 @@ sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx, |
793 |
+ } |
794 |
+ |
795 |
+ int |
796 |
+-sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor) |
797 |
++sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, u8 index, u8 myor) |
798 |
+ { |
799 |
+ return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor)); |
800 |
+ } |
801 |
+ |
802 |
+ int |
803 |
+-sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand) |
804 |
++sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, u8 idx, u8 myand) |
805 |
+ { |
806 |
+ return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00)); |
807 |
+ } |
808 |
+@@ -2849,8 +2849,8 @@ static int |
809 |
+ sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y, |
810 |
+ unsigned long arg) |
811 |
+ { |
812 |
+- int retval, port, length; |
813 |
+- u32 address; |
814 |
++ int retval, length; |
815 |
++ u32 port, address; |
816 |
+ |
817 |
+ /* All our commands require the device |
818 |
+ * to be initialized. |
819 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.h b/drivers/usb/misc/sisusbvga/sisusb_init.h |
820 |
+index c46ce42d4489..82d953e4a6b3 100644 |
821 |
+--- a/drivers/usb/misc/sisusbvga/sisusb_init.h |
822 |
++++ b/drivers/usb/misc/sisusbvga/sisusb_init.h |
823 |
+@@ -811,17 +811,17 @@ static const struct SiS_VCLKData SiSUSB_VCLKData[] = { |
824 |
+ int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
825 |
+ int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); |
826 |
+ |
827 |
+-extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); |
828 |
+-extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data); |
829 |
+-extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
830 |
++extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); |
831 |
++extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); |
832 |
++extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
833 |
+ u8 index, u8 data); |
834 |
+-extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
835 |
++extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
836 |
+ u8 index, u8 * data); |
837 |
+-extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, |
838 |
++extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, |
839 |
+ u8 idx, u8 myand, u8 myor); |
840 |
+-extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, |
841 |
++extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
842 |
+ u8 index, u8 myor); |
843 |
+-extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, |
844 |
++extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
845 |
+ u8 idx, u8 myand); |
846 |
+ |
847 |
+ void sisusb_delete(struct kref *kref); |
848 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
849 |
+index b38d9f162123..698ba127b635 100644 |
850 |
+--- a/drivers/usb/storage/uas.c |
851 |
++++ b/drivers/usb/storage/uas.c |
852 |
+@@ -82,6 +82,19 @@ static void uas_free_streams(struct uas_dev_info *devinfo); |
853 |
+ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
854 |
+ int status); |
855 |
+ |
856 |
++/* |
857 |
++ * This driver needs its own workqueue, as we need to control memory allocation. |
858 |
++ * |
859 |
++ * In the course of error handling and power management uas_wait_for_pending_cmnds() |
860 |
++ * needs to flush pending work items. In these contexts we cannot allocate memory |
861 |
++ * by doing block IO as we would deadlock. For the same reason we cannot wait |
862 |
++ * for anything allocating memory not heeding these constraints. |
863 |
++ * |
864 |
++ * So we have to control all work items that can be on the workqueue we flush. |
865 |
++ * Hence we cannot share a queue and need our own. |
866 |
++ */ |
867 |
++static struct workqueue_struct *workqueue; |
868 |
++ |
869 |
+ static void uas_do_work(struct work_struct *work) |
870 |
+ { |
871 |
+ struct uas_dev_info *devinfo = |
872 |
+@@ -110,7 +123,7 @@ static void uas_do_work(struct work_struct *work) |
873 |
+ if (!err) |
874 |
+ cmdinfo->state &= ~IS_IN_WORK_LIST; |
875 |
+ else |
876 |
+- schedule_work(&devinfo->work); |
877 |
++ queue_work(workqueue, &devinfo->work); |
878 |
+ } |
879 |
+ out: |
880 |
+ spin_unlock_irqrestore(&devinfo->lock, flags); |
881 |
+@@ -135,7 +148,7 @@ static void uas_add_work(struct uas_cmd_info *cmdinfo) |
882 |
+ |
883 |
+ lockdep_assert_held(&devinfo->lock); |
884 |
+ cmdinfo->state |= IS_IN_WORK_LIST; |
885 |
+- schedule_work(&devinfo->work); |
886 |
++ queue_work(workqueue, &devinfo->work); |
887 |
+ } |
888 |
+ |
889 |
+ static void uas_zap_pending(struct uas_dev_info *devinfo, int result) |
890 |
+@@ -191,6 +204,9 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
891 |
+ struct uas_cmd_info *ci = (void *)&cmnd->SCp; |
892 |
+ struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; |
893 |
+ |
894 |
++ if (status == -ENODEV) /* too late */ |
895 |
++ return; |
896 |
++ |
897 |
+ scmd_printk(KERN_INFO, cmnd, |
898 |
+ "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", |
899 |
+ prefix, status, cmdinfo->uas_tag, |
900 |
+@@ -1173,7 +1189,31 @@ static struct usb_driver uas_driver = { |
901 |
+ .id_table = uas_usb_ids, |
902 |
+ }; |
903 |
+ |
904 |
+-module_usb_driver(uas_driver); |
905 |
++static int __init uas_init(void) |
906 |
++{ |
907 |
++ int rv; |
908 |
++ |
909 |
++ workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); |
910 |
++ if (!workqueue) |
911 |
++ return -ENOMEM; |
912 |
++ |
913 |
++ rv = usb_register(&uas_driver); |
914 |
++ if (rv) { |
915 |
++ destroy_workqueue(workqueue); |
916 |
++ return -ENOMEM; |
917 |
++ } |
918 |
++ |
919 |
++ return 0; |
920 |
++} |
921 |
++ |
922 |
++static void __exit uas_exit(void) |
923 |
++{ |
924 |
++ usb_deregister(&uas_driver); |
925 |
++ destroy_workqueue(workqueue); |
926 |
++} |
927 |
++ |
928 |
++module_init(uas_init); |
929 |
++module_exit(uas_exit); |
930 |
+ |
931 |
+ MODULE_LICENSE("GPL"); |
932 |
+ MODULE_AUTHOR( |
933 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
934 |
+index 2e0a8088ffe2..ccf2d50e0d2e 100644 |
935 |
+--- a/drivers/usb/storage/unusual_devs.h |
936 |
++++ b/drivers/usb/storage/unusual_devs.h |
937 |
+@@ -2208,6 +2208,13 @@ UNUSUAL_DEV( 0x3340, 0xffff, 0x0000, 0x0000, |
938 |
+ USB_SC_DEVICE,USB_PR_DEVICE,NULL, |
939 |
+ US_FL_MAX_SECTORS_64 ), |
940 |
+ |
941 |
++/* Reported by Cyril Roelandt <tipecaml@×××××.com> */ |
942 |
++UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, |
943 |
++ "JMicron", |
944 |
++ "USB to ATA/ATAPI Bridge", |
945 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
946 |
++ US_FL_BROKEN_FUA ), |
947 |
++ |
948 |
+ /* Reported by Andrey Rahmatullin <wrar@××××××××.org> */ |
949 |
+ UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, |
950 |
+ "iRiver", |
951 |
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
952 |
+index 056da6ee1a35..df27cefb2fa3 100644 |
953 |
+--- a/drivers/xen/xenbus/xenbus_client.c |
954 |
++++ b/drivers/xen/xenbus/xenbus_client.c |
955 |
+@@ -469,7 +469,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); |
956 |
+ int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, |
957 |
+ unsigned int nr_grefs, void **vaddr) |
958 |
+ { |
959 |
+- return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
960 |
++ int err; |
961 |
++ |
962 |
++ err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
963 |
++ /* Some hypervisors are buggy and can return 1. */ |
964 |
++ if (err > 0) |
965 |
++ err = GNTST_general_error; |
966 |
++ |
967 |
++ return err; |
968 |
+ } |
969 |
+ EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); |
970 |
+ |
971 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
972 |
+index aa4df4a02252..efdf81ea3b5f 100644 |
973 |
+--- a/fs/ceph/caps.c |
974 |
++++ b/fs/ceph/caps.c |
975 |
+@@ -1734,8 +1734,12 @@ retry_locked: |
976 |
+ } |
977 |
+ |
978 |
+ /* want more caps from mds? */ |
979 |
+- if (want & ~(cap->mds_wanted | cap->issued)) |
980 |
+- goto ack; |
981 |
++ if (want & ~cap->mds_wanted) { |
982 |
++ if (want & ~(cap->mds_wanted | cap->issued)) |
983 |
++ goto ack; |
984 |
++ if (!__cap_is_valid(cap)) |
985 |
++ goto ack; |
986 |
++ } |
987 |
+ |
988 |
+ /* things we might delay */ |
989 |
+ if ((cap->issued & ~retain) == 0 && |
990 |
+diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
991 |
+index fe02ae7f056a..ff9e60daf086 100644 |
992 |
+--- a/fs/ceph/export.c |
993 |
++++ b/fs/ceph/export.c |
994 |
+@@ -146,6 +146,11 @@ static struct dentry *__get_parent(struct super_block *sb, |
995 |
+ } |
996 |
+ req->r_num_caps = 1; |
997 |
+ err = ceph_mdsc_do_request(mdsc, NULL, req); |
998 |
++ if (err) { |
999 |
++ ceph_mdsc_put_request(req); |
1000 |
++ return ERR_PTR(err); |
1001 |
++ } |
1002 |
++ |
1003 |
+ inode = req->r_target_inode; |
1004 |
+ if (inode) |
1005 |
+ ihold(inode); |
1006 |
+diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c |
1007 |
+index 02ddec6d8a7d..ccd80f2b3b19 100644 |
1008 |
+--- a/fs/ext4/block_validity.c |
1009 |
++++ b/fs/ext4/block_validity.c |
1010 |
+@@ -136,6 +136,49 @@ static void debug_print_tree(struct ext4_sb_info *sbi) |
1011 |
+ printk("\n"); |
1012 |
+ } |
1013 |
+ |
1014 |
++static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) |
1015 |
++{ |
1016 |
++ struct inode *inode; |
1017 |
++ struct ext4_sb_info *sbi = EXT4_SB(sb); |
1018 |
++ struct ext4_map_blocks map; |
1019 |
++ u32 i = 0, num; |
1020 |
++ int err = 0, n; |
1021 |
++ |
1022 |
++ if ((ino < EXT4_ROOT_INO) || |
1023 |
++ (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) |
1024 |
++ return -EINVAL; |
1025 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_SPECIAL); |
1026 |
++ if (IS_ERR(inode)) |
1027 |
++ return PTR_ERR(inode); |
1028 |
++ num = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
1029 |
++ while (i < num) { |
1030 |
++ map.m_lblk = i; |
1031 |
++ map.m_len = num - i; |
1032 |
++ n = ext4_map_blocks(NULL, inode, &map, 0); |
1033 |
++ if (n < 0) { |
1034 |
++ err = n; |
1035 |
++ break; |
1036 |
++ } |
1037 |
++ if (n == 0) { |
1038 |
++ i++; |
1039 |
++ } else { |
1040 |
++ if (!ext4_data_block_valid(sbi, map.m_pblk, n)) { |
1041 |
++ ext4_error(sb, "blocks %llu-%llu from inode %u " |
1042 |
++ "overlap system zone", map.m_pblk, |
1043 |
++ map.m_pblk + map.m_len - 1, ino); |
1044 |
++ err = -EFSCORRUPTED; |
1045 |
++ break; |
1046 |
++ } |
1047 |
++ err = add_system_zone(sbi, map.m_pblk, n); |
1048 |
++ if (err < 0) |
1049 |
++ break; |
1050 |
++ i += n; |
1051 |
++ } |
1052 |
++ } |
1053 |
++ iput(inode); |
1054 |
++ return err; |
1055 |
++} |
1056 |
++ |
1057 |
+ int ext4_setup_system_zone(struct super_block *sb) |
1058 |
+ { |
1059 |
+ ext4_group_t ngroups = ext4_get_groups_count(sb); |
1060 |
+@@ -170,6 +213,12 @@ int ext4_setup_system_zone(struct super_block *sb) |
1061 |
+ if (ret) |
1062 |
+ return ret; |
1063 |
+ } |
1064 |
++ if (ext4_has_feature_journal(sb) && sbi->s_es->s_journal_inum) { |
1065 |
++ ret = ext4_protect_reserved_inode(sb, |
1066 |
++ le32_to_cpu(sbi->s_es->s_journal_inum)); |
1067 |
++ if (ret) |
1068 |
++ return ret; |
1069 |
++ } |
1070 |
+ |
1071 |
+ if (test_opt(sb, DEBUG)) |
1072 |
+ debug_print_tree(EXT4_SB(sb)); |
1073 |
+@@ -226,6 +275,11 @@ int ext4_check_blockref(const char *function, unsigned int line, |
1074 |
+ __le32 *bref = p; |
1075 |
+ unsigned int blk; |
1076 |
+ |
1077 |
++ if (ext4_has_feature_journal(inode->i_sb) && |
1078 |
++ (inode->i_ino == |
1079 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) |
1080 |
++ return 0; |
1081 |
++ |
1082 |
+ while (bref < p+max) { |
1083 |
+ blk = le32_to_cpu(*bref++); |
1084 |
+ if (blk && |
1085 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
1086 |
+index ab0f08c89d5f..de47525972a1 100644 |
1087 |
+--- a/fs/ext4/ext4.h |
1088 |
++++ b/fs/ext4/ext4.h |
1089 |
+@@ -2497,8 +2497,19 @@ int do_journal_get_write_access(handle_t *handle, |
1090 |
+ #define FALL_BACK_TO_NONDELALLOC 1 |
1091 |
+ #define CONVERT_INLINE_DATA 2 |
1092 |
+ |
1093 |
+-extern struct inode *ext4_iget(struct super_block *, unsigned long); |
1094 |
+-extern struct inode *ext4_iget_normal(struct super_block *, unsigned long); |
1095 |
++typedef enum { |
1096 |
++ EXT4_IGET_NORMAL = 0, |
1097 |
++ EXT4_IGET_SPECIAL = 0x0001, /* OK to iget a system inode */ |
1098 |
++ EXT4_IGET_HANDLE = 0x0002 /* Inode # is from a handle */ |
1099 |
++} ext4_iget_flags; |
1100 |
++ |
1101 |
++extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
1102 |
++ ext4_iget_flags flags, const char *function, |
1103 |
++ unsigned int line); |
1104 |
++ |
1105 |
++#define ext4_iget(sb, ino, flags) \ |
1106 |
++ __ext4_iget((sb), (ino), (flags), __func__, __LINE__) |
1107 |
++ |
1108 |
+ extern int ext4_write_inode(struct inode *, struct writeback_control *); |
1109 |
+ extern int ext4_setattr(struct dentry *, struct iattr *); |
1110 |
+ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, |
1111 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
1112 |
+index 7414bfd5a58e..96336830f035 100644 |
1113 |
+--- a/fs/ext4/extents.c |
1114 |
++++ b/fs/ext4/extents.c |
1115 |
+@@ -505,6 +505,30 @@ int ext4_ext_check_inode(struct inode *inode) |
1116 |
+ return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode), 0); |
1117 |
+ } |
1118 |
+ |
1119 |
++static void ext4_cache_extents(struct inode *inode, |
1120 |
++ struct ext4_extent_header *eh) |
1121 |
++{ |
1122 |
++ struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
1123 |
++ ext4_lblk_t prev = 0; |
1124 |
++ int i; |
1125 |
++ |
1126 |
++ for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
1127 |
++ unsigned int status = EXTENT_STATUS_WRITTEN; |
1128 |
++ ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
1129 |
++ int len = ext4_ext_get_actual_len(ex); |
1130 |
++ |
1131 |
++ if (prev && (prev != lblk)) |
1132 |
++ ext4_es_cache_extent(inode, prev, lblk - prev, ~0, |
1133 |
++ EXTENT_STATUS_HOLE); |
1134 |
++ |
1135 |
++ if (ext4_ext_is_unwritten(ex)) |
1136 |
++ status = EXTENT_STATUS_UNWRITTEN; |
1137 |
++ ext4_es_cache_extent(inode, lblk, len, |
1138 |
++ ext4_ext_pblock(ex), status); |
1139 |
++ prev = lblk + len; |
1140 |
++ } |
1141 |
++} |
1142 |
++ |
1143 |
+ static struct buffer_head * |
1144 |
+ __read_extent_tree_block(const char *function, unsigned int line, |
1145 |
+ struct inode *inode, ext4_fsblk_t pblk, int depth, |
1146 |
+@@ -525,36 +549,21 @@ __read_extent_tree_block(const char *function, unsigned int line, |
1147 |
+ } |
1148 |
+ if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) |
1149 |
+ return bh; |
1150 |
+- err = __ext4_ext_check(function, line, inode, |
1151 |
+- ext_block_hdr(bh), depth, pblk); |
1152 |
+- if (err) |
1153 |
+- goto errout; |
1154 |
++ if (!ext4_has_feature_journal(inode->i_sb) || |
1155 |
++ (inode->i_ino != |
1156 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) { |
1157 |
++ err = __ext4_ext_check(function, line, inode, |
1158 |
++ ext_block_hdr(bh), depth, pblk); |
1159 |
++ if (err) |
1160 |
++ goto errout; |
1161 |
++ } |
1162 |
+ set_buffer_verified(bh); |
1163 |
+ /* |
1164 |
+ * If this is a leaf block, cache all of its entries |
1165 |
+ */ |
1166 |
+ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) { |
1167 |
+ struct ext4_extent_header *eh = ext_block_hdr(bh); |
1168 |
+- struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
1169 |
+- ext4_lblk_t prev = 0; |
1170 |
+- int i; |
1171 |
+- |
1172 |
+- for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
1173 |
+- unsigned int status = EXTENT_STATUS_WRITTEN; |
1174 |
+- ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
1175 |
+- int len = ext4_ext_get_actual_len(ex); |
1176 |
+- |
1177 |
+- if (prev && (prev != lblk)) |
1178 |
+- ext4_es_cache_extent(inode, prev, |
1179 |
+- lblk - prev, ~0, |
1180 |
+- EXTENT_STATUS_HOLE); |
1181 |
+- |
1182 |
+- if (ext4_ext_is_unwritten(ex)) |
1183 |
+- status = EXTENT_STATUS_UNWRITTEN; |
1184 |
+- ext4_es_cache_extent(inode, lblk, len, |
1185 |
+- ext4_ext_pblock(ex), status); |
1186 |
+- prev = lblk + len; |
1187 |
+- } |
1188 |
++ ext4_cache_extents(inode, eh); |
1189 |
+ } |
1190 |
+ return bh; |
1191 |
+ errout: |
1192 |
+@@ -902,6 +911,8 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, |
1193 |
+ path[0].p_bh = NULL; |
1194 |
+ |
1195 |
+ i = depth; |
1196 |
++ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) |
1197 |
++ ext4_cache_extents(inode, eh); |
1198 |
+ /* walk through the tree */ |
1199 |
+ while (i) { |
1200 |
+ ext_debug("depth %d: num %d, max %d\n", |
1201 |
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
1202 |
+index c31b05f0bd69..3753a8a05a2e 100644 |
1203 |
+--- a/fs/ext4/ialloc.c |
1204 |
++++ b/fs/ext4/ialloc.c |
1205 |
+@@ -1150,7 +1150,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
1206 |
+ if (!ext4_test_bit(bit, bitmap_bh->b_data)) |
1207 |
+ goto bad_orphan; |
1208 |
+ |
1209 |
+- inode = ext4_iget(sb, ino); |
1210 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL); |
1211 |
+ if (IS_ERR(inode)) { |
1212 |
+ err = PTR_ERR(inode); |
1213 |
+ ext4_error(sb, "couldn't read orphan inode %lu (err %d)", |
1214 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1215 |
+index a2bb9c60445c..805d38a14002 100644 |
1216 |
+--- a/fs/ext4/inode.c |
1217 |
++++ b/fs/ext4/inode.c |
1218 |
+@@ -377,6 +377,10 @@ static int __check_block_validity(struct inode *inode, const char *func, |
1219 |
+ unsigned int line, |
1220 |
+ struct ext4_map_blocks *map) |
1221 |
+ { |
1222 |
++ if (ext4_has_feature_journal(inode->i_sb) && |
1223 |
++ (inode->i_ino == |
1224 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) |
1225 |
++ return 0; |
1226 |
+ if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, |
1227 |
+ map->m_len)) { |
1228 |
+ ext4_error_inode(inode, func, line, map->m_pblk, |
1229 |
+@@ -4214,7 +4218,9 @@ static inline void ext4_iget_extra_inode(struct inode *inode, |
1230 |
+ EXT4_I(inode)->i_inline_off = 0; |
1231 |
+ } |
1232 |
+ |
1233 |
+-struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1234 |
++struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
1235 |
++ ext4_iget_flags flags, const char *function, |
1236 |
++ unsigned int line) |
1237 |
+ { |
1238 |
+ struct ext4_iloc iloc; |
1239 |
+ struct ext4_inode *raw_inode; |
1240 |
+@@ -4227,6 +4233,18 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1241 |
+ uid_t i_uid; |
1242 |
+ gid_t i_gid; |
1243 |
+ |
1244 |
++ if (((flags & EXT4_IGET_NORMAL) && |
1245 |
++ (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) || |
1246 |
++ (ino < EXT4_ROOT_INO) || |
1247 |
++ (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) { |
1248 |
++ if (flags & EXT4_IGET_HANDLE) |
1249 |
++ return ERR_PTR(-ESTALE); |
1250 |
++ __ext4_error(sb, function, line, |
1251 |
++ "inode #%lu: comm %s: iget: illegal inode #", |
1252 |
++ ino, current->comm); |
1253 |
++ return ERR_PTR(-EFSCORRUPTED); |
1254 |
++ } |
1255 |
++ |
1256 |
+ inode = iget_locked(sb, ino); |
1257 |
+ if (!inode) |
1258 |
+ return ERR_PTR(-ENOMEM); |
1259 |
+@@ -4242,11 +4260,18 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1260 |
+ raw_inode = ext4_raw_inode(&iloc); |
1261 |
+ |
1262 |
+ if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) { |
1263 |
+- EXT4_ERROR_INODE(inode, "root inode unallocated"); |
1264 |
++ ext4_error_inode(inode, function, line, 0, |
1265 |
++ "iget: root inode unallocated"); |
1266 |
+ ret = -EFSCORRUPTED; |
1267 |
+ goto bad_inode; |
1268 |
+ } |
1269 |
+ |
1270 |
++ if ((flags & EXT4_IGET_HANDLE) && |
1271 |
++ (raw_inode->i_links_count == 0) && (raw_inode->i_mode == 0)) { |
1272 |
++ ret = -ESTALE; |
1273 |
++ goto bad_inode; |
1274 |
++ } |
1275 |
++ |
1276 |
+ if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { |
1277 |
+ ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); |
1278 |
+ if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > |
1279 |
+@@ -4273,7 +4298,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1280 |
+ } |
1281 |
+ |
1282 |
+ if (!ext4_inode_csum_verify(inode, raw_inode, ei)) { |
1283 |
+- EXT4_ERROR_INODE(inode, "checksum invalid"); |
1284 |
++ ext4_error_inode(inode, function, line, 0, |
1285 |
++ "iget: checksum invalid"); |
1286 |
+ ret = -EFSBADCRC; |
1287 |
+ goto bad_inode; |
1288 |
+ } |
1289 |
+@@ -4321,7 +4347,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1290 |
+ ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32; |
1291 |
+ inode->i_size = ext4_isize(raw_inode); |
1292 |
+ if ((size = i_size_read(inode)) < 0) { |
1293 |
+- EXT4_ERROR_INODE(inode, "bad i_size value: %lld", size); |
1294 |
++ ext4_error_inode(inode, function, line, 0, |
1295 |
++ "iget: bad i_size value: %lld", size); |
1296 |
+ ret = -EFSCORRUPTED; |
1297 |
+ goto bad_inode; |
1298 |
+ } |
1299 |
+@@ -4404,7 +4431,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1300 |
+ ret = 0; |
1301 |
+ if (ei->i_file_acl && |
1302 |
+ !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { |
1303 |
+- EXT4_ERROR_INODE(inode, "bad extended attribute block %llu", |
1304 |
++ ext4_error_inode(inode, function, line, 0, |
1305 |
++ "iget: bad extended attribute block %llu", |
1306 |
+ ei->i_file_acl); |
1307 |
+ ret = -EFSCORRUPTED; |
1308 |
+ goto bad_inode; |
1309 |
+@@ -4459,7 +4487,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1310 |
+ make_bad_inode(inode); |
1311 |
+ } else { |
1312 |
+ ret = -EFSCORRUPTED; |
1313 |
+- EXT4_ERROR_INODE(inode, "bogus i_mode (%o)", inode->i_mode); |
1314 |
++ ext4_error_inode(inode, function, line, 0, |
1315 |
++ "iget: bogus i_mode (%o)", inode->i_mode); |
1316 |
+ goto bad_inode; |
1317 |
+ } |
1318 |
+ brelse(iloc.bh); |
1319 |
+@@ -4473,13 +4502,6 @@ bad_inode: |
1320 |
+ return ERR_PTR(ret); |
1321 |
+ } |
1322 |
+ |
1323 |
+-struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino) |
1324 |
+-{ |
1325 |
+- if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) |
1326 |
+- return ERR_PTR(-EFSCORRUPTED); |
1327 |
+- return ext4_iget(sb, ino); |
1328 |
+-} |
1329 |
+- |
1330 |
+ static int ext4_inode_blocks_set(handle_t *handle, |
1331 |
+ struct ext4_inode *raw_inode, |
1332 |
+ struct ext4_inode_info *ei) |
1333 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
1334 |
+index b02f210ea617..d4addcc5e4f1 100644 |
1335 |
+--- a/fs/ext4/ioctl.c |
1336 |
++++ b/fs/ext4/ioctl.c |
1337 |
+@@ -105,7 +105,7 @@ static long swap_inode_boot_loader(struct super_block *sb, |
1338 |
+ if (!inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN)) |
1339 |
+ return -EPERM; |
1340 |
+ |
1341 |
+- inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO); |
1342 |
++ inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO, EXT4_IGET_SPECIAL); |
1343 |
+ if (IS_ERR(inode_bl)) |
1344 |
+ return PTR_ERR(inode_bl); |
1345 |
+ ei_bl = EXT4_I(inode_bl); |
1346 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
1347 |
+index fda49f4c5a8e..04fab14e630c 100644 |
1348 |
+--- a/fs/ext4/mballoc.c |
1349 |
++++ b/fs/ext4/mballoc.c |
1350 |
+@@ -1944,7 +1944,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
1351 |
+ int free; |
1352 |
+ |
1353 |
+ free = e4b->bd_info->bb_free; |
1354 |
+- BUG_ON(free <= 0); |
1355 |
++ if (WARN_ON(free <= 0)) |
1356 |
++ return; |
1357 |
+ |
1358 |
+ i = e4b->bd_info->bb_first_free; |
1359 |
+ |
1360 |
+@@ -1965,7 +1966,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
1361 |
+ } |
1362 |
+ |
1363 |
+ mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); |
1364 |
+- BUG_ON(ex.fe_len <= 0); |
1365 |
++ if (WARN_ON(ex.fe_len <= 0)) |
1366 |
++ break; |
1367 |
+ if (free < ex.fe_len) { |
1368 |
+ ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, |
1369 |
+ "%d free clusters as per " |
1370 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
1371 |
+index 49e0d97b2ee7..566a8b08ccdd 100644 |
1372 |
+--- a/fs/ext4/namei.c |
1373 |
++++ b/fs/ext4/namei.c |
1374 |
+@@ -1601,7 +1601,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi |
1375 |
+ dentry); |
1376 |
+ return ERR_PTR(-EFSCORRUPTED); |
1377 |
+ } |
1378 |
+- inode = ext4_iget_normal(dir->i_sb, ino); |
1379 |
++ inode = ext4_iget(dir->i_sb, ino, EXT4_IGET_NORMAL); |
1380 |
+ if (inode == ERR_PTR(-ESTALE)) { |
1381 |
+ EXT4_ERROR_INODE(dir, |
1382 |
+ "deleted inode referenced: %u", |
1383 |
+@@ -1646,7 +1646,7 @@ struct dentry *ext4_get_parent(struct dentry *child) |
1384 |
+ return ERR_PTR(-EFSCORRUPTED); |
1385 |
+ } |
1386 |
+ |
1387 |
+- return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino)); |
1388 |
++ return d_obtain_alias(ext4_iget(d_inode(child)->i_sb, ino, EXT4_IGET_NORMAL)); |
1389 |
+ } |
1390 |
+ |
1391 |
+ /* |
1392 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
1393 |
+index f5b6667b0ab0..7ed01bcc2419 100644 |
1394 |
+--- a/fs/ext4/resize.c |
1395 |
++++ b/fs/ext4/resize.c |
1396 |
+@@ -1649,7 +1649,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) |
1397 |
+ "No reserved GDT blocks, can't resize"); |
1398 |
+ return -EPERM; |
1399 |
+ } |
1400 |
+- inode = ext4_iget(sb, EXT4_RESIZE_INO); |
1401 |
++ inode = ext4_iget(sb, EXT4_RESIZE_INO, EXT4_IGET_SPECIAL); |
1402 |
+ if (IS_ERR(inode)) { |
1403 |
+ ext4_warning(sb, "Error opening resize inode"); |
1404 |
+ return PTR_ERR(inode); |
1405 |
+@@ -1977,7 +1977,8 @@ retry: |
1406 |
+ } |
1407 |
+ |
1408 |
+ if (!resize_inode) |
1409 |
+- resize_inode = ext4_iget(sb, EXT4_RESIZE_INO); |
1410 |
++ resize_inode = ext4_iget(sb, EXT4_RESIZE_INO, |
1411 |
++ EXT4_IGET_SPECIAL); |
1412 |
+ if (IS_ERR(resize_inode)) { |
1413 |
+ ext4_warning(sb, "Error opening resize inode"); |
1414 |
+ return PTR_ERR(resize_inode); |
1415 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
1416 |
+index 67faf147bade..aca086a25b2e 100644 |
1417 |
+--- a/fs/ext4/super.c |
1418 |
++++ b/fs/ext4/super.c |
1419 |
+@@ -1022,20 +1022,11 @@ static struct inode *ext4_nfs_get_inode(struct super_block *sb, |
1420 |
+ { |
1421 |
+ struct inode *inode; |
1422 |
+ |
1423 |
+- if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) |
1424 |
+- return ERR_PTR(-ESTALE); |
1425 |
+- if (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)) |
1426 |
+- return ERR_PTR(-ESTALE); |
1427 |
+- |
1428 |
+- /* iget isn't really right if the inode is currently unallocated!! |
1429 |
+- * |
1430 |
+- * ext4_read_inode will return a bad_inode if the inode had been |
1431 |
+- * deleted, so we should be safe. |
1432 |
+- * |
1433 |
++ /* |
1434 |
+ * Currently we don't know the generation for parent directory, so |
1435 |
+ * a generation of 0 means "accept any" |
1436 |
+ */ |
1437 |
+- inode = ext4_iget_normal(sb, ino); |
1438 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_HANDLE); |
1439 |
+ if (IS_ERR(inode)) |
1440 |
+ return ERR_CAST(inode); |
1441 |
+ if (generation && inode->i_generation != generation) { |
1442 |
+@@ -4036,7 +4027,7 @@ no_journal: |
1443 |
+ * so we can safely mount the rest of the filesystem now. |
1444 |
+ */ |
1445 |
+ |
1446 |
+- root = ext4_iget(sb, EXT4_ROOT_INO); |
1447 |
++ root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL); |
1448 |
+ if (IS_ERR(root)) { |
1449 |
+ ext4_msg(sb, KERN_ERR, "get root inode failed"); |
1450 |
+ ret = PTR_ERR(root); |
1451 |
+@@ -4273,11 +4264,12 @@ static journal_t *ext4_get_journal(struct super_block *sb, |
1452 |
+ |
1453 |
+ BUG_ON(!ext4_has_feature_journal(sb)); |
1454 |
+ |
1455 |
+- /* First, test for the existence of a valid inode on disk. Bad |
1456 |
+- * things happen if we iget() an unused inode, as the subsequent |
1457 |
+- * iput() will try to delete it. */ |
1458 |
+- |
1459 |
+- journal_inode = ext4_iget(sb, journal_inum); |
1460 |
++ /* |
1461 |
++ * Test for the existence of a valid inode on disk. Bad things |
1462 |
++ * happen if we iget() an unused inode, as the subsequent iput() |
1463 |
++ * will try to delete it. |
1464 |
++ */ |
1465 |
++ journal_inode = ext4_iget(sb, journal_inum, EXT4_IGET_SPECIAL); |
1466 |
+ if (IS_ERR(journal_inode)) { |
1467 |
+ ext4_msg(sb, KERN_ERR, "no journal found"); |
1468 |
+ return NULL; |
1469 |
+@@ -5241,7 +5233,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id, |
1470 |
+ if (!qf_inums[type]) |
1471 |
+ return -EPERM; |
1472 |
+ |
1473 |
+- qf_inode = ext4_iget(sb, qf_inums[type]); |
1474 |
++ qf_inode = ext4_iget(sb, qf_inums[type], EXT4_IGET_SPECIAL); |
1475 |
+ if (IS_ERR(qf_inode)) { |
1476 |
+ ext4_error(sb, "Bad quota inode # %lu", qf_inums[type]); |
1477 |
+ return PTR_ERR(qf_inode); |
1478 |
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
1479 |
+index 16891f5364af..8142f6bf3d31 100644 |
1480 |
+--- a/fs/fuse/dev.c |
1481 |
++++ b/fs/fuse/dev.c |
1482 |
+@@ -145,9 +145,13 @@ static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) |
1483 |
+ |
1484 |
+ static void fuse_drop_waiting(struct fuse_conn *fc) |
1485 |
+ { |
1486 |
+- if (fc->connected) { |
1487 |
+- atomic_dec(&fc->num_waiting); |
1488 |
+- } else if (atomic_dec_and_test(&fc->num_waiting)) { |
1489 |
++ /* |
1490 |
++ * lockess check of fc->connected is okay, because atomic_dec_and_test() |
1491 |
++ * provides a memory barrier mached with the one in fuse_wait_aborted() |
1492 |
++ * to ensure no wake-up is missed. |
1493 |
++ */ |
1494 |
++ if (atomic_dec_and_test(&fc->num_waiting) && |
1495 |
++ !READ_ONCE(fc->connected)) { |
1496 |
+ /* wake up aborters */ |
1497 |
+ wake_up_all(&fc->blocked_waitq); |
1498 |
+ } |
1499 |
+@@ -2222,6 +2226,8 @@ EXPORT_SYMBOL_GPL(fuse_abort_conn); |
1500 |
+ |
1501 |
+ void fuse_wait_aborted(struct fuse_conn *fc) |
1502 |
+ { |
1503 |
++ /* matches implicit memory barrier in fuse_drop_waiting() */ |
1504 |
++ smp_mb(); |
1505 |
+ wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); |
1506 |
+ } |
1507 |
+ |
1508 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
1509 |
+index 88c5d5bddf74..5fb1e4a430f8 100644 |
1510 |
+--- a/fs/namespace.c |
1511 |
++++ b/fs/namespace.c |
1512 |
+@@ -3161,8 +3161,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, |
1513 |
+ /* make certain new is below the root */ |
1514 |
+ if (!is_path_reachable(new_mnt, new.dentry, &root)) |
1515 |
+ goto out4; |
1516 |
+- root_mp->m_count++; /* pin it so it won't go away */ |
1517 |
+ lock_mount_hash(); |
1518 |
++ root_mp->m_count++; /* pin it so it won't go away */ |
1519 |
+ detach_mnt(new_mnt, &parent_path); |
1520 |
+ detach_mnt(root_mnt, &root_parent); |
1521 |
+ if (root_mnt->mnt.mnt_flags & MNT_LOCKED) { |
1522 |
+diff --git a/fs/pnode.c b/fs/pnode.c |
1523 |
+index d15c63e97ef1..64e9a401d67d 100644 |
1524 |
+--- a/fs/pnode.c |
1525 |
++++ b/fs/pnode.c |
1526 |
+@@ -268,14 +268,13 @@ static int propagate_one(struct mount *m) |
1527 |
+ if (IS_ERR(child)) |
1528 |
+ return PTR_ERR(child); |
1529 |
+ child->mnt.mnt_flags &= ~MNT_LOCKED; |
1530 |
++ read_seqlock_excl(&mount_lock); |
1531 |
+ mnt_set_mountpoint(m, mp, child); |
1532 |
++ if (m->mnt_master != dest_master) |
1533 |
++ SET_MNT_MARK(m->mnt_master); |
1534 |
++ read_sequnlock_excl(&mount_lock); |
1535 |
+ last_dest = m; |
1536 |
+ last_source = child; |
1537 |
+- if (m->mnt_master != dest_master) { |
1538 |
+- read_seqlock_excl(&mount_lock); |
1539 |
+- SET_MNT_MARK(m->mnt_master); |
1540 |
+- read_sequnlock_excl(&mount_lock); |
1541 |
+- } |
1542 |
+ hlist_add_head(&child->mnt_hash, list); |
1543 |
+ return count_mounts(m->mnt_ns, child); |
1544 |
+ } |
1545 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
1546 |
+index d7ce4e3280db..19291f86d16c 100644 |
1547 |
+--- a/include/linux/kvm_host.h |
1548 |
++++ b/include/linux/kvm_host.h |
1549 |
+@@ -934,7 +934,7 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) |
1550 |
+ start = slot + 1; |
1551 |
+ } |
1552 |
+ |
1553 |
+- if (gfn >= memslots[start].base_gfn && |
1554 |
++ if (start < slots->used_slots && gfn >= memslots[start].base_gfn && |
1555 |
+ gfn < memslots[start].base_gfn + memslots[start].npages) { |
1556 |
+ atomic_set(&slots->lru_slot, start); |
1557 |
+ return &memslots[start]; |
1558 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
1559 |
+index 3bdd6ef95717..6e53dd63728d 100644 |
1560 |
+--- a/include/net/tcp.h |
1561 |
++++ b/include/net/tcp.h |
1562 |
+@@ -52,7 +52,7 @@ extern struct inet_hashinfo tcp_hashinfo; |
1563 |
+ extern struct percpu_counter tcp_orphan_count; |
1564 |
+ void tcp_time_wait(struct sock *sk, int state, int timeo); |
1565 |
+ |
1566 |
+-#define MAX_TCP_HEADER (128 + MAX_HEADER) |
1567 |
++#define MAX_TCP_HEADER L1_CACHE_ALIGN(128 + MAX_HEADER) |
1568 |
+ #define MAX_TCP_OPTION_SPACE 40 |
1569 |
+ #define TCP_MIN_SND_MSS 48 |
1570 |
+ #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE) |
1571 |
+diff --git a/ipc/util.c b/ipc/util.c |
1572 |
+index 0f401d94b7c6..2724f9071ab3 100644 |
1573 |
+--- a/ipc/util.c |
1574 |
++++ b/ipc/util.c |
1575 |
+@@ -756,13 +756,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, |
1576 |
+ total++; |
1577 |
+ } |
1578 |
+ |
1579 |
++ *new_pos = pos + 1; |
1580 |
+ if (total >= ids->in_use) |
1581 |
+ return NULL; |
1582 |
+ |
1583 |
+ for (; pos < IPCMNI; pos++) { |
1584 |
+ ipc = idr_find(&ids->ipcs_idr, pos); |
1585 |
+ if (ipc != NULL) { |
1586 |
+- *new_pos = pos + 1; |
1587 |
+ rcu_read_lock(); |
1588 |
+ ipc_lock_object(ipc); |
1589 |
+ return ipc; |
1590 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
1591 |
+index 84c445db5fe1..b685672def35 100644 |
1592 |
+--- a/kernel/audit.c |
1593 |
++++ b/kernel/audit.c |
1594 |
+@@ -919,6 +919,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
1595 |
+ case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2: |
1596 |
+ if (!audit_enabled && msg_type != AUDIT_USER_AVC) |
1597 |
+ return 0; |
1598 |
++ /* exit early if there isn't at least one character to print */ |
1599 |
++ if (data_len < 2) |
1600 |
++ return -EINVAL; |
1601 |
+ |
1602 |
+ err = audit_filter_user(msg_type); |
1603 |
+ if (err == 1) { /* match or error */ |
1604 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
1605 |
+index 203384a71fee..feff3ba98cc9 100644 |
1606 |
+--- a/kernel/events/core.c |
1607 |
++++ b/kernel/events/core.c |
1608 |
+@@ -5810,10 +5810,17 @@ static void perf_event_task_output(struct perf_event *event, |
1609 |
+ goto out; |
1610 |
+ |
1611 |
+ task_event->event_id.pid = perf_event_pid(event, task); |
1612 |
+- task_event->event_id.ppid = perf_event_pid(event, current); |
1613 |
+- |
1614 |
+ task_event->event_id.tid = perf_event_tid(event, task); |
1615 |
+- task_event->event_id.ptid = perf_event_tid(event, current); |
1616 |
++ |
1617 |
++ if (task_event->event_id.header.type == PERF_RECORD_EXIT) { |
1618 |
++ task_event->event_id.ppid = perf_event_pid(event, |
1619 |
++ task->real_parent); |
1620 |
++ task_event->event_id.ptid = perf_event_pid(event, |
1621 |
++ task->real_parent); |
1622 |
++ } else { /* PERF_RECORD_FORK */ |
1623 |
++ task_event->event_id.ppid = perf_event_pid(event, current); |
1624 |
++ task_event->event_id.ptid = perf_event_tid(event, current); |
1625 |
++ } |
1626 |
+ |
1627 |
+ task_event->event_id.time = perf_event_clock(event); |
1628 |
+ |
1629 |
+diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c |
1630 |
+index edf67c493a8e..e473f6a1f6ca 100644 |
1631 |
+--- a/kernel/gcov/fs.c |
1632 |
++++ b/kernel/gcov/fs.c |
1633 |
+@@ -108,9 +108,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos) |
1634 |
+ { |
1635 |
+ struct gcov_iterator *iter = data; |
1636 |
+ |
1637 |
++ (*pos)++; |
1638 |
+ if (gcov_iter_next(iter)) |
1639 |
+ return NULL; |
1640 |
+- (*pos)++; |
1641 |
+ |
1642 |
+ return iter; |
1643 |
+ } |
1644 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
1645 |
+index 3f48c7d6ca31..2fd6fce1851f 100644 |
1646 |
+--- a/net/ipv4/ip_vti.c |
1647 |
++++ b/net/ipv4/ip_vti.c |
1648 |
+@@ -666,10 +666,8 @@ static int __init vti_init(void) |
1649 |
+ |
1650 |
+ msg = "ipip tunnel"; |
1651 |
+ err = xfrm4_tunnel_register(&ipip_handler, AF_INET); |
1652 |
+- if (err < 0) { |
1653 |
+- pr_info("%s: cant't register tunnel\n",__func__); |
1654 |
++ if (err < 0) |
1655 |
+ goto xfrm_tunnel_failed; |
1656 |
+- } |
1657 |
+ |
1658 |
+ msg = "netlink interface"; |
1659 |
+ err = rtnl_link_register(&vti_link_ops); |
1660 |
+diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c |
1661 |
+index 3fb4aeeabf00..24ce13a79665 100644 |
1662 |
+--- a/net/ipv4/raw.c |
1663 |
++++ b/net/ipv4/raw.c |
1664 |
+@@ -507,9 +507,11 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
1665 |
+ goto out; |
1666 |
+ |
1667 |
+ /* hdrincl should be READ_ONCE(inet->hdrincl) |
1668 |
+- * but READ_ONCE() doesn't work with bit fields |
1669 |
++ * but READ_ONCE() doesn't work with bit fields. |
1670 |
++ * Doing this indirectly yields the same result. |
1671 |
+ */ |
1672 |
+ hdrincl = inet->hdrincl; |
1673 |
++ hdrincl = READ_ONCE(hdrincl); |
1674 |
+ /* |
1675 |
+ * Check the flags. |
1676 |
+ */ |
1677 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
1678 |
+index 988c132319c4..74ae703c6909 100644 |
1679 |
+--- a/net/ipv4/route.c |
1680 |
++++ b/net/ipv4/route.c |
1681 |
+@@ -131,8 +131,6 @@ static int ip_rt_min_advmss __read_mostly = 256; |
1682 |
+ |
1683 |
+ static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; |
1684 |
+ |
1685 |
+-static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; |
1686 |
+- |
1687 |
+ /* |
1688 |
+ * Interface to generic destination cache. |
1689 |
+ */ |
1690 |
+@@ -2705,6 +2703,7 @@ void ip_rt_multicast_event(struct in_device *in_dev) |
1691 |
+ static int ip_rt_gc_interval __read_mostly = 60 * HZ; |
1692 |
+ static int ip_rt_gc_min_interval __read_mostly = HZ / 2; |
1693 |
+ static int ip_rt_gc_elasticity __read_mostly = 8; |
1694 |
++static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; |
1695 |
+ |
1696 |
+ static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write, |
1697 |
+ void __user *buffer, |
1698 |
+diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c |
1699 |
+index 7ee6518afa86..73705a2368d9 100644 |
1700 |
+--- a/net/ipv4/xfrm4_output.c |
1701 |
++++ b/net/ipv4/xfrm4_output.c |
1702 |
+@@ -75,9 +75,7 @@ int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb) |
1703 |
+ { |
1704 |
+ memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
1705 |
+ |
1706 |
+-#ifdef CONFIG_NETFILTER |
1707 |
+ IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
1708 |
+-#endif |
1709 |
+ |
1710 |
+ return xfrm_output(sk, skb); |
1711 |
+ } |
1712 |
+diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c |
1713 |
+index bd2a6ec7572a..e5513b7b5abf 100644 |
1714 |
+--- a/net/ipv6/ipv6_sockglue.c |
1715 |
++++ b/net/ipv6/ipv6_sockglue.c |
1716 |
+@@ -185,15 +185,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
1717 |
+ retv = -EBUSY; |
1718 |
+ break; |
1719 |
+ } |
1720 |
+- } else if (sk->sk_protocol == IPPROTO_TCP) { |
1721 |
+- if (sk->sk_prot != &tcpv6_prot) { |
1722 |
+- retv = -EBUSY; |
1723 |
+- break; |
1724 |
+- } |
1725 |
+- break; |
1726 |
+- } else { |
1727 |
++ } |
1728 |
++ if (sk->sk_protocol == IPPROTO_TCP && |
1729 |
++ sk->sk_prot != &tcpv6_prot) { |
1730 |
++ retv = -EBUSY; |
1731 |
+ break; |
1732 |
+ } |
1733 |
++ if (sk->sk_protocol != IPPROTO_TCP) |
1734 |
++ break; |
1735 |
+ if (sk->sk_state != TCP_ESTABLISHED) { |
1736 |
+ retv = -ENOTCONN; |
1737 |
+ break; |
1738 |
+diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c |
1739 |
+index 64862c5084ee..b2dc9a820c6a 100644 |
1740 |
+--- a/net/ipv6/xfrm6_output.c |
1741 |
++++ b/net/ipv6/xfrm6_output.c |
1742 |
+@@ -125,9 +125,7 @@ int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb) |
1743 |
+ { |
1744 |
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); |
1745 |
+ |
1746 |
+-#ifdef CONFIG_NETFILTER |
1747 |
+ IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; |
1748 |
+-#endif |
1749 |
+ |
1750 |
+ return xfrm_output(sk, skb); |
1751 |
+ } |
1752 |
+diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c |
1753 |
+index d72a4f1558f2..ef6a3d586591 100644 |
1754 |
+--- a/net/netrom/nr_route.c |
1755 |
++++ b/net/netrom/nr_route.c |
1756 |
+@@ -199,6 +199,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, |
1757 |
+ /* refcount initialized at 1 */ |
1758 |
+ spin_unlock_bh(&nr_node_list_lock); |
1759 |
+ |
1760 |
++ nr_neigh_put(nr_neigh); |
1761 |
+ return 0; |
1762 |
+ } |
1763 |
+ nr_node_lock(nr_node); |
1764 |
+diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
1765 |
+index 2b6c88b9a038..5803d0807e9a 100644 |
1766 |
+--- a/net/sctp/socket.c |
1767 |
++++ b/net/sctp/socket.c |
1768 |
+@@ -185,13 +185,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc, |
1769 |
+ list_for_each_entry(chunk, &t->transmitted, transmitted_list) |
1770 |
+ cb(chunk); |
1771 |
+ |
1772 |
+- list_for_each_entry(chunk, &q->retransmit, list) |
1773 |
++ list_for_each_entry(chunk, &q->retransmit, transmitted_list) |
1774 |
+ cb(chunk); |
1775 |
+ |
1776 |
+- list_for_each_entry(chunk, &q->sacked, list) |
1777 |
++ list_for_each_entry(chunk, &q->sacked, transmitted_list) |
1778 |
+ cb(chunk); |
1779 |
+ |
1780 |
+- list_for_each_entry(chunk, &q->abandoned, list) |
1781 |
++ list_for_each_entry(chunk, &q->abandoned, transmitted_list) |
1782 |
+ cb(chunk); |
1783 |
+ |
1784 |
+ list_for_each_entry(chunk, &q->out_chunk_list, list) |
1785 |
+diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c |
1786 |
+index 39231237e1c3..30f71620d4e3 100644 |
1787 |
+--- a/net/x25/x25_dev.c |
1788 |
++++ b/net/x25/x25_dev.c |
1789 |
+@@ -120,8 +120,10 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, |
1790 |
+ goto drop; |
1791 |
+ } |
1792 |
+ |
1793 |
+- if (!pskb_may_pull(skb, 1)) |
1794 |
++ if (!pskb_may_pull(skb, 1)) { |
1795 |
++ x25_neigh_put(nb); |
1796 |
+ return 0; |
1797 |
++ } |
1798 |
+ |
1799 |
+ switch (skb->data[0]) { |
1800 |
+ |
1801 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
1802 |
+index faf255439702..da9f6749b3be 100644 |
1803 |
+--- a/sound/pci/hda/hda_intel.c |
1804 |
++++ b/sound/pci/hda/hda_intel.c |
1805 |
+@@ -1978,7 +1978,6 @@ static const struct hdac_io_ops pci_hda_io_ops = { |
1806 |
+ * should be ignored from the beginning. |
1807 |
+ */ |
1808 |
+ static const struct snd_pci_quirk driver_blacklist[] = { |
1809 |
+- SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0), |
1810 |
+ SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0), |
1811 |
+ SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0), |
1812 |
+ {} |
1813 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1814 |
+index 76cf438aa339..b236e94b5808 100644 |
1815 |
+--- a/sound/pci/hda/patch_realtek.c |
1816 |
++++ b/sound/pci/hda/patch_realtek.c |
1817 |
+@@ -3500,7 +3500,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, |
1818 |
+ } |
1819 |
+ } |
1820 |
+ |
1821 |
+-#if IS_REACHABLE(INPUT) |
1822 |
++#if IS_REACHABLE(CONFIG_INPUT) |
1823 |
+ static void gpio2_mic_hotkey_event(struct hda_codec *codec, |
1824 |
+ struct hda_jack_callback *event) |
1825 |
+ { |
1826 |
+diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c |
1827 |
+index b070d4754745..067cee92d333 100644 |
1828 |
+--- a/sound/soc/intel/atom/sst-atom-controls.c |
1829 |
++++ b/sound/soc/intel/atom/sst-atom-controls.c |
1830 |
+@@ -963,7 +963,9 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w, |
1831 |
+ dev_dbg(c->dev, "Enter: widget=%s\n", w->name); |
1832 |
+ |
1833 |
+ if (SND_SOC_DAPM_EVENT_ON(event)) { |
1834 |
++ mutex_lock(&drv->lock); |
1835 |
+ ret = sst_send_slot_map(drv); |
1836 |
++ mutex_unlock(&drv->lock); |
1837 |
+ if (ret) |
1838 |
+ return ret; |
1839 |
+ ret = sst_send_pipe_module_params(w, k); |
1840 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
1841 |
+index 2798f4bb7fe4..e7714c030a2e 100644 |
1842 |
+--- a/sound/soc/soc-dapm.c |
1843 |
++++ b/sound/soc/soc-dapm.c |
1844 |
+@@ -384,7 +384,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, |
1845 |
+ |
1846 |
+ memset(&template, 0, sizeof(template)); |
1847 |
+ template.reg = e->reg; |
1848 |
+- template.mask = e->mask << e->shift_l; |
1849 |
++ template.mask = e->mask; |
1850 |
+ template.shift = e->shift_l; |
1851 |
+ template.off_val = snd_soc_enum_item_to_val(e, 0); |
1852 |
+ template.on_val = template.off_val; |
1853 |
+@@ -510,8 +510,22 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, |
1854 |
+ if (data->value == value) |
1855 |
+ return false; |
1856 |
+ |
1857 |
+- if (data->widget) |
1858 |
+- data->widget->on_val = value; |
1859 |
++ if (data->widget) { |
1860 |
++ switch (dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->id) { |
1861 |
++ case snd_soc_dapm_switch: |
1862 |
++ case snd_soc_dapm_mixer: |
1863 |
++ case snd_soc_dapm_mixer_named_ctl: |
1864 |
++ data->widget->on_val = value & data->widget->mask; |
1865 |
++ break; |
1866 |
++ case snd_soc_dapm_demux: |
1867 |
++ case snd_soc_dapm_mux: |
1868 |
++ data->widget->on_val = value >> data->widget->shift; |
1869 |
++ break; |
1870 |
++ default: |
1871 |
++ data->widget->on_val = value; |
1872 |
++ break; |
1873 |
++ } |
1874 |
++ } |
1875 |
+ |
1876 |
+ data->value = value; |
1877 |
+ |
1878 |
+diff --git a/sound/usb/format.c b/sound/usb/format.c |
1879 |
+index 789d19ec035d..f28a41194d17 100644 |
1880 |
+--- a/sound/usb/format.c |
1881 |
++++ b/sound/usb/format.c |
1882 |
+@@ -222,6 +222,52 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof |
1883 |
+ return 0; |
1884 |
+ } |
1885 |
+ |
1886 |
++/* |
1887 |
++ * Many Focusrite devices supports a limited set of sampling rates per |
1888 |
++ * altsetting. Maximum rate is exposed in the last 4 bytes of Format Type |
1889 |
++ * descriptor which has a non-standard bLength = 10. |
1890 |
++ */ |
1891 |
++static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip, |
1892 |
++ struct audioformat *fp, |
1893 |
++ unsigned int rate) |
1894 |
++{ |
1895 |
++ struct usb_interface *iface; |
1896 |
++ struct usb_host_interface *alts; |
1897 |
++ unsigned char *fmt; |
1898 |
++ unsigned int max_rate; |
1899 |
++ |
1900 |
++ iface = usb_ifnum_to_if(chip->dev, fp->iface); |
1901 |
++ if (!iface) |
1902 |
++ return true; |
1903 |
++ |
1904 |
++ alts = &iface->altsetting[fp->altset_idx]; |
1905 |
++ fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, |
1906 |
++ NULL, UAC_FORMAT_TYPE); |
1907 |
++ if (!fmt) |
1908 |
++ return true; |
1909 |
++ |
1910 |
++ if (fmt[0] == 10) { /* bLength */ |
1911 |
++ max_rate = combine_quad(&fmt[6]); |
1912 |
++ |
1913 |
++ /* Validate max rate */ |
1914 |
++ if (max_rate != 48000 && |
1915 |
++ max_rate != 96000 && |
1916 |
++ max_rate != 192000 && |
1917 |
++ max_rate != 384000) { |
1918 |
++ |
1919 |
++ usb_audio_info(chip, |
1920 |
++ "%u:%d : unexpected max rate: %u\n", |
1921 |
++ fp->iface, fp->altsetting, max_rate); |
1922 |
++ |
1923 |
++ return true; |
1924 |
++ } |
1925 |
++ |
1926 |
++ return rate <= max_rate; |
1927 |
++ } |
1928 |
++ |
1929 |
++ return true; |
1930 |
++} |
1931 |
++ |
1932 |
+ /* |
1933 |
+ * Helper function to walk the array of sample rate triplets reported by |
1934 |
+ * the device. The problem is that we need to parse whole array first to |
1935 |
+@@ -258,6 +304,11 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
1936 |
+ } |
1937 |
+ |
1938 |
+ for (rate = min; rate <= max; rate += res) { |
1939 |
++ /* Filter out invalid rates on Focusrite devices */ |
1940 |
++ if (USB_ID_VENDOR(chip->usb_id) == 0x1235 && |
1941 |
++ !focusrite_valid_sample_rate(chip, fp, rate)) |
1942 |
++ goto skip_rate; |
1943 |
++ |
1944 |
+ if (fp->rate_table) |
1945 |
+ fp->rate_table[nr_rates] = rate; |
1946 |
+ if (!fp->rate_min || rate < fp->rate_min) |
1947 |
+@@ -272,6 +323,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
1948 |
+ break; |
1949 |
+ } |
1950 |
+ |
1951 |
++skip_rate: |
1952 |
+ /* avoid endless loop */ |
1953 |
+ if (res == 0) |
1954 |
+ break; |
1955 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
1956 |
+index f4fd9548c529..723b535ca2ec 100644 |
1957 |
+--- a/sound/usb/mixer_quirks.c |
1958 |
++++ b/sound/usb/mixer_quirks.c |
1959 |
+@@ -1519,11 +1519,15 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, |
1960 |
+ |
1961 |
+ /* use known values for that card: interface#1 altsetting#1 */ |
1962 |
+ iface = usb_ifnum_to_if(chip->dev, 1); |
1963 |
+- if (!iface || iface->num_altsetting < 2) |
1964 |
+- return -EINVAL; |
1965 |
++ if (!iface || iface->num_altsetting < 2) { |
1966 |
++ err = -EINVAL; |
1967 |
++ goto end; |
1968 |
++ } |
1969 |
+ alts = &iface->altsetting[1]; |
1970 |
+- if (get_iface_desc(alts)->bNumEndpoints < 1) |
1971 |
+- return -EINVAL; |
1972 |
++ if (get_iface_desc(alts)->bNumEndpoints < 1) { |
1973 |
++ err = -EINVAL; |
1974 |
++ goto end; |
1975 |
++ } |
1976 |
+ ep = get_endpoint(alts, 0)->bEndpointAddress; |
1977 |
+ |
1978 |
+ err = snd_usb_ctl_msg(chip->dev, |
1979 |
+diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c |
1980 |
+index 61d5dc2a3421..ca2e61c10892 100644 |
1981 |
+--- a/sound/usb/usx2y/usbusx2yaudio.c |
1982 |
++++ b/sound/usb/usx2y/usbusx2yaudio.c |
1983 |
+@@ -691,6 +691,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) |
1984 |
+ us->submitted = 2*NOOF_SETRATE_URBS; |
1985 |
+ for (i = 0; i < NOOF_SETRATE_URBS; ++i) { |
1986 |
+ struct urb *urb = us->urb[i]; |
1987 |
++ if (!urb) |
1988 |
++ continue; |
1989 |
+ if (urb->status) { |
1990 |
+ if (!err) |
1991 |
+ err = -ENODEV; |