1 |
commit: b0b7e47335f3cc4ccb6ea594f1a1c8d663651988 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 2 19:22:06 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 2 19:22:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b0b7e473 |
7 |
|
8 |
Linux patch 4.9.221 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1220_linux-4.9.221.patch | 2303 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2307 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index ba1ce88..68ee429 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -923,6 +923,10 @@ Patch: 1219_linux-4.9.220.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.220 |
23 |
|
24 |
+Patch: 1220_linux-4.9.221.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.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.9.221.patch b/1220_linux-4.9.221.patch |
33 |
new file mode 100644 |
34 |
index 0000000..7ce4b5a |
35 |
--- /dev/null |
36 |
+++ b/1220_linux-4.9.221.patch |
37 |
@@ -0,0 +1,2303 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index e7866bc2d817..b919a66788b5 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,6 +1,6 @@ |
43 |
+ VERSION = 4 |
44 |
+ PATCHLEVEL = 9 |
45 |
+-SUBLEVEL = 220 |
46 |
++SUBLEVEL = 221 |
47 |
+ EXTRAVERSION = |
48 |
+ NAME = Roaring Lionus |
49 |
+ |
50 |
+diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile |
51 |
+index 3a4014870a91..44c6ea0b86a6 100644 |
52 |
+--- a/arch/arm/mach-imx/Makefile |
53 |
++++ b/arch/arm/mach-imx/Makefile |
54 |
+@@ -86,8 +86,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_IMX1) += mach-imx1.o |
65 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
66 |
+index 2ad59d8553a5..b62886f10dc1 100644 |
67 |
+--- a/arch/x86/kvm/vmx.c |
68 |
++++ b/arch/x86/kvm/vmx.c |
69 |
+@@ -5785,7 +5785,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 d9dabd0c31fc..eb5734112cb4 100644 |
80 |
+--- a/arch/x86/net/bpf_jit_comp.c |
81 |
++++ b/arch/x86/net/bpf_jit_comp.c |
82 |
+@@ -150,6 +150,19 @@ static bool is_ereg(u32 reg) |
83 |
+ BIT(BPF_REG_AX)); |
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 |
+@@ -771,9 +784,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/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c |
115 |
+index f9aa47ec7af7..b78f6a347f29 100644 |
116 |
+--- a/drivers/char/tpm/tpm_tis_core.c |
117 |
++++ b/drivers/char/tpm/tpm_tis_core.c |
118 |
+@@ -329,6 +329,9 @@ static void disable_interrupts(struct tpm_chip *chip) |
119 |
+ u32 intmask; |
120 |
+ int rc; |
121 |
+ |
122 |
++ if (priv->irq == 0) |
123 |
++ return; |
124 |
++ |
125 |
+ rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); |
126 |
+ if (rc < 0) |
127 |
+ intmask = 0; |
128 |
+@@ -786,9 +789,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, |
129 |
+ if (irq) { |
130 |
+ tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, |
131 |
+ irq); |
132 |
+- if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) |
133 |
++ if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) { |
134 |
+ dev_err(&chip->dev, FW_BUG |
135 |
+ "TPM interrupt not working, polling instead\n"); |
136 |
++ |
137 |
++ disable_interrupts(chip); |
138 |
++ } |
139 |
+ } else { |
140 |
+ tpm_tis_probe_irq(chip, intmask); |
141 |
+ } |
142 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
143 |
+index 78212ba16eeb..34839b539207 100644 |
144 |
+--- a/drivers/crypto/mxs-dcp.c |
145 |
++++ b/drivers/crypto/mxs-dcp.c |
146 |
+@@ -37,11 +37,11 @@ |
147 |
+ * Null hashes to align with hw behavior on imx6sl and ull |
148 |
+ * these are flipped for consistency with hw output |
149 |
+ */ |
150 |
+-const uint8_t sha1_null_hash[] = |
151 |
++static const uint8_t sha1_null_hash[] = |
152 |
+ "\x09\x07\xd8\xaf\x90\x18\x60\x95\xef\xbf" |
153 |
+ "\x55\x32\x0d\x4b\x6b\x5e\xee\xa3\x39\xda"; |
154 |
+ |
155 |
+-const uint8_t sha256_null_hash[] = |
156 |
++static const uint8_t sha256_null_hash[] = |
157 |
+ "\x55\xb8\x52\x78\x1b\x99\x95\xa4" |
158 |
+ "\x4c\x93\x9b\x64\xe4\x41\xae\x27" |
159 |
+ "\x24\xb9\x6f\x99\xc8\xf4\xfb\x9a" |
160 |
+diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c |
161 |
+index 569e8c45a59a..983ce7965c7f 100644 |
162 |
+--- a/drivers/gpu/drm/msm/msm_gem.c |
163 |
++++ b/drivers/gpu/drm/msm/msm_gem.c |
164 |
+@@ -58,7 +58,7 @@ static void sync_for_device(struct msm_gem_object *msm_obj) |
165 |
+ { |
166 |
+ struct device *dev = msm_obj->base.dev->dev; |
167 |
+ |
168 |
+- if (get_dma_ops(dev)) { |
169 |
++ if (get_dma_ops(dev) && IS_ENABLED(CONFIG_ARM64)) { |
170 |
+ dma_sync_sg_for_device(dev, msm_obj->sgt->sgl, |
171 |
+ msm_obj->sgt->nents, DMA_BIDIRECTIONAL); |
172 |
+ } else { |
173 |
+@@ -71,7 +71,7 @@ static void sync_for_cpu(struct msm_gem_object *msm_obj) |
174 |
+ { |
175 |
+ struct device *dev = msm_obj->base.dev->dev; |
176 |
+ |
177 |
+- if (get_dma_ops(dev)) { |
178 |
++ if (get_dma_ops(dev) && IS_ENABLED(CONFIG_ARM64)) { |
179 |
+ dma_sync_sg_for_cpu(dev, msm_obj->sgt->sgl, |
180 |
+ msm_obj->sgt->nents, DMA_BIDIRECTIONAL); |
181 |
+ } else { |
182 |
+diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c |
183 |
+index 0f1f6421845f..85435e110ecd 100644 |
184 |
+--- a/drivers/hwmon/jc42.c |
185 |
++++ b/drivers/hwmon/jc42.c |
186 |
+@@ -508,7 +508,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id) |
187 |
+ } |
188 |
+ data->config = config; |
189 |
+ |
190 |
+- hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, |
191 |
++ hwmon_dev = devm_hwmon_device_register_with_info(dev, "jc42", |
192 |
+ data, &jc42_chip_info, |
193 |
+ NULL); |
194 |
+ return PTR_ERR_OR_ZERO(hwmon_dev); |
195 |
+diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c |
196 |
+index 143894a315d9..640ead6a2157 100644 |
197 |
+--- a/drivers/iio/adc/xilinx-xadc-core.c |
198 |
++++ b/drivers/iio/adc/xilinx-xadc-core.c |
199 |
+@@ -660,7 +660,7 @@ static int xadc_trigger_set_state(struct iio_trigger *trigger, bool state) |
200 |
+ |
201 |
+ spin_lock_irqsave(&xadc->lock, flags); |
202 |
+ xadc_read_reg(xadc, XADC_AXI_REG_IPIER, &val); |
203 |
+- xadc_write_reg(xadc, XADC_AXI_REG_IPISR, val & XADC_AXI_INT_EOS); |
204 |
++ xadc_write_reg(xadc, XADC_AXI_REG_IPISR, XADC_AXI_INT_EOS); |
205 |
+ if (state) |
206 |
+ val |= XADC_AXI_INT_EOS; |
207 |
+ else |
208 |
+@@ -709,13 +709,14 @@ static int xadc_power_adc_b(struct xadc *xadc, unsigned int seq_mode) |
209 |
+ { |
210 |
+ uint16_t val; |
211 |
+ |
212 |
++ /* Powerdown the ADC-B when it is not needed. */ |
213 |
+ switch (seq_mode) { |
214 |
+ case XADC_CONF1_SEQ_SIMULTANEOUS: |
215 |
+ case XADC_CONF1_SEQ_INDEPENDENT: |
216 |
+- val = XADC_CONF2_PD_ADC_B; |
217 |
++ val = 0; |
218 |
+ break; |
219 |
+ default: |
220 |
+- val = 0; |
221 |
++ val = XADC_CONF2_PD_ADC_B; |
222 |
+ break; |
223 |
+ } |
224 |
+ |
225 |
+@@ -784,6 +785,16 @@ static int xadc_preenable(struct iio_dev *indio_dev) |
226 |
+ if (ret) |
227 |
+ goto err; |
228 |
+ |
229 |
++ /* |
230 |
++ * In simultaneous mode the upper and lower aux channels are samples at |
231 |
++ * the same time. In this mode the upper 8 bits in the sequencer |
232 |
++ * register are don't care and the lower 8 bits control two channels |
233 |
++ * each. As such we must set the bit if either the channel in the lower |
234 |
++ * group or the upper group is enabled. |
235 |
++ */ |
236 |
++ if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS) |
237 |
++ scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000; |
238 |
++ |
239 |
+ ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); |
240 |
+ if (ret) |
241 |
+ goto err; |
242 |
+diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c |
243 |
+index 8725e406a9eb..00ba09fa6f16 100644 |
244 |
+--- a/drivers/mtd/chips/cfi_cmdset_0002.c |
245 |
++++ b/drivers/mtd/chips/cfi_cmdset_0002.c |
246 |
+@@ -1879,7 +1879,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, |
247 |
+ continue; |
248 |
+ } |
249 |
+ |
250 |
+- if (time_after(jiffies, timeo) && !chip_ready(map, adr)) |
251 |
++ /* |
252 |
++ * We check "time_after" and "!chip_good" before checking "chip_good" to avoid |
253 |
++ * the failure due to scheduling. |
254 |
++ */ |
255 |
++ if (time_after(jiffies, timeo) && !chip_good(map, adr, datum)) |
256 |
+ break; |
257 |
+ |
258 |
+ if (chip_good(map, adr, datum)) { |
259 |
+diff --git a/drivers/net/dsa/b53/b53_regs.h b/drivers/net/dsa/b53/b53_regs.h |
260 |
+index 81044000ce75..85c44bfba55a 100644 |
261 |
+--- a/drivers/net/dsa/b53/b53_regs.h |
262 |
++++ b/drivers/net/dsa/b53/b53_regs.h |
263 |
+@@ -261,7 +261,7 @@ |
264 |
+ * |
265 |
+ * BCM5325 and BCM5365 share most definitions below |
266 |
+ */ |
267 |
+-#define B53_ARLTBL_MAC_VID_ENTRY(n) (0x10 * (n)) |
268 |
++#define B53_ARLTBL_MAC_VID_ENTRY(n) ((0x10 * (n)) + 0x10) |
269 |
+ #define ARLTBL_MAC_MASK 0xffffffffffffULL |
270 |
+ #define ARLTBL_VID_S 48 |
271 |
+ #define ARLTBL_VID_MASK_25 0xff |
272 |
+@@ -273,7 +273,7 @@ |
273 |
+ #define ARLTBL_VALID_25 BIT(63) |
274 |
+ |
275 |
+ /* ARL Table Data Entry N Registers (32 bit) */ |
276 |
+-#define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x08) |
277 |
++#define B53_ARLTBL_DATA_ENTRY(n) ((0x10 * (n)) + 0x18) |
278 |
+ #define ARLTBL_DATA_PORT_ID_MASK 0x1ff |
279 |
+ #define ARLTBL_TC(tc) ((3 & tc) << 11) |
280 |
+ #define ARLTBL_AGE BIT(14) |
281 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
282 |
+index b4b435276a18..62bc2af9cde7 100644 |
283 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
284 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |
285 |
+@@ -3400,7 +3400,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) |
286 |
+ FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); |
287 |
+ ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, |
288 |
+ ¶m, &val); |
289 |
+- if (ret < 0) |
290 |
++ if (ret) |
291 |
+ return ret; |
292 |
+ *phy_fw_ver = val; |
293 |
+ return 0; |
294 |
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c |
295 |
+index da8bf327a3e9..df2ee65a33e3 100644 |
296 |
+--- a/drivers/net/macsec.c |
297 |
++++ b/drivers/net/macsec.c |
298 |
+@@ -3209,11 +3209,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, |
299 |
+ struct nlattr *tb[], struct nlattr *data[]) |
300 |
+ { |
301 |
+ struct macsec_dev *macsec = macsec_priv(dev); |
302 |
++ rx_handler_func_t *rx_handler; |
303 |
++ u8 icv_len = DEFAULT_ICV_LEN; |
304 |
+ struct net_device *real_dev; |
305 |
+- int err; |
306 |
++ int err, mtu; |
307 |
+ sci_t sci; |
308 |
+- u8 icv_len = DEFAULT_ICV_LEN; |
309 |
+- rx_handler_func_t *rx_handler; |
310 |
+ |
311 |
+ if (!tb[IFLA_LINK]) |
312 |
+ return -EINVAL; |
313 |
+@@ -3229,7 +3229,11 @@ static int macsec_newlink(struct net *net, struct net_device *dev, |
314 |
+ |
315 |
+ if (data && data[IFLA_MACSEC_ICV_LEN]) |
316 |
+ icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]); |
317 |
+- dev->mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
318 |
++ mtu = real_dev->mtu - icv_len - macsec_extra_len(true); |
319 |
++ if (mtu < 0) |
320 |
++ dev->mtu = 0; |
321 |
++ else |
322 |
++ dev->mtu = mtu; |
323 |
+ |
324 |
+ rx_handler = rtnl_dereference(real_dev->rx_handler); |
325 |
+ if (rx_handler && rx_handler != macsec_handle_frame) |
326 |
+diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
327 |
+index 294881621430..4f582ce929f2 100644 |
328 |
+--- a/drivers/net/macvlan.c |
329 |
++++ b/drivers/net/macvlan.c |
330 |
+@@ -1607,7 +1607,7 @@ static int macvlan_device_event(struct notifier_block *unused, |
331 |
+ struct macvlan_dev, |
332 |
+ list); |
333 |
+ |
334 |
+- if (macvlan_sync_address(vlan->dev, dev->dev_addr)) |
335 |
++ if (vlan && macvlan_sync_address(vlan->dev, dev->dev_addr)) |
336 |
+ return NOTIFY_BAD; |
337 |
+ |
338 |
+ break; |
339 |
+diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c |
340 |
+index d0c18e3557f1..cea6d2eabe7e 100644 |
341 |
+--- a/drivers/net/team/team.c |
342 |
++++ b/drivers/net/team/team.c |
343 |
+@@ -480,6 +480,9 @@ static const struct team_mode *team_mode_get(const char *kind) |
344 |
+ struct team_mode_item *mitem; |
345 |
+ const struct team_mode *mode = NULL; |
346 |
+ |
347 |
++ if (!try_module_get(THIS_MODULE)) |
348 |
++ return NULL; |
349 |
++ |
350 |
+ spin_lock(&mode_list_lock); |
351 |
+ mitem = __find_mode(kind); |
352 |
+ if (!mitem) { |
353 |
+@@ -495,6 +498,7 @@ static const struct team_mode *team_mode_get(const char *kind) |
354 |
+ } |
355 |
+ |
356 |
+ spin_unlock(&mode_list_lock); |
357 |
++ module_put(THIS_MODULE); |
358 |
+ return mode; |
359 |
+ } |
360 |
+ |
361 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
362 |
+index b12fe65d07f8..4a5fde58974a 100644 |
363 |
+--- a/drivers/pci/pcie/aspm.c |
364 |
++++ b/drivers/pci/pcie/aspm.c |
365 |
+@@ -57,6 +57,7 @@ struct pcie_link_state { |
366 |
+ u32 clkpm_capable:1; /* Clock PM capable? */ |
367 |
+ u32 clkpm_enabled:1; /* Current Clock PM state */ |
368 |
+ u32 clkpm_default:1; /* Default Clock PM state by BIOS */ |
369 |
++ u32 clkpm_disable:1; /* Clock PM disabled */ |
370 |
+ |
371 |
+ /* Exit latencies */ |
372 |
+ struct aspm_latency latency_up; /* Upstream direction exit latency */ |
373 |
+@@ -138,8 +139,11 @@ static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable) |
374 |
+ |
375 |
+ static void pcie_set_clkpm(struct pcie_link_state *link, int enable) |
376 |
+ { |
377 |
+- /* Don't enable Clock PM if the link is not Clock PM capable */ |
378 |
+- if (!link->clkpm_capable) |
379 |
++ /* |
380 |
++ * Don't enable Clock PM if the link is not Clock PM capable |
381 |
++ * or Clock PM is disabled |
382 |
++ */ |
383 |
++ if (!link->clkpm_capable || link->clkpm_disable) |
384 |
+ enable = 0; |
385 |
+ /* Need nothing if the specified equals to current state */ |
386 |
+ if (link->clkpm_enabled == enable) |
387 |
+@@ -169,7 +173,8 @@ static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist) |
388 |
+ } |
389 |
+ link->clkpm_enabled = enabled; |
390 |
+ link->clkpm_default = enabled; |
391 |
+- link->clkpm_capable = (blacklist) ? 0 : capable; |
392 |
++ link->clkpm_capable = capable; |
393 |
++ link->clkpm_disable = blacklist ? 1 : 0; |
394 |
+ } |
395 |
+ |
396 |
+ static bool pcie_retrain_link(struct pcie_link_state *link) |
397 |
+@@ -773,10 +778,9 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) |
398 |
+ link->aspm_disable |= ASPM_STATE_L1; |
399 |
+ pcie_config_aspm_link(link, policy_to_aspm_state(link)); |
400 |
+ |
401 |
+- if (state & PCIE_LINK_STATE_CLKPM) { |
402 |
+- link->clkpm_capable = 0; |
403 |
+- pcie_set_clkpm(link, 0); |
404 |
+- } |
405 |
++ if (state & PCIE_LINK_STATE_CLKPM) |
406 |
++ link->clkpm_disable = 1; |
407 |
++ pcie_set_clkpm(link, policy_to_clkpm_state(link)); |
408 |
+ mutex_unlock(&aspm_lock); |
409 |
+ if (sem) |
410 |
+ up_read(&pci_bus_sem); |
411 |
+diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c |
412 |
+index c5dbf16d810b..aeed963f827b 100644 |
413 |
+--- a/drivers/pwm/pwm-bcm2835.c |
414 |
++++ b/drivers/pwm/pwm-bcm2835.c |
415 |
+@@ -166,6 +166,7 @@ static int bcm2835_pwm_probe(struct platform_device *pdev) |
416 |
+ |
417 |
+ pc->chip.dev = &pdev->dev; |
418 |
+ pc->chip.ops = &bcm2835_pwm_ops; |
419 |
++ pc->chip.base = -1; |
420 |
+ pc->chip.npwm = 2; |
421 |
+ |
422 |
+ platform_set_drvdata(pdev, pc); |
423 |
+diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c |
424 |
+index 0fcf94ffad32..c298bec25a90 100644 |
425 |
+--- a/drivers/pwm/pwm-rcar.c |
426 |
++++ b/drivers/pwm/pwm-rcar.c |
427 |
+@@ -236,24 +236,28 @@ static int rcar_pwm_probe(struct platform_device *pdev) |
428 |
+ rcar_pwm->chip.base = -1; |
429 |
+ rcar_pwm->chip.npwm = 1; |
430 |
+ |
431 |
++ pm_runtime_enable(&pdev->dev); |
432 |
++ |
433 |
+ ret = pwmchip_add(&rcar_pwm->chip); |
434 |
+ if (ret < 0) { |
435 |
+ dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); |
436 |
++ pm_runtime_disable(&pdev->dev); |
437 |
+ return ret; |
438 |
+ } |
439 |
+ |
440 |
+- pm_runtime_enable(&pdev->dev); |
441 |
+- |
442 |
+ return 0; |
443 |
+ } |
444 |
+ |
445 |
+ static int rcar_pwm_remove(struct platform_device *pdev) |
446 |
+ { |
447 |
+ struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); |
448 |
++ int ret; |
449 |
++ |
450 |
++ ret = pwmchip_remove(&rcar_pwm->chip); |
451 |
+ |
452 |
+ pm_runtime_disable(&pdev->dev); |
453 |
+ |
454 |
+- return pwmchip_remove(&rcar_pwm->chip); |
455 |
++ return ret; |
456 |
+ } |
457 |
+ |
458 |
+ static const struct of_device_id rcar_pwm_of_table[] = { |
459 |
+diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c |
460 |
+index 075c1a764ba2..6247a956cc08 100644 |
461 |
+--- a/drivers/pwm/pwm-renesas-tpu.c |
462 |
++++ b/drivers/pwm/pwm-renesas-tpu.c |
463 |
+@@ -423,16 +423,17 @@ static int tpu_probe(struct platform_device *pdev) |
464 |
+ tpu->chip.base = -1; |
465 |
+ tpu->chip.npwm = TPU_CHANNEL_MAX; |
466 |
+ |
467 |
++ pm_runtime_enable(&pdev->dev); |
468 |
++ |
469 |
+ ret = pwmchip_add(&tpu->chip); |
470 |
+ if (ret < 0) { |
471 |
+ dev_err(&pdev->dev, "failed to register PWM chip\n"); |
472 |
++ pm_runtime_disable(&pdev->dev); |
473 |
+ return ret; |
474 |
+ } |
475 |
+ |
476 |
+ dev_info(&pdev->dev, "TPU PWM %d registered\n", tpu->pdev->id); |
477 |
+ |
478 |
+- pm_runtime_enable(&pdev->dev); |
479 |
+- |
480 |
+ return 0; |
481 |
+ } |
482 |
+ |
483 |
+@@ -442,12 +443,10 @@ static int tpu_remove(struct platform_device *pdev) |
484 |
+ int ret; |
485 |
+ |
486 |
+ ret = pwmchip_remove(&tpu->chip); |
487 |
+- if (ret) |
488 |
+- return ret; |
489 |
+ |
490 |
+ pm_runtime_disable(&pdev->dev); |
491 |
+ |
492 |
+- return 0; |
493 |
++ return ret; |
494 |
+ } |
495 |
+ |
496 |
+ #ifdef CONFIG_OF |
497 |
+diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c |
498 |
+index b99780574044..0254f034149b 100644 |
499 |
+--- a/drivers/remoteproc/remoteproc_core.c |
500 |
++++ b/drivers/remoteproc/remoteproc_core.c |
501 |
+@@ -284,7 +284,7 @@ void rproc_free_vring(struct rproc_vring *rvring) |
502 |
+ { |
503 |
+ int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align)); |
504 |
+ struct rproc *rproc = rvring->rvdev->rproc; |
505 |
+- int idx = rvring->rvdev->vring - rvring; |
506 |
++ int idx = rvring - rvring->rvdev->vring; |
507 |
+ struct fw_rsc_vdev *rsc; |
508 |
+ |
509 |
+ dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma); |
510 |
+diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c |
511 |
+index 6a58bc8f46e2..1e97d1a03467 100644 |
512 |
+--- a/drivers/s390/cio/device.c |
513 |
++++ b/drivers/s390/cio/device.c |
514 |
+@@ -868,8 +868,10 @@ static void io_subchannel_register(struct ccw_device *cdev) |
515 |
+ * Now we know this subchannel will stay, we can throw |
516 |
+ * our delayed uevent. |
517 |
+ */ |
518 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
519 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
520 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
521 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
522 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
523 |
++ } |
524 |
+ /* make it known to the system */ |
525 |
+ ret = ccw_device_add(cdev); |
526 |
+ if (ret) { |
527 |
+@@ -1077,8 +1079,11 @@ static int io_subchannel_probe(struct subchannel *sch) |
528 |
+ * Throw the delayed uevent for the subchannel, register |
529 |
+ * the ccw_device and exit. |
530 |
+ */ |
531 |
+- dev_set_uevent_suppress(&sch->dev, 0); |
532 |
+- kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
533 |
++ if (dev_get_uevent_suppress(&sch->dev)) { |
534 |
++ /* should always be the case for the console */ |
535 |
++ dev_set_uevent_suppress(&sch->dev, 0); |
536 |
++ kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
537 |
++ } |
538 |
+ cdev = sch_get_cdev(sch); |
539 |
+ rc = ccw_device_add(cdev); |
540 |
+ if (rc) { |
541 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
542 |
+index cbe808e83f47..1c34dc335549 100644 |
543 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
544 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
545 |
+@@ -2210,6 +2210,8 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
546 |
+ !pmb->u.mb.mbxStatus) { |
547 |
+ rpi = pmb->u.mb.un.varWords[0]; |
548 |
+ vpi = pmb->u.mb.un.varRegLogin.vpi; |
549 |
++ if (phba->sli_rev == LPFC_SLI_REV4) |
550 |
++ vpi -= phba->sli4_hba.max_cfg_param.vpi_base; |
551 |
+ lpfc_unreg_login(phba, vpi, rpi, pmb); |
552 |
+ pmb->vport = vport; |
553 |
+ pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
554 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
555 |
+index fff9c4d0f7c8..42b97f119623 100644 |
556 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
557 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
558 |
+@@ -2016,7 +2016,7 @@ static void __iscsi_unbind_session(struct work_struct *work) |
559 |
+ if (session->target_id == ISCSI_MAX_TARGET) { |
560 |
+ spin_unlock_irqrestore(&session->lock, flags); |
561 |
+ mutex_unlock(&ihost->mutex); |
562 |
+- return; |
563 |
++ goto unbind_session_exit; |
564 |
+ } |
565 |
+ |
566 |
+ target_id = session->target_id; |
567 |
+@@ -2028,6 +2028,8 @@ static void __iscsi_unbind_session(struct work_struct *work) |
568 |
+ ida_simple_remove(&iscsi_sess_ida, target_id); |
569 |
+ |
570 |
+ scsi_remove_target(&session->dev); |
571 |
++ |
572 |
++unbind_session_exit: |
573 |
+ iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION); |
574 |
+ ISCSI_DBG_TRANS_SESSION(session, "Completed target removal\n"); |
575 |
+ } |
576 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
577 |
+index 7458df4b6854..3090c8dea2a6 100644 |
578 |
+--- a/drivers/staging/comedi/comedi_fops.c |
579 |
++++ b/drivers/staging/comedi/comedi_fops.c |
580 |
+@@ -2592,8 +2592,10 @@ static int comedi_open(struct inode *inode, struct file *file) |
581 |
+ } |
582 |
+ |
583 |
+ cfp = kzalloc(sizeof(*cfp), GFP_KERNEL); |
584 |
+- if (!cfp) |
585 |
++ if (!cfp) { |
586 |
++ comedi_dev_put(dev); |
587 |
+ return -ENOMEM; |
588 |
++ } |
589 |
+ |
590 |
+ cfp->dev = dev; |
591 |
+ |
592 |
+diff --git a/drivers/staging/comedi/drivers/dt2815.c b/drivers/staging/comedi/drivers/dt2815.c |
593 |
+index 0be77cc40a79..8ab36b351195 100644 |
594 |
+--- a/drivers/staging/comedi/drivers/dt2815.c |
595 |
++++ b/drivers/staging/comedi/drivers/dt2815.c |
596 |
+@@ -101,6 +101,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
597 |
+ int ret; |
598 |
+ |
599 |
+ for (i = 0; i < insn->n; i++) { |
600 |
++ /* FIXME: lo bit 0 chooses voltage output or current output */ |
601 |
+ lo = ((data[i] & 0x0f) << 4) | (chan << 1) | 0x01; |
602 |
+ hi = (data[i] & 0xff0) >> 4; |
603 |
+ |
604 |
+@@ -114,6 +115,8 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s, |
605 |
+ if (ret) |
606 |
+ return ret; |
607 |
+ |
608 |
++ outb(hi, dev->iobase + DT2815_DATA); |
609 |
++ |
610 |
+ devpriv->ao_readback[chan] = data[i]; |
611 |
+ } |
612 |
+ return i; |
613 |
+diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c |
614 |
+index b554e881e67f..f7ed09119893 100644 |
615 |
+--- a/drivers/staging/vt6656/int.c |
616 |
++++ b/drivers/staging/vt6656/int.c |
617 |
+@@ -153,7 +153,8 @@ void vnt_int_process_data(struct vnt_private *priv) |
618 |
+ priv->wake_up_count = |
619 |
+ priv->hw->conf.listen_interval; |
620 |
+ |
621 |
+- --priv->wake_up_count; |
622 |
++ if (priv->wake_up_count) |
623 |
++ --priv->wake_up_count; |
624 |
+ |
625 |
+ /* Turn on wake up to listen next beacon */ |
626 |
+ if (priv->wake_up_count == 1) |
627 |
+diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c |
628 |
+index b93773af2031..860a0ddd7a16 100644 |
629 |
+--- a/drivers/staging/vt6656/main_usb.c |
630 |
++++ b/drivers/staging/vt6656/main_usb.c |
631 |
+@@ -755,12 +755,15 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, |
632 |
+ vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, |
633 |
+ TFTCTL_TSFCNTREN); |
634 |
+ |
635 |
+- vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
636 |
+- conf->sync_tsf, priv->current_tsf); |
637 |
+- |
638 |
+ vnt_mac_set_beacon_interval(priv, conf->beacon_int); |
639 |
+ |
640 |
+ vnt_reset_next_tbtt(priv, conf->beacon_int); |
641 |
++ |
642 |
++ vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, |
643 |
++ conf->sync_tsf, priv->current_tsf); |
644 |
++ |
645 |
++ vnt_update_next_tbtt(priv, |
646 |
++ conf->sync_tsf, conf->beacon_int); |
647 |
+ } else { |
648 |
+ vnt_clear_current_tsf(priv); |
649 |
+ |
650 |
+diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c |
651 |
+index 6e75095af681..2ecb2f7042a1 100644 |
652 |
+--- a/drivers/target/target_core_fabric_lib.c |
653 |
++++ b/drivers/target/target_core_fabric_lib.c |
654 |
+@@ -75,7 +75,7 @@ static int fc_get_pr_transport_id( |
655 |
+ * encoded TransportID. |
656 |
+ */ |
657 |
+ ptr = &se_nacl->initiatorname[0]; |
658 |
+- for (i = 0; i < 24; ) { |
659 |
++ for (i = 0; i < 23; ) { |
660 |
+ if (!strncmp(&ptr[i], ":", 1)) { |
661 |
+ i++; |
662 |
+ continue; |
663 |
+diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c |
664 |
+index ce864875330e..f8964247c4c3 100644 |
665 |
+--- a/drivers/tty/hvc/hvc_console.c |
666 |
++++ b/drivers/tty/hvc/hvc_console.c |
667 |
+@@ -289,10 +289,6 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops) |
668 |
+ vtermnos[index] = vtermno; |
669 |
+ cons_ops[index] = ops; |
670 |
+ |
671 |
+- /* reserve all indices up to and including this index */ |
672 |
+- if (last_hvc < index) |
673 |
+- last_hvc = index; |
674 |
+- |
675 |
+ /* check if we need to re-register the kernel console */ |
676 |
+ hvc_check_console(index); |
677 |
+ |
678 |
+@@ -896,13 +892,22 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data, |
679 |
+ cons_ops[i] == hp->ops) |
680 |
+ break; |
681 |
+ |
682 |
+- /* no matching slot, just use a counter */ |
683 |
+- if (i >= MAX_NR_HVC_CONSOLES) |
684 |
+- i = ++last_hvc; |
685 |
++ if (i >= MAX_NR_HVC_CONSOLES) { |
686 |
++ |
687 |
++ /* find 'empty' slot for console */ |
688 |
++ for (i = 0; i < MAX_NR_HVC_CONSOLES && vtermnos[i] != -1; i++) { |
689 |
++ } |
690 |
++ |
691 |
++ /* no matching slot, just use a counter */ |
692 |
++ if (i == MAX_NR_HVC_CONSOLES) |
693 |
++ i = ++last_hvc + MAX_NR_HVC_CONSOLES; |
694 |
++ } |
695 |
+ |
696 |
+ hp->index = i; |
697 |
+- cons_ops[i] = ops; |
698 |
+- vtermnos[i] = vtermno; |
699 |
++ if (i < MAX_NR_HVC_CONSOLES) { |
700 |
++ cons_ops[i] = ops; |
701 |
++ vtermnos[i] = vtermno; |
702 |
++ } |
703 |
+ |
704 |
+ list_add_tail(&(hp->next), &hvc_structs); |
705 |
+ spin_unlock(&hvc_structs_lock); |
706 |
+diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c |
707 |
+index 447d791bde22..1e8f6096260f 100644 |
708 |
+--- a/drivers/tty/rocket.c |
709 |
++++ b/drivers/tty/rocket.c |
710 |
+@@ -645,18 +645,21 @@ init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev) |
711 |
+ tty_port_init(&info->port); |
712 |
+ info->port.ops = &rocket_port_ops; |
713 |
+ info->flags &= ~ROCKET_MODE_MASK; |
714 |
+- switch (pc104[board][line]) { |
715 |
+- case 422: |
716 |
+- info->flags |= ROCKET_MODE_RS422; |
717 |
+- break; |
718 |
+- case 485: |
719 |
+- info->flags |= ROCKET_MODE_RS485; |
720 |
+- break; |
721 |
+- case 232: |
722 |
+- default: |
723 |
++ if (board < ARRAY_SIZE(pc104) && line < ARRAY_SIZE(pc104_1)) |
724 |
++ switch (pc104[board][line]) { |
725 |
++ case 422: |
726 |
++ info->flags |= ROCKET_MODE_RS422; |
727 |
++ break; |
728 |
++ case 485: |
729 |
++ info->flags |= ROCKET_MODE_RS485; |
730 |
++ break; |
731 |
++ case 232: |
732 |
++ default: |
733 |
++ info->flags |= ROCKET_MODE_RS232; |
734 |
++ break; |
735 |
++ } |
736 |
++ else |
737 |
+ info->flags |= ROCKET_MODE_RS232; |
738 |
+- break; |
739 |
+- } |
740 |
+ |
741 |
+ info->intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR; |
742 |
+ if (sInitChan(ctlp, &info->channel, aiop, chan) == 0) { |
743 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
744 |
+index c958cf42a1bb..238dfe0f6e80 100644 |
745 |
+--- a/drivers/usb/core/hub.c |
746 |
++++ b/drivers/usb/core/hub.c |
747 |
+@@ -1191,6 +1191,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) |
748 |
+ #ifdef CONFIG_PM |
749 |
+ udev->reset_resume = 1; |
750 |
+ #endif |
751 |
++ /* Don't set the change_bits when the device |
752 |
++ * was powered off. |
753 |
++ */ |
754 |
++ if (test_bit(port1, hub->power_bits)) |
755 |
++ set_bit(port1, hub->change_bits); |
756 |
+ |
757 |
+ } else { |
758 |
+ /* The power session is gone; tell hub_wq */ |
759 |
+@@ -2991,6 +2996,15 @@ static int check_port_resume_type(struct usb_device *udev, |
760 |
+ if (portchange & USB_PORT_STAT_C_ENABLE) |
761 |
+ usb_clear_port_feature(hub->hdev, port1, |
762 |
+ USB_PORT_FEAT_C_ENABLE); |
763 |
++ |
764 |
++ /* |
765 |
++ * Whatever made this reset-resume necessary may have |
766 |
++ * turned on the port1 bit in hub->change_bits. But after |
767 |
++ * a successful reset-resume we want the bit to be clear; |
768 |
++ * if it was on it would indicate that something happened |
769 |
++ * following the reset-resume. |
770 |
++ */ |
771 |
++ clear_bit(port1, hub->change_bits); |
772 |
+ } |
773 |
+ |
774 |
+ return status; |
775 |
+diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
776 |
+index d6075d45e10a..2e541a029657 100644 |
777 |
+--- a/drivers/usb/core/message.c |
778 |
++++ b/drivers/usb/core/message.c |
779 |
+@@ -585,12 +585,13 @@ void usb_sg_cancel(struct usb_sg_request *io) |
780 |
+ int i, retval; |
781 |
+ |
782 |
+ spin_lock_irqsave(&io->lock, flags); |
783 |
+- if (io->status) { |
784 |
++ if (io->status || io->count == 0) { |
785 |
+ spin_unlock_irqrestore(&io->lock, flags); |
786 |
+ return; |
787 |
+ } |
788 |
+ /* shut everything down */ |
789 |
+ io->status = -ECONNRESET; |
790 |
++ io->count++; /* Keep the request alive until we're done */ |
791 |
+ spin_unlock_irqrestore(&io->lock, flags); |
792 |
+ |
793 |
+ for (i = io->entries - 1; i >= 0; --i) { |
794 |
+@@ -604,6 +605,12 @@ void usb_sg_cancel(struct usb_sg_request *io) |
795 |
+ dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
796 |
+ __func__, retval); |
797 |
+ } |
798 |
++ |
799 |
++ spin_lock_irqsave(&io->lock, flags); |
800 |
++ io->count--; |
801 |
++ if (!io->count) |
802 |
++ complete(&io->complete); |
803 |
++ spin_unlock_irqrestore(&io->lock, flags); |
804 |
+ } |
805 |
+ EXPORT_SYMBOL_GPL(usb_sg_cancel); |
806 |
+ |
807 |
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c |
808 |
+index 6c4bb47922ac..27d05f0134de 100644 |
809 |
+--- a/drivers/usb/core/quirks.c |
810 |
++++ b/drivers/usb/core/quirks.c |
811 |
+@@ -272,6 +272,10 @@ static const struct usb_device_id usb_quirk_list[] = { |
812 |
+ /* Corsair K70 LUX */ |
813 |
+ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT }, |
814 |
+ |
815 |
++ /* Corsair K70 RGB RAPDIFIRE */ |
816 |
++ { USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT | |
817 |
++ USB_QUIRK_DELAY_CTRL_MSG }, |
818 |
++ |
819 |
+ /* MIDI keyboard WORLDE MINI */ |
820 |
+ { USB_DEVICE(0x1c75, 0x0204), .driver_info = |
821 |
+ USB_QUIRK_CONFIG_INTF_STRINGS }, |
822 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
823 |
+index 223b28cbf3c8..bea11be98526 100644 |
824 |
+--- a/drivers/usb/gadget/function/f_fs.c |
825 |
++++ b/drivers/usb/gadget/function/f_fs.c |
826 |
+@@ -1701,6 +1701,10 @@ static void ffs_data_reset(struct ffs_data *ffs) |
827 |
+ ffs->state = FFS_READ_DESCRIPTORS; |
828 |
+ ffs->setup_state = FFS_NO_SETUP; |
829 |
+ ffs->flags = 0; |
830 |
++ |
831 |
++ ffs->ms_os_descs_ext_prop_count = 0; |
832 |
++ ffs->ms_os_descs_ext_prop_name_len = 0; |
833 |
++ ffs->ms_os_descs_ext_prop_data_len = 0; |
834 |
+ } |
835 |
+ |
836 |
+ |
837 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
838 |
+index ccaa74ab6c0e..303735c7990c 100644 |
839 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c |
840 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c |
841 |
+@@ -546,7 +546,7 @@ static void bdc_req_complete(struct bdc_ep *ep, struct bdc_req *req, |
842 |
+ { |
843 |
+ struct bdc *bdc = ep->bdc; |
844 |
+ |
845 |
+- if (req == NULL || &req->queue == NULL || &req->usb_req == NULL) |
846 |
++ if (req == NULL) |
847 |
+ return; |
848 |
+ |
849 |
+ dev_dbg(bdc->dev, "%s ep:%s status:%d\n", __func__, ep->name, status); |
850 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c |
851 |
+index b7a4ba020893..895e8c0288cf 100644 |
852 |
+--- a/drivers/usb/misc/sisusbvga/sisusb.c |
853 |
++++ b/drivers/usb/misc/sisusbvga/sisusb.c |
854 |
+@@ -1200,18 +1200,18 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, |
855 |
+ /* High level: Gfx (indexed) register access */ |
856 |
+ |
857 |
+ #ifdef INCL_SISUSB_CON |
858 |
+-int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data) |
859 |
++int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data) |
860 |
+ { |
861 |
+ return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
862 |
+ } |
863 |
+ |
864 |
+-int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 *data) |
865 |
++int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 *data) |
866 |
+ { |
867 |
+ return sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port, data); |
868 |
+ } |
869 |
+ #endif |
870 |
+ |
871 |
+-int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
872 |
++int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
873 |
+ u8 index, u8 data) |
874 |
+ { |
875 |
+ int ret; |
876 |
+@@ -1221,7 +1221,7 @@ int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
877 |
+ return ret; |
878 |
+ } |
879 |
+ |
880 |
+-int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
881 |
++int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
882 |
+ u8 index, u8 *data) |
883 |
+ { |
884 |
+ int ret; |
885 |
+@@ -1231,7 +1231,7 @@ int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
886 |
+ return ret; |
887 |
+ } |
888 |
+ |
889 |
+-int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
890 |
++int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, u8 idx, |
891 |
+ u8 myand, u8 myor) |
892 |
+ { |
893 |
+ int ret; |
894 |
+@@ -1246,7 +1246,7 @@ int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx, |
895 |
+ } |
896 |
+ |
897 |
+ static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, |
898 |
+- int port, u8 idx, u8 data, u8 mask) |
899 |
++ u32 port, u8 idx, u8 data, u8 mask) |
900 |
+ { |
901 |
+ int ret; |
902 |
+ u8 tmp; |
903 |
+@@ -1259,13 +1259,13 @@ static int sisusb_setidxregmask(struct sisusb_usb_data *sisusb, |
904 |
+ return ret; |
905 |
+ } |
906 |
+ |
907 |
+-int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, |
908 |
++int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
909 |
+ u8 index, u8 myor) |
910 |
+ { |
911 |
+ return sisusb_setidxregandor(sisusb, port, index, 0xff, myor); |
912 |
+ } |
913 |
+ |
914 |
+-int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, |
915 |
++int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
916 |
+ u8 idx, u8 myand) |
917 |
+ { |
918 |
+ return sisusb_setidxregandor(sisusb, port, idx, myand, 0x00); |
919 |
+@@ -2796,8 +2796,8 @@ static loff_t sisusb_lseek(struct file *file, loff_t offset, int orig) |
920 |
+ static int sisusb_handle_command(struct sisusb_usb_data *sisusb, |
921 |
+ struct sisusb_command *y, unsigned long arg) |
922 |
+ { |
923 |
+- int retval, port, length; |
924 |
+- u32 address; |
925 |
++ int retval, length; |
926 |
++ u32 port, address; |
927 |
+ |
928 |
+ /* All our commands require the device |
929 |
+ * to be initialized. |
930 |
+diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.h b/drivers/usb/misc/sisusbvga/sisusb_init.h |
931 |
+index e79a616f0d26..f7182257f7e1 100644 |
932 |
+--- a/drivers/usb/misc/sisusbvga/sisusb_init.h |
933 |
++++ b/drivers/usb/misc/sisusbvga/sisusb_init.h |
934 |
+@@ -811,17 +811,17 @@ static const struct SiS_VCLKData SiSUSB_VCLKData[] = { |
935 |
+ int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
936 |
+ int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); |
937 |
+ |
938 |
+-extern int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data); |
939 |
+-extern int sisusb_getreg(struct sisusb_usb_data *sisusb, int port, u8 * data); |
940 |
+-extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, |
941 |
++extern int sisusb_setreg(struct sisusb_usb_data *sisusb, u32 port, u8 data); |
942 |
++extern int sisusb_getreg(struct sisusb_usb_data *sisusb, u32 port, u8 * data); |
943 |
++extern int sisusb_setidxreg(struct sisusb_usb_data *sisusb, u32 port, |
944 |
+ u8 index, u8 data); |
945 |
+-extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, |
946 |
++extern int sisusb_getidxreg(struct sisusb_usb_data *sisusb, u32 port, |
947 |
+ u8 index, u8 * data); |
948 |
+-extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, |
949 |
++extern int sisusb_setidxregandor(struct sisusb_usb_data *sisusb, u32 port, |
950 |
+ u8 idx, u8 myand, u8 myor); |
951 |
+-extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, |
952 |
++extern int sisusb_setidxregor(struct sisusb_usb_data *sisusb, u32 port, |
953 |
+ u8 index, u8 myor); |
954 |
+-extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, |
955 |
++extern int sisusb_setidxregand(struct sisusb_usb_data *sisusb, u32 port, |
956 |
+ u8 idx, u8 myand); |
957 |
+ |
958 |
+ void sisusb_delete(struct kref *kref); |
959 |
+diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c |
960 |
+index d022b5ff4cd0..bb7556952a18 100644 |
961 |
+--- a/drivers/usb/storage/uas.c |
962 |
++++ b/drivers/usb/storage/uas.c |
963 |
+@@ -82,6 +82,19 @@ static void uas_free_streams(struct uas_dev_info *devinfo); |
964 |
+ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
965 |
+ int status); |
966 |
+ |
967 |
++/* |
968 |
++ * This driver needs its own workqueue, as we need to control memory allocation. |
969 |
++ * |
970 |
++ * In the course of error handling and power management uas_wait_for_pending_cmnds() |
971 |
++ * needs to flush pending work items. In these contexts we cannot allocate memory |
972 |
++ * by doing block IO as we would deadlock. For the same reason we cannot wait |
973 |
++ * for anything allocating memory not heeding these constraints. |
974 |
++ * |
975 |
++ * So we have to control all work items that can be on the workqueue we flush. |
976 |
++ * Hence we cannot share a queue and need our own. |
977 |
++ */ |
978 |
++static struct workqueue_struct *workqueue; |
979 |
++ |
980 |
+ static void uas_do_work(struct work_struct *work) |
981 |
+ { |
982 |
+ struct uas_dev_info *devinfo = |
983 |
+@@ -110,7 +123,7 @@ static void uas_do_work(struct work_struct *work) |
984 |
+ if (!err) |
985 |
+ cmdinfo->state &= ~IS_IN_WORK_LIST; |
986 |
+ else |
987 |
+- schedule_work(&devinfo->work); |
988 |
++ queue_work(workqueue, &devinfo->work); |
989 |
+ } |
990 |
+ out: |
991 |
+ spin_unlock_irqrestore(&devinfo->lock, flags); |
992 |
+@@ -135,7 +148,7 @@ static void uas_add_work(struct uas_cmd_info *cmdinfo) |
993 |
+ |
994 |
+ lockdep_assert_held(&devinfo->lock); |
995 |
+ cmdinfo->state |= IS_IN_WORK_LIST; |
996 |
+- schedule_work(&devinfo->work); |
997 |
++ queue_work(workqueue, &devinfo->work); |
998 |
+ } |
999 |
+ |
1000 |
+ static void uas_zap_pending(struct uas_dev_info *devinfo, int result) |
1001 |
+@@ -191,6 +204,9 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *prefix, |
1002 |
+ struct uas_cmd_info *ci = (void *)&cmnd->SCp; |
1003 |
+ struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; |
1004 |
+ |
1005 |
++ if (status == -ENODEV) /* too late */ |
1006 |
++ return; |
1007 |
++ |
1008 |
+ scmd_printk(KERN_INFO, cmnd, |
1009 |
+ "%s %d uas-tag %d inflight:%s%s%s%s%s%s%s%s%s%s%s%s ", |
1010 |
+ prefix, status, cmdinfo->uas_tag, |
1011 |
+@@ -1233,7 +1249,31 @@ static struct usb_driver uas_driver = { |
1012 |
+ .id_table = uas_usb_ids, |
1013 |
+ }; |
1014 |
+ |
1015 |
+-module_usb_driver(uas_driver); |
1016 |
++static int __init uas_init(void) |
1017 |
++{ |
1018 |
++ int rv; |
1019 |
++ |
1020 |
++ workqueue = alloc_workqueue("uas", WQ_MEM_RECLAIM, 0); |
1021 |
++ if (!workqueue) |
1022 |
++ return -ENOMEM; |
1023 |
++ |
1024 |
++ rv = usb_register(&uas_driver); |
1025 |
++ if (rv) { |
1026 |
++ destroy_workqueue(workqueue); |
1027 |
++ return -ENOMEM; |
1028 |
++ } |
1029 |
++ |
1030 |
++ return 0; |
1031 |
++} |
1032 |
++ |
1033 |
++static void __exit uas_exit(void) |
1034 |
++{ |
1035 |
++ usb_deregister(&uas_driver); |
1036 |
++ destroy_workqueue(workqueue); |
1037 |
++} |
1038 |
++ |
1039 |
++module_init(uas_init); |
1040 |
++module_exit(uas_exit); |
1041 |
+ |
1042 |
+ MODULE_LICENSE("GPL"); |
1043 |
+ MODULE_AUTHOR( |
1044 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
1045 |
+index a52ae34fb1c3..46079468df42 100644 |
1046 |
+--- a/drivers/usb/storage/unusual_devs.h |
1047 |
++++ b/drivers/usb/storage/unusual_devs.h |
1048 |
+@@ -2342,6 +2342,13 @@ UNUSUAL_DEV( 0x3340, 0xffff, 0x0000, 0x0000, |
1049 |
+ USB_SC_DEVICE,USB_PR_DEVICE,NULL, |
1050 |
+ US_FL_MAX_SECTORS_64 ), |
1051 |
+ |
1052 |
++/* Reported by Cyril Roelandt <tipecaml@×××××.com> */ |
1053 |
++UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114, |
1054 |
++ "JMicron", |
1055 |
++ "USB to ATA/ATAPI Bridge", |
1056 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1057 |
++ US_FL_BROKEN_FUA ), |
1058 |
++ |
1059 |
+ /* Reported by Andrey Rahmatullin <wrar@××××××××.org> */ |
1060 |
+ UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, |
1061 |
+ "iRiver", |
1062 |
+diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c |
1063 |
+index 977fe74e5abe..9e17d933ea94 100644 |
1064 |
+--- a/drivers/watchdog/watchdog_dev.c |
1065 |
++++ b/drivers/watchdog/watchdog_dev.c |
1066 |
+@@ -237,6 +237,7 @@ static int watchdog_start(struct watchdog_device *wdd) |
1067 |
+ if (err == 0) { |
1068 |
+ set_bit(WDOG_ACTIVE, &wdd->status); |
1069 |
+ wd_data->last_keepalive = started_at; |
1070 |
++ wd_data->last_hw_keepalive = started_at; |
1071 |
+ watchdog_update_worker(wdd); |
1072 |
+ } |
1073 |
+ |
1074 |
+diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c |
1075 |
+index 056da6ee1a35..df27cefb2fa3 100644 |
1076 |
+--- a/drivers/xen/xenbus/xenbus_client.c |
1077 |
++++ b/drivers/xen/xenbus/xenbus_client.c |
1078 |
+@@ -469,7 +469,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn); |
1079 |
+ int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs, |
1080 |
+ unsigned int nr_grefs, void **vaddr) |
1081 |
+ { |
1082 |
+- return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
1083 |
++ int err; |
1084 |
++ |
1085 |
++ err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr); |
1086 |
++ /* Some hypervisors are buggy and can return 1. */ |
1087 |
++ if (err > 0) |
1088 |
++ err = GNTST_general_error; |
1089 |
++ |
1090 |
++ return err; |
1091 |
+ } |
1092 |
+ EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc); |
1093 |
+ |
1094 |
+diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
1095 |
+index f5d9835264aa..617e9ae67f50 100644 |
1096 |
+--- a/fs/ceph/caps.c |
1097 |
++++ b/fs/ceph/caps.c |
1098 |
+@@ -1764,8 +1764,12 @@ retry_locked: |
1099 |
+ } |
1100 |
+ |
1101 |
+ /* want more caps from mds? */ |
1102 |
+- if (want & ~(cap->mds_wanted | cap->issued)) |
1103 |
+- goto ack; |
1104 |
++ if (want & ~cap->mds_wanted) { |
1105 |
++ if (want & ~(cap->mds_wanted | cap->issued)) |
1106 |
++ goto ack; |
1107 |
++ if (!__cap_is_valid(cap)) |
1108 |
++ goto ack; |
1109 |
++ } |
1110 |
+ |
1111 |
+ /* things we might delay */ |
1112 |
+ if ((cap->issued & ~retain) == 0 && |
1113 |
+diff --git a/fs/ceph/export.c b/fs/ceph/export.c |
1114 |
+index 1780218a48f0..f8e1f31e4643 100644 |
1115 |
+--- a/fs/ceph/export.c |
1116 |
++++ b/fs/ceph/export.c |
1117 |
+@@ -157,6 +157,11 @@ static struct dentry *__get_parent(struct super_block *sb, |
1118 |
+ |
1119 |
+ req->r_num_caps = 1; |
1120 |
+ err = ceph_mdsc_do_request(mdsc, NULL, req); |
1121 |
++ if (err) { |
1122 |
++ ceph_mdsc_put_request(req); |
1123 |
++ return ERR_PTR(err); |
1124 |
++ } |
1125 |
++ |
1126 |
+ inode = req->r_target_inode; |
1127 |
+ if (inode) |
1128 |
+ ihold(inode); |
1129 |
+diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c |
1130 |
+index fdb19543af1e..d31d93ee5e76 100644 |
1131 |
+--- a/fs/ext4/block_validity.c |
1132 |
++++ b/fs/ext4/block_validity.c |
1133 |
+@@ -136,6 +136,49 @@ static void debug_print_tree(struct ext4_sb_info *sbi) |
1134 |
+ printk(KERN_CONT "\n"); |
1135 |
+ } |
1136 |
+ |
1137 |
++static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino) |
1138 |
++{ |
1139 |
++ struct inode *inode; |
1140 |
++ struct ext4_sb_info *sbi = EXT4_SB(sb); |
1141 |
++ struct ext4_map_blocks map; |
1142 |
++ u32 i = 0, num; |
1143 |
++ int err = 0, n; |
1144 |
++ |
1145 |
++ if ((ino < EXT4_ROOT_INO) || |
1146 |
++ (ino > le32_to_cpu(sbi->s_es->s_inodes_count))) |
1147 |
++ return -EINVAL; |
1148 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_SPECIAL); |
1149 |
++ if (IS_ERR(inode)) |
1150 |
++ return PTR_ERR(inode); |
1151 |
++ num = (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
1152 |
++ while (i < num) { |
1153 |
++ map.m_lblk = i; |
1154 |
++ map.m_len = num - i; |
1155 |
++ n = ext4_map_blocks(NULL, inode, &map, 0); |
1156 |
++ if (n < 0) { |
1157 |
++ err = n; |
1158 |
++ break; |
1159 |
++ } |
1160 |
++ if (n == 0) { |
1161 |
++ i++; |
1162 |
++ } else { |
1163 |
++ if (!ext4_data_block_valid(sbi, map.m_pblk, n)) { |
1164 |
++ ext4_error(sb, "blocks %llu-%llu from inode %u " |
1165 |
++ "overlap system zone", map.m_pblk, |
1166 |
++ map.m_pblk + map.m_len - 1, ino); |
1167 |
++ err = -EFSCORRUPTED; |
1168 |
++ break; |
1169 |
++ } |
1170 |
++ err = add_system_zone(sbi, map.m_pblk, n); |
1171 |
++ if (err < 0) |
1172 |
++ break; |
1173 |
++ i += n; |
1174 |
++ } |
1175 |
++ } |
1176 |
++ iput(inode); |
1177 |
++ return err; |
1178 |
++} |
1179 |
++ |
1180 |
+ int ext4_setup_system_zone(struct super_block *sb) |
1181 |
+ { |
1182 |
+ ext4_group_t ngroups = ext4_get_groups_count(sb); |
1183 |
+@@ -170,6 +213,12 @@ int ext4_setup_system_zone(struct super_block *sb) |
1184 |
+ if (ret) |
1185 |
+ return ret; |
1186 |
+ } |
1187 |
++ if (ext4_has_feature_journal(sb) && sbi->s_es->s_journal_inum) { |
1188 |
++ ret = ext4_protect_reserved_inode(sb, |
1189 |
++ le32_to_cpu(sbi->s_es->s_journal_inum)); |
1190 |
++ if (ret) |
1191 |
++ return ret; |
1192 |
++ } |
1193 |
+ |
1194 |
+ if (test_opt(sb, DEBUG)) |
1195 |
+ debug_print_tree(EXT4_SB(sb)); |
1196 |
+@@ -226,6 +275,11 @@ int ext4_check_blockref(const char *function, unsigned int line, |
1197 |
+ __le32 *bref = p; |
1198 |
+ unsigned int blk; |
1199 |
+ |
1200 |
++ if (ext4_has_feature_journal(inode->i_sb) && |
1201 |
++ (inode->i_ino == |
1202 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) |
1203 |
++ return 0; |
1204 |
++ |
1205 |
+ while (bref < p+max) { |
1206 |
+ blk = le32_to_cpu(*bref++); |
1207 |
+ if (blk && |
1208 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
1209 |
+index eb0ec5068423..b41ac328c396 100644 |
1210 |
+--- a/fs/ext4/ext4.h |
1211 |
++++ b/fs/ext4/ext4.h |
1212 |
+@@ -2496,8 +2496,19 @@ int do_journal_get_write_access(handle_t *handle, |
1213 |
+ #define FALL_BACK_TO_NONDELALLOC 1 |
1214 |
+ #define CONVERT_INLINE_DATA 2 |
1215 |
+ |
1216 |
+-extern struct inode *ext4_iget(struct super_block *, unsigned long); |
1217 |
+-extern struct inode *ext4_iget_normal(struct super_block *, unsigned long); |
1218 |
++typedef enum { |
1219 |
++ EXT4_IGET_NORMAL = 0, |
1220 |
++ EXT4_IGET_SPECIAL = 0x0001, /* OK to iget a system inode */ |
1221 |
++ EXT4_IGET_HANDLE = 0x0002 /* Inode # is from a handle */ |
1222 |
++} ext4_iget_flags; |
1223 |
++ |
1224 |
++extern struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
1225 |
++ ext4_iget_flags flags, const char *function, |
1226 |
++ unsigned int line); |
1227 |
++ |
1228 |
++#define ext4_iget(sb, ino, flags) \ |
1229 |
++ __ext4_iget((sb), (ino), (flags), __func__, __LINE__) |
1230 |
++ |
1231 |
+ extern int ext4_write_inode(struct inode *, struct writeback_control *); |
1232 |
+ extern int ext4_setattr(struct dentry *, struct iattr *); |
1233 |
+ extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, |
1234 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
1235 |
+index 999d2a54297d..51c2713a615a 100644 |
1236 |
+--- a/fs/ext4/extents.c |
1237 |
++++ b/fs/ext4/extents.c |
1238 |
+@@ -510,6 +510,30 @@ int ext4_ext_check_inode(struct inode *inode) |
1239 |
+ return ext4_ext_check(inode, ext_inode_hdr(inode), ext_depth(inode), 0); |
1240 |
+ } |
1241 |
+ |
1242 |
++static void ext4_cache_extents(struct inode *inode, |
1243 |
++ struct ext4_extent_header *eh) |
1244 |
++{ |
1245 |
++ struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
1246 |
++ ext4_lblk_t prev = 0; |
1247 |
++ int i; |
1248 |
++ |
1249 |
++ for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
1250 |
++ unsigned int status = EXTENT_STATUS_WRITTEN; |
1251 |
++ ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
1252 |
++ int len = ext4_ext_get_actual_len(ex); |
1253 |
++ |
1254 |
++ if (prev && (prev != lblk)) |
1255 |
++ ext4_es_cache_extent(inode, prev, lblk - prev, ~0, |
1256 |
++ EXTENT_STATUS_HOLE); |
1257 |
++ |
1258 |
++ if (ext4_ext_is_unwritten(ex)) |
1259 |
++ status = EXTENT_STATUS_UNWRITTEN; |
1260 |
++ ext4_es_cache_extent(inode, lblk, len, |
1261 |
++ ext4_ext_pblock(ex), status); |
1262 |
++ prev = lblk + len; |
1263 |
++ } |
1264 |
++} |
1265 |
++ |
1266 |
+ static struct buffer_head * |
1267 |
+ __read_extent_tree_block(const char *function, unsigned int line, |
1268 |
+ struct inode *inode, ext4_fsblk_t pblk, int depth, |
1269 |
+@@ -530,36 +554,21 @@ __read_extent_tree_block(const char *function, unsigned int line, |
1270 |
+ } |
1271 |
+ if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) |
1272 |
+ return bh; |
1273 |
+- err = __ext4_ext_check(function, line, inode, |
1274 |
+- ext_block_hdr(bh), depth, pblk); |
1275 |
+- if (err) |
1276 |
+- goto errout; |
1277 |
++ if (!ext4_has_feature_journal(inode->i_sb) || |
1278 |
++ (inode->i_ino != |
1279 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) { |
1280 |
++ err = __ext4_ext_check(function, line, inode, |
1281 |
++ ext_block_hdr(bh), depth, pblk); |
1282 |
++ if (err) |
1283 |
++ goto errout; |
1284 |
++ } |
1285 |
+ set_buffer_verified(bh); |
1286 |
+ /* |
1287 |
+ * If this is a leaf block, cache all of its entries |
1288 |
+ */ |
1289 |
+ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) { |
1290 |
+ struct ext4_extent_header *eh = ext_block_hdr(bh); |
1291 |
+- struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); |
1292 |
+- ext4_lblk_t prev = 0; |
1293 |
+- int i; |
1294 |
+- |
1295 |
+- for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { |
1296 |
+- unsigned int status = EXTENT_STATUS_WRITTEN; |
1297 |
+- ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); |
1298 |
+- int len = ext4_ext_get_actual_len(ex); |
1299 |
+- |
1300 |
+- if (prev && (prev != lblk)) |
1301 |
+- ext4_es_cache_extent(inode, prev, |
1302 |
+- lblk - prev, ~0, |
1303 |
+- EXTENT_STATUS_HOLE); |
1304 |
+- |
1305 |
+- if (ext4_ext_is_unwritten(ex)) |
1306 |
+- status = EXTENT_STATUS_UNWRITTEN; |
1307 |
+- ext4_es_cache_extent(inode, lblk, len, |
1308 |
+- ext4_ext_pblock(ex), status); |
1309 |
+- prev = lblk + len; |
1310 |
+- } |
1311 |
++ ext4_cache_extents(inode, eh); |
1312 |
+ } |
1313 |
+ return bh; |
1314 |
+ errout: |
1315 |
+@@ -907,6 +916,8 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, |
1316 |
+ path[0].p_bh = NULL; |
1317 |
+ |
1318 |
+ i = depth; |
1319 |
++ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) |
1320 |
++ ext4_cache_extents(inode, eh); |
1321 |
+ /* walk through the tree */ |
1322 |
+ while (i) { |
1323 |
+ ext_debug("depth %d: num %d, max %d\n", |
1324 |
+diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
1325 |
+index c5af7bbf906f..2b699b1f42c0 100644 |
1326 |
+--- a/fs/ext4/ialloc.c |
1327 |
++++ b/fs/ext4/ialloc.c |
1328 |
+@@ -1158,7 +1158,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) |
1329 |
+ if (!ext4_test_bit(bit, bitmap_bh->b_data)) |
1330 |
+ goto bad_orphan; |
1331 |
+ |
1332 |
+- inode = ext4_iget(sb, ino); |
1333 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL); |
1334 |
+ if (IS_ERR(inode)) { |
1335 |
+ err = PTR_ERR(inode); |
1336 |
+ ext4_error(sb, "couldn't read orphan inode %lu (err %d)", |
1337 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
1338 |
+index 45bcde1969e3..e049dc682e57 100644 |
1339 |
+--- a/fs/ext4/inode.c |
1340 |
++++ b/fs/ext4/inode.c |
1341 |
+@@ -374,6 +374,10 @@ static int __check_block_validity(struct inode *inode, const char *func, |
1342 |
+ unsigned int line, |
1343 |
+ struct ext4_map_blocks *map) |
1344 |
+ { |
1345 |
++ if (ext4_has_feature_journal(inode->i_sb) && |
1346 |
++ (inode->i_ino == |
1347 |
++ le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) |
1348 |
++ return 0; |
1349 |
+ if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, |
1350 |
+ map->m_len)) { |
1351 |
+ ext4_error_inode(inode, func, line, map->m_pblk, |
1352 |
+@@ -4474,7 +4478,9 @@ int ext4_get_projid(struct inode *inode, kprojid_t *projid) |
1353 |
+ return 0; |
1354 |
+ } |
1355 |
+ |
1356 |
+-struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1357 |
++struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, |
1358 |
++ ext4_iget_flags flags, const char *function, |
1359 |
++ unsigned int line) |
1360 |
+ { |
1361 |
+ struct ext4_iloc iloc; |
1362 |
+ struct ext4_inode *raw_inode; |
1363 |
+@@ -4488,6 +4494,18 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1364 |
+ gid_t i_gid; |
1365 |
+ projid_t i_projid; |
1366 |
+ |
1367 |
++ if (((flags & EXT4_IGET_NORMAL) && |
1368 |
++ (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) || |
1369 |
++ (ino < EXT4_ROOT_INO) || |
1370 |
++ (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) { |
1371 |
++ if (flags & EXT4_IGET_HANDLE) |
1372 |
++ return ERR_PTR(-ESTALE); |
1373 |
++ __ext4_error(sb, function, line, |
1374 |
++ "inode #%lu: comm %s: iget: illegal inode #", |
1375 |
++ ino, current->comm); |
1376 |
++ return ERR_PTR(-EFSCORRUPTED); |
1377 |
++ } |
1378 |
++ |
1379 |
+ inode = iget_locked(sb, ino); |
1380 |
+ if (!inode) |
1381 |
+ return ERR_PTR(-ENOMEM); |
1382 |
+@@ -4503,11 +4521,18 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1383 |
+ raw_inode = ext4_raw_inode(&iloc); |
1384 |
+ |
1385 |
+ if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) { |
1386 |
+- EXT4_ERROR_INODE(inode, "root inode unallocated"); |
1387 |
++ ext4_error_inode(inode, function, line, 0, |
1388 |
++ "iget: root inode unallocated"); |
1389 |
+ ret = -EFSCORRUPTED; |
1390 |
+ goto bad_inode; |
1391 |
+ } |
1392 |
+ |
1393 |
++ if ((flags & EXT4_IGET_HANDLE) && |
1394 |
++ (raw_inode->i_links_count == 0) && (raw_inode->i_mode == 0)) { |
1395 |
++ ret = -ESTALE; |
1396 |
++ goto bad_inode; |
1397 |
++ } |
1398 |
++ |
1399 |
+ if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { |
1400 |
+ ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); |
1401 |
+ if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > |
1402 |
+@@ -4534,7 +4559,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1403 |
+ } |
1404 |
+ |
1405 |
+ if (!ext4_inode_csum_verify(inode, raw_inode, ei)) { |
1406 |
+- EXT4_ERROR_INODE(inode, "checksum invalid"); |
1407 |
++ ext4_error_inode(inode, function, line, 0, |
1408 |
++ "iget: checksum invalid"); |
1409 |
+ ret = -EFSBADCRC; |
1410 |
+ goto bad_inode; |
1411 |
+ } |
1412 |
+@@ -4590,7 +4616,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1413 |
+ ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32; |
1414 |
+ inode->i_size = ext4_isize(raw_inode); |
1415 |
+ if ((size = i_size_read(inode)) < 0) { |
1416 |
+- EXT4_ERROR_INODE(inode, "bad i_size value: %lld", size); |
1417 |
++ ext4_error_inode(inode, function, line, 0, |
1418 |
++ "iget: bad i_size value: %lld", size); |
1419 |
+ ret = -EFSCORRUPTED; |
1420 |
+ goto bad_inode; |
1421 |
+ } |
1422 |
+@@ -4673,7 +4700,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1423 |
+ ret = 0; |
1424 |
+ if (ei->i_file_acl && |
1425 |
+ !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { |
1426 |
+- EXT4_ERROR_INODE(inode, "bad extended attribute block %llu", |
1427 |
++ ext4_error_inode(inode, function, line, 0, |
1428 |
++ "iget: bad extended attribute block %llu", |
1429 |
+ ei->i_file_acl); |
1430 |
+ ret = -EFSCORRUPTED; |
1431 |
+ goto bad_inode; |
1432 |
+@@ -4728,7 +4756,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
1433 |
+ make_bad_inode(inode); |
1434 |
+ } else { |
1435 |
+ ret = -EFSCORRUPTED; |
1436 |
+- EXT4_ERROR_INODE(inode, "bogus i_mode (%o)", inode->i_mode); |
1437 |
++ ext4_error_inode(inode, function, line, 0, |
1438 |
++ "iget: bogus i_mode (%o)", inode->i_mode); |
1439 |
+ goto bad_inode; |
1440 |
+ } |
1441 |
+ brelse(iloc.bh); |
1442 |
+@@ -4742,13 +4771,6 @@ bad_inode: |
1443 |
+ return ERR_PTR(ret); |
1444 |
+ } |
1445 |
+ |
1446 |
+-struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino) |
1447 |
+-{ |
1448 |
+- if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) |
1449 |
+- return ERR_PTR(-EFSCORRUPTED); |
1450 |
+- return ext4_iget(sb, ino); |
1451 |
+-} |
1452 |
+- |
1453 |
+ static int ext4_inode_blocks_set(handle_t *handle, |
1454 |
+ struct ext4_inode *raw_inode, |
1455 |
+ struct ext4_inode_info *ei) |
1456 |
+diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c |
1457 |
+index baa2f6375226..eada4172c4ef 100644 |
1458 |
+--- a/fs/ext4/ioctl.c |
1459 |
++++ b/fs/ext4/ioctl.c |
1460 |
+@@ -104,7 +104,7 @@ static long swap_inode_boot_loader(struct super_block *sb, |
1461 |
+ if (!inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN)) |
1462 |
+ return -EPERM; |
1463 |
+ |
1464 |
+- inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO); |
1465 |
++ inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO, EXT4_IGET_SPECIAL); |
1466 |
+ if (IS_ERR(inode_bl)) |
1467 |
+ return PTR_ERR(inode_bl); |
1468 |
+ ei_bl = EXT4_I(inode_bl); |
1469 |
+diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c |
1470 |
+index c18668e3135e..ac13de1a7e42 100644 |
1471 |
+--- a/fs/ext4/mballoc.c |
1472 |
++++ b/fs/ext4/mballoc.c |
1473 |
+@@ -1944,7 +1944,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
1474 |
+ int free; |
1475 |
+ |
1476 |
+ free = e4b->bd_info->bb_free; |
1477 |
+- BUG_ON(free <= 0); |
1478 |
++ if (WARN_ON(free <= 0)) |
1479 |
++ return; |
1480 |
+ |
1481 |
+ i = e4b->bd_info->bb_first_free; |
1482 |
+ |
1483 |
+@@ -1965,7 +1966,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, |
1484 |
+ } |
1485 |
+ |
1486 |
+ mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); |
1487 |
+- BUG_ON(ex.fe_len <= 0); |
1488 |
++ if (WARN_ON(ex.fe_len <= 0)) |
1489 |
++ break; |
1490 |
+ if (free < ex.fe_len) { |
1491 |
+ ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, |
1492 |
+ "%d free clusters as per " |
1493 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
1494 |
+index 339ede11896a..6225ce9f1884 100644 |
1495 |
+--- a/fs/ext4/namei.c |
1496 |
++++ b/fs/ext4/namei.c |
1497 |
+@@ -1626,7 +1626,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi |
1498 |
+ dentry); |
1499 |
+ return ERR_PTR(-EFSCORRUPTED); |
1500 |
+ } |
1501 |
+- inode = ext4_iget_normal(dir->i_sb, ino); |
1502 |
++ inode = ext4_iget(dir->i_sb, ino, EXT4_IGET_NORMAL); |
1503 |
+ if (inode == ERR_PTR(-ESTALE)) { |
1504 |
+ EXT4_ERROR_INODE(dir, |
1505 |
+ "deleted inode referenced: %u", |
1506 |
+@@ -1675,7 +1675,7 @@ struct dentry *ext4_get_parent(struct dentry *child) |
1507 |
+ return ERR_PTR(-EFSCORRUPTED); |
1508 |
+ } |
1509 |
+ |
1510 |
+- return d_obtain_alias(ext4_iget_normal(child->d_sb, ino)); |
1511 |
++ return d_obtain_alias(ext4_iget(child->d_sb, ino, EXT4_IGET_NORMAL)); |
1512 |
+ } |
1513 |
+ |
1514 |
+ /* |
1515 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
1516 |
+index 845d9841c91c..51fa706707a3 100644 |
1517 |
+--- a/fs/ext4/resize.c |
1518 |
++++ b/fs/ext4/resize.c |
1519 |
+@@ -1649,7 +1649,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) |
1520 |
+ "No reserved GDT blocks, can't resize"); |
1521 |
+ return -EPERM; |
1522 |
+ } |
1523 |
+- inode = ext4_iget(sb, EXT4_RESIZE_INO); |
1524 |
++ inode = ext4_iget(sb, EXT4_RESIZE_INO, EXT4_IGET_SPECIAL); |
1525 |
+ if (IS_ERR(inode)) { |
1526 |
+ ext4_warning(sb, "Error opening resize inode"); |
1527 |
+ return PTR_ERR(inode); |
1528 |
+@@ -1977,7 +1977,8 @@ retry: |
1529 |
+ } |
1530 |
+ |
1531 |
+ if (!resize_inode) |
1532 |
+- resize_inode = ext4_iget(sb, EXT4_RESIZE_INO); |
1533 |
++ resize_inode = ext4_iget(sb, EXT4_RESIZE_INO, |
1534 |
++ EXT4_IGET_SPECIAL); |
1535 |
+ if (IS_ERR(resize_inode)) { |
1536 |
+ ext4_warning(sb, "Error opening resize inode"); |
1537 |
+ return PTR_ERR(resize_inode); |
1538 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
1539 |
+index ed0520fe4dad..370e4273042c 100644 |
1540 |
+--- a/fs/ext4/super.c |
1541 |
++++ b/fs/ext4/super.c |
1542 |
+@@ -1049,20 +1049,11 @@ static struct inode *ext4_nfs_get_inode(struct super_block *sb, |
1543 |
+ { |
1544 |
+ struct inode *inode; |
1545 |
+ |
1546 |
+- if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) |
1547 |
+- return ERR_PTR(-ESTALE); |
1548 |
+- if (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)) |
1549 |
+- return ERR_PTR(-ESTALE); |
1550 |
+- |
1551 |
+- /* iget isn't really right if the inode is currently unallocated!! |
1552 |
+- * |
1553 |
+- * ext4_read_inode will return a bad_inode if the inode had been |
1554 |
+- * deleted, so we should be safe. |
1555 |
+- * |
1556 |
++ /* |
1557 |
+ * Currently we don't know the generation for parent directory, so |
1558 |
+ * a generation of 0 means "accept any" |
1559 |
+ */ |
1560 |
+- inode = ext4_iget_normal(sb, ino); |
1561 |
++ inode = ext4_iget(sb, ino, EXT4_IGET_HANDLE); |
1562 |
+ if (IS_ERR(inode)) |
1563 |
+ return ERR_CAST(inode); |
1564 |
+ if (generation && inode->i_generation != generation) { |
1565 |
+@@ -3346,7 +3337,8 @@ int ext4_calculate_overhead(struct super_block *sb) |
1566 |
+ */ |
1567 |
+ if (sbi->s_journal && !sbi->journal_bdev) |
1568 |
+ overhead += EXT4_NUM_B2C(sbi, sbi->s_journal->j_maxlen); |
1569 |
+- else if (ext4_has_feature_journal(sb) && !sbi->s_journal) { |
1570 |
++ else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) { |
1571 |
++ /* j_inum for internal journal is non-zero */ |
1572 |
+ j_inode = ext4_get_journal_inode(sb, j_inum); |
1573 |
+ if (j_inode) { |
1574 |
+ j_blocks = j_inode->i_size >> sb->s_blocksize_bits; |
1575 |
+@@ -4195,7 +4187,7 @@ no_journal: |
1576 |
+ * so we can safely mount the rest of the filesystem now. |
1577 |
+ */ |
1578 |
+ |
1579 |
+- root = ext4_iget(sb, EXT4_ROOT_INO); |
1580 |
++ root = ext4_iget(sb, EXT4_ROOT_INO, EXT4_IGET_SPECIAL); |
1581 |
+ if (IS_ERR(root)) { |
1582 |
+ ext4_msg(sb, KERN_ERR, "get root inode failed"); |
1583 |
+ ret = PTR_ERR(root); |
1584 |
+@@ -4447,7 +4439,7 @@ static struct inode *ext4_get_journal_inode(struct super_block *sb, |
1585 |
+ * happen if we iget() an unused inode, as the subsequent iput() |
1586 |
+ * will try to delete it. |
1587 |
+ */ |
1588 |
+- journal_inode = ext4_iget(sb, journal_inum); |
1589 |
++ journal_inode = ext4_iget(sb, journal_inum, EXT4_IGET_SPECIAL); |
1590 |
+ if (IS_ERR(journal_inode)) { |
1591 |
+ ext4_msg(sb, KERN_ERR, "no journal found"); |
1592 |
+ return NULL; |
1593 |
+@@ -5476,7 +5468,7 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id, |
1594 |
+ if (!qf_inums[type]) |
1595 |
+ return -EPERM; |
1596 |
+ |
1597 |
+- qf_inode = ext4_iget(sb, qf_inums[type]); |
1598 |
++ qf_inode = ext4_iget(sb, qf_inums[type], EXT4_IGET_SPECIAL); |
1599 |
+ if (IS_ERR(qf_inode)) { |
1600 |
+ ext4_error(sb, "Bad quota inode # %lu", qf_inums[type]); |
1601 |
+ return PTR_ERR(qf_inode); |
1602 |
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
1603 |
+index 8016cd059db1..b99225e11712 100644 |
1604 |
+--- a/fs/fuse/dev.c |
1605 |
++++ b/fs/fuse/dev.c |
1606 |
+@@ -132,9 +132,13 @@ static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) |
1607 |
+ |
1608 |
+ static void fuse_drop_waiting(struct fuse_conn *fc) |
1609 |
+ { |
1610 |
+- if (fc->connected) { |
1611 |
+- atomic_dec(&fc->num_waiting); |
1612 |
+- } else if (atomic_dec_and_test(&fc->num_waiting)) { |
1613 |
++ /* |
1614 |
++ * lockess check of fc->connected is okay, because atomic_dec_and_test() |
1615 |
++ * provides a memory barrier mached with the one in fuse_wait_aborted() |
1616 |
++ * to ensure no wake-up is missed. |
1617 |
++ */ |
1618 |
++ if (atomic_dec_and_test(&fc->num_waiting) && |
1619 |
++ !READ_ONCE(fc->connected)) { |
1620 |
+ /* wake up aborters */ |
1621 |
+ wake_up_all(&fc->blocked_waitq); |
1622 |
+ } |
1623 |
+@@ -2164,6 +2168,8 @@ EXPORT_SYMBOL_GPL(fuse_abort_conn); |
1624 |
+ |
1625 |
+ void fuse_wait_aborted(struct fuse_conn *fc) |
1626 |
+ { |
1627 |
++ /* matches implicit memory barrier in fuse_drop_waiting() */ |
1628 |
++ smp_mb(); |
1629 |
+ wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); |
1630 |
+ } |
1631 |
+ |
1632 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
1633 |
+index 41f906a6f5d9..3b20c7ff8cc3 100644 |
1634 |
+--- a/fs/namespace.c |
1635 |
++++ b/fs/namespace.c |
1636 |
+@@ -3184,8 +3184,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, |
1637 |
+ /* make certain new is below the root */ |
1638 |
+ if (!is_path_reachable(new_mnt, new.dentry, &root)) |
1639 |
+ goto out4; |
1640 |
+- root_mp->m_count++; /* pin it so it won't go away */ |
1641 |
+ lock_mount_hash(); |
1642 |
++ root_mp->m_count++; /* pin it so it won't go away */ |
1643 |
+ detach_mnt(new_mnt, &parent_path); |
1644 |
+ detach_mnt(root_mnt, &root_parent); |
1645 |
+ if (root_mnt->mnt.mnt_flags & MNT_LOCKED) { |
1646 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
1647 |
+index 4509c76716e3..5c9231d5e14a 100644 |
1648 |
+--- a/fs/nfsd/nfs4state.c |
1649 |
++++ b/fs/nfsd/nfs4state.c |
1650 |
+@@ -246,6 +246,8 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh, |
1651 |
+ if (!nbl) { |
1652 |
+ nbl= kmalloc(sizeof(*nbl), GFP_KERNEL); |
1653 |
+ if (nbl) { |
1654 |
++ INIT_LIST_HEAD(&nbl->nbl_list); |
1655 |
++ INIT_LIST_HEAD(&nbl->nbl_lru); |
1656 |
+ fh_copy_shallow(&nbl->nbl_fh, fh); |
1657 |
+ locks_init_lock(&nbl->nbl_lock); |
1658 |
+ nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client, |
1659 |
+diff --git a/fs/pnode.c b/fs/pnode.c |
1660 |
+index d15c63e97ef1..64e9a401d67d 100644 |
1661 |
+--- a/fs/pnode.c |
1662 |
++++ b/fs/pnode.c |
1663 |
+@@ -268,14 +268,13 @@ static int propagate_one(struct mount *m) |
1664 |
+ if (IS_ERR(child)) |
1665 |
+ return PTR_ERR(child); |
1666 |
+ child->mnt.mnt_flags &= ~MNT_LOCKED; |
1667 |
++ read_seqlock_excl(&mount_lock); |
1668 |
+ mnt_set_mountpoint(m, mp, child); |
1669 |
++ if (m->mnt_master != dest_master) |
1670 |
++ SET_MNT_MARK(m->mnt_master); |
1671 |
++ read_sequnlock_excl(&mount_lock); |
1672 |
+ last_dest = m; |
1673 |
+ last_source = child; |
1674 |
+- if (m->mnt_master != dest_master) { |
1675 |
+- read_seqlock_excl(&mount_lock); |
1676 |
+- SET_MNT_MARK(m->mnt_master); |
1677 |
+- read_sequnlock_excl(&mount_lock); |
1678 |
+- } |
1679 |
+ hlist_add_head(&child->mnt_hash, list); |
1680 |
+ return count_mounts(m->mnt_ns, child); |
1681 |
+ } |
1682 |
+diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c |
1683 |
+index 93d13f4010c1..8e8012769f3e 100644 |
1684 |
+--- a/fs/proc/vmcore.c |
1685 |
++++ b/fs/proc/vmcore.c |
1686 |
+@@ -459,7 +459,7 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma) |
1687 |
+ tsz = min(elfcorebuf_sz + elfnotes_sz - (size_t)start, size); |
1688 |
+ kaddr = elfnotes_buf + start - elfcorebuf_sz; |
1689 |
+ if (remap_vmalloc_range_partial(vma, vma->vm_start + len, |
1690 |
+- kaddr, tsz)) |
1691 |
++ kaddr, 0, tsz)) |
1692 |
+ goto fail; |
1693 |
+ size -= tsz; |
1694 |
+ start += tsz; |
1695 |
+diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c |
1696 |
+index 17d3c964a2a2..6b753b969f7b 100644 |
1697 |
+--- a/fs/xfs/xfs_reflink.c |
1698 |
++++ b/fs/xfs/xfs_reflink.c |
1699 |
+@@ -1162,6 +1162,7 @@ xfs_reflink_remap_extent( |
1700 |
+ uirec.br_startblock = irec->br_startblock + rlen; |
1701 |
+ uirec.br_startoff = irec->br_startoff + rlen; |
1702 |
+ uirec.br_blockcount = unmap_len - rlen; |
1703 |
++ uirec.br_state = irec->br_state; |
1704 |
+ unmap_len = rlen; |
1705 |
+ |
1706 |
+ /* If this isn't a real mapping, we're done. */ |
1707 |
+diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h |
1708 |
+index ab90a8541aaa..bb4af1bfcaf4 100644 |
1709 |
+--- a/include/linux/kvm_host.h |
1710 |
++++ b/include/linux/kvm_host.h |
1711 |
+@@ -914,7 +914,7 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn) |
1712 |
+ start = slot + 1; |
1713 |
+ } |
1714 |
+ |
1715 |
+- if (gfn >= memslots[start].base_gfn && |
1716 |
++ if (start < slots->used_slots && gfn >= memslots[start].base_gfn && |
1717 |
+ gfn < memslots[start].base_gfn + memslots[start].npages) { |
1718 |
+ atomic_set(&slots->lru_slot, start); |
1719 |
+ return &memslots[start]; |
1720 |
+diff --git a/include/linux/overflow.h b/include/linux/overflow.h |
1721 |
+index c8890ec358a7..d309788f4cd2 100644 |
1722 |
+--- a/include/linux/overflow.h |
1723 |
++++ b/include/linux/overflow.h |
1724 |
+@@ -202,4 +202,35 @@ |
1725 |
+ |
1726 |
+ #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */ |
1727 |
+ |
1728 |
++/** check_shl_overflow() - Calculate a left-shifted value and check overflow |
1729 |
++ * |
1730 |
++ * @a: Value to be shifted |
1731 |
++ * @s: How many bits left to shift |
1732 |
++ * @d: Pointer to where to store the result |
1733 |
++ * |
1734 |
++ * Computes *@d = (@a << @s) |
1735 |
++ * |
1736 |
++ * Returns true if '*d' cannot hold the result or when 'a << s' doesn't |
1737 |
++ * make sense. Example conditions: |
1738 |
++ * - 'a << s' causes bits to be lost when stored in *d. |
1739 |
++ * - 's' is garbage (e.g. negative) or so large that the result of |
1740 |
++ * 'a << s' is guaranteed to be 0. |
1741 |
++ * - 'a' is negative. |
1742 |
++ * - 'a << s' sets the sign bit, if any, in '*d'. |
1743 |
++ * |
1744 |
++ * '*d' will hold the results of the attempted shift, but is not |
1745 |
++ * considered "safe for use" if false is returned. |
1746 |
++ */ |
1747 |
++#define check_shl_overflow(a, s, d) ({ \ |
1748 |
++ typeof(a) _a = a; \ |
1749 |
++ typeof(s) _s = s; \ |
1750 |
++ typeof(d) _d = d; \ |
1751 |
++ u64 _a_full = _a; \ |
1752 |
++ unsigned int _to_shift = \ |
1753 |
++ _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \ |
1754 |
++ *_d = (_a_full << _to_shift); \ |
1755 |
++ (_to_shift != _s || *_d < 0 || _a < 0 || \ |
1756 |
++ (*_d >> _to_shift) != _a); \ |
1757 |
++}) |
1758 |
++ |
1759 |
+ #endif /* __LINUX_OVERFLOW_H */ |
1760 |
+diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h |
1761 |
+index d868a735545b..72c9c75e894f 100644 |
1762 |
+--- a/include/linux/vmalloc.h |
1763 |
++++ b/include/linux/vmalloc.h |
1764 |
+@@ -89,7 +89,7 @@ extern void vunmap(const void *addr); |
1765 |
+ |
1766 |
+ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, |
1767 |
+ unsigned long uaddr, void *kaddr, |
1768 |
+- unsigned long size); |
1769 |
++ unsigned long pgoff, unsigned long size); |
1770 |
+ |
1771 |
+ extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
1772 |
+ unsigned long pgoff); |
1773 |
+diff --git a/include/net/tcp.h b/include/net/tcp.h |
1774 |
+index 0e3a88f808c6..f26f075250b4 100644 |
1775 |
+--- a/include/net/tcp.h |
1776 |
++++ b/include/net/tcp.h |
1777 |
+@@ -51,7 +51,7 @@ extern struct inet_hashinfo tcp_hashinfo; |
1778 |
+ extern struct percpu_counter tcp_orphan_count; |
1779 |
+ void tcp_time_wait(struct sock *sk, int state, int timeo); |
1780 |
+ |
1781 |
+-#define MAX_TCP_HEADER (128 + MAX_HEADER) |
1782 |
++#define MAX_TCP_HEADER L1_CACHE_ALIGN(128 + MAX_HEADER) |
1783 |
+ #define MAX_TCP_OPTION_SPACE 40 |
1784 |
+ #define TCP_MIN_SND_MSS 48 |
1785 |
+ #define TCP_MIN_GSO_SIZE (TCP_MIN_SND_MSS - MAX_TCP_OPTION_SPACE) |
1786 |
+diff --git a/ipc/util.c b/ipc/util.c |
1787 |
+index 798cad18dd87..e65ecf3ccbda 100644 |
1788 |
+--- a/ipc/util.c |
1789 |
++++ b/ipc/util.c |
1790 |
+@@ -751,13 +751,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos, |
1791 |
+ total++; |
1792 |
+ } |
1793 |
+ |
1794 |
++ *new_pos = pos + 1; |
1795 |
+ if (total >= ids->in_use) |
1796 |
+ return NULL; |
1797 |
+ |
1798 |
+ for (; pos < IPCMNI; pos++) { |
1799 |
+ ipc = idr_find(&ids->ipcs_idr, pos); |
1800 |
+ if (ipc != NULL) { |
1801 |
+- *new_pos = pos + 1; |
1802 |
+ rcu_read_lock(); |
1803 |
+ ipc_lock_object(ipc); |
1804 |
+ return ipc; |
1805 |
+diff --git a/kernel/audit.c b/kernel/audit.c |
1806 |
+index 53dcaa3b67bc..af1e00f52bd0 100644 |
1807 |
+--- a/kernel/audit.c |
1808 |
++++ b/kernel/audit.c |
1809 |
+@@ -941,6 +941,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
1810 |
+ case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2: |
1811 |
+ if (!audit_enabled && msg_type != AUDIT_USER_AVC) |
1812 |
+ return 0; |
1813 |
++ /* exit early if there isn't at least one character to print */ |
1814 |
++ if (data_len < 2) |
1815 |
++ return -EINVAL; |
1816 |
+ |
1817 |
+ err = audit_filter(msg_type, AUDIT_FILTER_USER); |
1818 |
+ if (err == 1) { /* match or error */ |
1819 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
1820 |
+index 97b90faceb97..1f27b73bd7d4 100644 |
1821 |
+--- a/kernel/events/core.c |
1822 |
++++ b/kernel/events/core.c |
1823 |
+@@ -6431,10 +6431,17 @@ static void perf_event_task_output(struct perf_event *event, |
1824 |
+ goto out; |
1825 |
+ |
1826 |
+ task_event->event_id.pid = perf_event_pid(event, task); |
1827 |
+- task_event->event_id.ppid = perf_event_pid(event, current); |
1828 |
+- |
1829 |
+ task_event->event_id.tid = perf_event_tid(event, task); |
1830 |
+- task_event->event_id.ptid = perf_event_tid(event, current); |
1831 |
++ |
1832 |
++ if (task_event->event_id.header.type == PERF_RECORD_EXIT) { |
1833 |
++ task_event->event_id.ppid = perf_event_pid(event, |
1834 |
++ task->real_parent); |
1835 |
++ task_event->event_id.ptid = perf_event_pid(event, |
1836 |
++ task->real_parent); |
1837 |
++ } else { /* PERF_RECORD_FORK */ |
1838 |
++ task_event->event_id.ppid = perf_event_pid(event, current); |
1839 |
++ task_event->event_id.ptid = perf_event_tid(event, current); |
1840 |
++ } |
1841 |
+ |
1842 |
+ task_event->event_id.time = perf_event_clock(event); |
1843 |
+ |
1844 |
+diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c |
1845 |
+index edf67c493a8e..e473f6a1f6ca 100644 |
1846 |
+--- a/kernel/gcov/fs.c |
1847 |
++++ b/kernel/gcov/fs.c |
1848 |
+@@ -108,9 +108,9 @@ static void *gcov_seq_next(struct seq_file *seq, void *data, loff_t *pos) |
1849 |
+ { |
1850 |
+ struct gcov_iterator *iter = data; |
1851 |
+ |
1852 |
++ (*pos)++; |
1853 |
+ if (gcov_iter_next(iter)) |
1854 |
+ return NULL; |
1855 |
+- (*pos)++; |
1856 |
+ |
1857 |
+ return iter; |
1858 |
+ } |
1859 |
+diff --git a/mm/vmalloc.c b/mm/vmalloc.c |
1860 |
+index 153deec1df35..c74a087fcb7d 100644 |
1861 |
+--- a/mm/vmalloc.c |
1862 |
++++ b/mm/vmalloc.c |
1863 |
+@@ -31,6 +31,7 @@ |
1864 |
+ #include <linux/compiler.h> |
1865 |
+ #include <linux/llist.h> |
1866 |
+ #include <linux/bitops.h> |
1867 |
++#include <linux/overflow.h> |
1868 |
+ |
1869 |
+ #include <asm/uaccess.h> |
1870 |
+ #include <asm/tlbflush.h> |
1871 |
+@@ -2173,6 +2174,7 @@ finished: |
1872 |
+ * @vma: vma to cover |
1873 |
+ * @uaddr: target user address to start at |
1874 |
+ * @kaddr: virtual address of vmalloc kernel memory |
1875 |
++ * @pgoff: offset from @kaddr to start at |
1876 |
+ * @size: size of map area |
1877 |
+ * |
1878 |
+ * Returns: 0 for success, -Exxx on failure |
1879 |
+@@ -2185,9 +2187,15 @@ finished: |
1880 |
+ * Similar to remap_pfn_range() (see mm/memory.c) |
1881 |
+ */ |
1882 |
+ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, |
1883 |
+- void *kaddr, unsigned long size) |
1884 |
++ void *kaddr, unsigned long pgoff, |
1885 |
++ unsigned long size) |
1886 |
+ { |
1887 |
+ struct vm_struct *area; |
1888 |
++ unsigned long off; |
1889 |
++ unsigned long end_index; |
1890 |
++ |
1891 |
++ if (check_shl_overflow(pgoff, PAGE_SHIFT, &off)) |
1892 |
++ return -EINVAL; |
1893 |
+ |
1894 |
+ size = PAGE_ALIGN(size); |
1895 |
+ |
1896 |
+@@ -2201,8 +2209,10 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, |
1897 |
+ if (!(area->flags & VM_USERMAP)) |
1898 |
+ return -EINVAL; |
1899 |
+ |
1900 |
+- if (kaddr + size > area->addr + get_vm_area_size(area)) |
1901 |
++ if (check_add_overflow(size, off, &end_index) || |
1902 |
++ end_index > get_vm_area_size(area)) |
1903 |
+ return -EINVAL; |
1904 |
++ kaddr += off; |
1905 |
+ |
1906 |
+ do { |
1907 |
+ struct page *page = vmalloc_to_page(kaddr); |
1908 |
+@@ -2241,7 +2251,7 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
1909 |
+ unsigned long pgoff) |
1910 |
+ { |
1911 |
+ return remap_vmalloc_range_partial(vma, vma->vm_start, |
1912 |
+- addr + (pgoff << PAGE_SHIFT), |
1913 |
++ addr, pgoff, |
1914 |
+ vma->vm_end - vma->vm_start); |
1915 |
+ } |
1916 |
+ EXPORT_SYMBOL(remap_vmalloc_range); |
1917 |
+diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c |
1918 |
+index 58e0dab06f19..8afb67a48409 100644 |
1919 |
+--- a/net/ipv4/ip_vti.c |
1920 |
++++ b/net/ipv4/ip_vti.c |
1921 |
+@@ -696,10 +696,8 @@ static int __init vti_init(void) |
1922 |
+ |
1923 |
+ msg = "ipip tunnel"; |
1924 |
+ err = xfrm4_tunnel_register(&ipip_handler, AF_INET); |
1925 |
+- if (err < 0) { |
1926 |
+- pr_info("%s: cant't register tunnel\n",__func__); |
1927 |
++ if (err < 0) |
1928 |
+ goto xfrm_tunnel_failed; |
1929 |
+- } |
1930 |
+ |
1931 |
+ msg = "netlink interface"; |
1932 |
+ err = rtnl_link_register(&vti_link_ops); |
1933 |
+diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c |
1934 |
+index ed53bf5d2b68..af75c0a8238e 100644 |
1935 |
+--- a/net/ipv4/raw.c |
1936 |
++++ b/net/ipv4/raw.c |
1937 |
+@@ -509,9 +509,11 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
1938 |
+ goto out; |
1939 |
+ |
1940 |
+ /* hdrincl should be READ_ONCE(inet->hdrincl) |
1941 |
+- * but READ_ONCE() doesn't work with bit fields |
1942 |
++ * but READ_ONCE() doesn't work with bit fields. |
1943 |
++ * Doing this indirectly yields the same result. |
1944 |
+ */ |
1945 |
+ hdrincl = inet->hdrincl; |
1946 |
++ hdrincl = READ_ONCE(hdrincl); |
1947 |
+ /* |
1948 |
+ * Check the flags. |
1949 |
+ */ |
1950 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
1951 |
+index 8f5c6fa54ac0..b4f24eabfa54 100644 |
1952 |
+--- a/net/ipv4/route.c |
1953 |
++++ b/net/ipv4/route.c |
1954 |
+@@ -131,8 +131,6 @@ static int ip_rt_min_advmss __read_mostly = 256; |
1955 |
+ |
1956 |
+ static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; |
1957 |
+ |
1958 |
+-static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; |
1959 |
+- |
1960 |
+ /* |
1961 |
+ * Interface to generic destination cache. |
1962 |
+ */ |
1963 |
+@@ -2712,6 +2710,7 @@ void ip_rt_multicast_event(struct in_device *in_dev) |
1964 |
+ static int ip_rt_gc_interval __read_mostly = 60 * HZ; |
1965 |
+ static int ip_rt_gc_min_interval __read_mostly = HZ / 2; |
1966 |
+ static int ip_rt_gc_elasticity __read_mostly = 8; |
1967 |
++static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU; |
1968 |
+ |
1969 |
+ static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write, |
1970 |
+ void __user *buffer, |
1971 |
+diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c |
1972 |
+index 7ee6518afa86..73705a2368d9 100644 |
1973 |
+--- a/net/ipv4/xfrm4_output.c |
1974 |
++++ b/net/ipv4/xfrm4_output.c |
1975 |
+@@ -75,9 +75,7 @@ int xfrm4_output_finish(struct sock *sk, struct sk_buff *skb) |
1976 |
+ { |
1977 |
+ memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
1978 |
+ |
1979 |
+-#ifdef CONFIG_NETFILTER |
1980 |
+ IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
1981 |
+-#endif |
1982 |
+ |
1983 |
+ return xfrm_output(sk, skb); |
1984 |
+ } |
1985 |
+diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c |
1986 |
+index 1080770b5eaf..455fa4a30353 100644 |
1987 |
+--- a/net/ipv6/ipv6_sockglue.c |
1988 |
++++ b/net/ipv6/ipv6_sockglue.c |
1989 |
+@@ -184,15 +184,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, |
1990 |
+ retv = -EBUSY; |
1991 |
+ break; |
1992 |
+ } |
1993 |
+- } else if (sk->sk_protocol == IPPROTO_TCP) { |
1994 |
+- if (sk->sk_prot != &tcpv6_prot) { |
1995 |
+- retv = -EBUSY; |
1996 |
+- break; |
1997 |
+- } |
1998 |
+- break; |
1999 |
+- } else { |
2000 |
++ } |
2001 |
++ if (sk->sk_protocol == IPPROTO_TCP && |
2002 |
++ sk->sk_prot != &tcpv6_prot) { |
2003 |
++ retv = -EBUSY; |
2004 |
+ break; |
2005 |
+ } |
2006 |
++ if (sk->sk_protocol != IPPROTO_TCP) |
2007 |
++ break; |
2008 |
+ if (sk->sk_state != TCP_ESTABLISHED) { |
2009 |
+ retv = -ENOTCONN; |
2010 |
+ break; |
2011 |
+diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c |
2012 |
+index 64862c5084ee..b2dc9a820c6a 100644 |
2013 |
+--- a/net/ipv6/xfrm6_output.c |
2014 |
++++ b/net/ipv6/xfrm6_output.c |
2015 |
+@@ -125,9 +125,7 @@ int xfrm6_output_finish(struct sock *sk, struct sk_buff *skb) |
2016 |
+ { |
2017 |
+ memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); |
2018 |
+ |
2019 |
+-#ifdef CONFIG_NETFILTER |
2020 |
+ IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; |
2021 |
+-#endif |
2022 |
+ |
2023 |
+ return xfrm_output(sk, skb); |
2024 |
+ } |
2025 |
+diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c |
2026 |
+index d72a4f1558f2..ef6a3d586591 100644 |
2027 |
+--- a/net/netrom/nr_route.c |
2028 |
++++ b/net/netrom/nr_route.c |
2029 |
+@@ -199,6 +199,7 @@ static int __must_check nr_add_node(ax25_address *nr, const char *mnemonic, |
2030 |
+ /* refcount initialized at 1 */ |
2031 |
+ spin_unlock_bh(&nr_node_list_lock); |
2032 |
+ |
2033 |
++ nr_neigh_put(nr_neigh); |
2034 |
+ return 0; |
2035 |
+ } |
2036 |
+ nr_node_lock(nr_node); |
2037 |
+diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c |
2038 |
+index 39231237e1c3..30f71620d4e3 100644 |
2039 |
+--- a/net/x25/x25_dev.c |
2040 |
++++ b/net/x25/x25_dev.c |
2041 |
+@@ -120,8 +120,10 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, |
2042 |
+ goto drop; |
2043 |
+ } |
2044 |
+ |
2045 |
+- if (!pskb_may_pull(skb, 1)) |
2046 |
++ if (!pskb_may_pull(skb, 1)) { |
2047 |
++ x25_neigh_put(nb); |
2048 |
+ return 0; |
2049 |
++ } |
2050 |
+ |
2051 |
+ switch (skb->data[0]) { |
2052 |
+ |
2053 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
2054 |
+index d8e132a2d1a8..ab16b81c0c7f 100644 |
2055 |
+--- a/sound/pci/hda/hda_intel.c |
2056 |
++++ b/sound/pci/hda/hda_intel.c |
2057 |
+@@ -1967,7 +1967,6 @@ static const struct hdac_io_ops pci_hda_io_ops = { |
2058 |
+ * should be ignored from the beginning. |
2059 |
+ */ |
2060 |
+ static const struct snd_pci_quirk driver_blacklist[] = { |
2061 |
+- SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0), |
2062 |
+ SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0), |
2063 |
+ SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0), |
2064 |
+ {} |
2065 |
+diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c |
2066 |
+index b3464ac99b99..ec8be720d5cd 100644 |
2067 |
+--- a/sound/soc/intel/atom/sst-atom-controls.c |
2068 |
++++ b/sound/soc/intel/atom/sst-atom-controls.c |
2069 |
+@@ -976,7 +976,9 @@ static int sst_set_be_modules(struct snd_soc_dapm_widget *w, |
2070 |
+ dev_dbg(c->dev, "Enter: widget=%s\n", w->name); |
2071 |
+ |
2072 |
+ if (SND_SOC_DAPM_EVENT_ON(event)) { |
2073 |
++ mutex_lock(&drv->lock); |
2074 |
+ ret = sst_send_slot_map(drv); |
2075 |
++ mutex_unlock(&drv->lock); |
2076 |
+ if (ret) |
2077 |
+ return ret; |
2078 |
+ ret = sst_send_pipe_module_params(w, k); |
2079 |
+diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c |
2080 |
+index 73523cf0329b..41a29bb21519 100644 |
2081 |
+--- a/sound/soc/soc-dapm.c |
2082 |
++++ b/sound/soc/soc-dapm.c |
2083 |
+@@ -384,7 +384,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, |
2084 |
+ |
2085 |
+ memset(&template, 0, sizeof(template)); |
2086 |
+ template.reg = e->reg; |
2087 |
+- template.mask = e->mask << e->shift_l; |
2088 |
++ template.mask = e->mask; |
2089 |
+ template.shift = e->shift_l; |
2090 |
+ template.off_val = snd_soc_enum_item_to_val(e, 0); |
2091 |
+ template.on_val = template.off_val; |
2092 |
+@@ -510,8 +510,22 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol, |
2093 |
+ if (data->value == value) |
2094 |
+ return false; |
2095 |
+ |
2096 |
+- if (data->widget) |
2097 |
+- data->widget->on_val = value; |
2098 |
++ if (data->widget) { |
2099 |
++ switch (dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->id) { |
2100 |
++ case snd_soc_dapm_switch: |
2101 |
++ case snd_soc_dapm_mixer: |
2102 |
++ case snd_soc_dapm_mixer_named_ctl: |
2103 |
++ data->widget->on_val = value & data->widget->mask; |
2104 |
++ break; |
2105 |
++ case snd_soc_dapm_demux: |
2106 |
++ case snd_soc_dapm_mux: |
2107 |
++ data->widget->on_val = value >> data->widget->shift; |
2108 |
++ break; |
2109 |
++ default: |
2110 |
++ data->widget->on_val = value; |
2111 |
++ break; |
2112 |
++ } |
2113 |
++ } |
2114 |
+ |
2115 |
+ data->value = value; |
2116 |
+ |
2117 |
+diff --git a/sound/usb/format.c b/sound/usb/format.c |
2118 |
+index 2c44386e5569..eeb56d6fe8aa 100644 |
2119 |
+--- a/sound/usb/format.c |
2120 |
++++ b/sound/usb/format.c |
2121 |
+@@ -220,6 +220,52 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof |
2122 |
+ return 0; |
2123 |
+ } |
2124 |
+ |
2125 |
++/* |
2126 |
++ * Many Focusrite devices supports a limited set of sampling rates per |
2127 |
++ * altsetting. Maximum rate is exposed in the last 4 bytes of Format Type |
2128 |
++ * descriptor which has a non-standard bLength = 10. |
2129 |
++ */ |
2130 |
++static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip, |
2131 |
++ struct audioformat *fp, |
2132 |
++ unsigned int rate) |
2133 |
++{ |
2134 |
++ struct usb_interface *iface; |
2135 |
++ struct usb_host_interface *alts; |
2136 |
++ unsigned char *fmt; |
2137 |
++ unsigned int max_rate; |
2138 |
++ |
2139 |
++ iface = usb_ifnum_to_if(chip->dev, fp->iface); |
2140 |
++ if (!iface) |
2141 |
++ return true; |
2142 |
++ |
2143 |
++ alts = &iface->altsetting[fp->altset_idx]; |
2144 |
++ fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, |
2145 |
++ NULL, UAC_FORMAT_TYPE); |
2146 |
++ if (!fmt) |
2147 |
++ return true; |
2148 |
++ |
2149 |
++ if (fmt[0] == 10) { /* bLength */ |
2150 |
++ max_rate = combine_quad(&fmt[6]); |
2151 |
++ |
2152 |
++ /* Validate max rate */ |
2153 |
++ if (max_rate != 48000 && |
2154 |
++ max_rate != 96000 && |
2155 |
++ max_rate != 192000 && |
2156 |
++ max_rate != 384000) { |
2157 |
++ |
2158 |
++ usb_audio_info(chip, |
2159 |
++ "%u:%d : unexpected max rate: %u\n", |
2160 |
++ fp->iface, fp->altsetting, max_rate); |
2161 |
++ |
2162 |
++ return true; |
2163 |
++ } |
2164 |
++ |
2165 |
++ return rate <= max_rate; |
2166 |
++ } |
2167 |
++ |
2168 |
++ return true; |
2169 |
++} |
2170 |
++ |
2171 |
+ /* |
2172 |
+ * Helper function to walk the array of sample rate triplets reported by |
2173 |
+ * the device. The problem is that we need to parse whole array first to |
2174 |
+@@ -256,6 +302,11 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
2175 |
+ } |
2176 |
+ |
2177 |
+ for (rate = min; rate <= max; rate += res) { |
2178 |
++ /* Filter out invalid rates on Focusrite devices */ |
2179 |
++ if (USB_ID_VENDOR(chip->usb_id) == 0x1235 && |
2180 |
++ !focusrite_valid_sample_rate(chip, fp, rate)) |
2181 |
++ goto skip_rate; |
2182 |
++ |
2183 |
+ if (fp->rate_table) |
2184 |
+ fp->rate_table[nr_rates] = rate; |
2185 |
+ if (!fp->rate_min || rate < fp->rate_min) |
2186 |
+@@ -270,6 +321,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, |
2187 |
+ break; |
2188 |
+ } |
2189 |
+ |
2190 |
++skip_rate: |
2191 |
+ /* avoid endless loop */ |
2192 |
+ if (res == 0) |
2193 |
+ break; |
2194 |
+diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c |
2195 |
+index f4fd9548c529..723b535ca2ec 100644 |
2196 |
+--- a/sound/usb/mixer_quirks.c |
2197 |
++++ b/sound/usb/mixer_quirks.c |
2198 |
+@@ -1519,11 +1519,15 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, |
2199 |
+ |
2200 |
+ /* use known values for that card: interface#1 altsetting#1 */ |
2201 |
+ iface = usb_ifnum_to_if(chip->dev, 1); |
2202 |
+- if (!iface || iface->num_altsetting < 2) |
2203 |
+- return -EINVAL; |
2204 |
++ if (!iface || iface->num_altsetting < 2) { |
2205 |
++ err = -EINVAL; |
2206 |
++ goto end; |
2207 |
++ } |
2208 |
+ alts = &iface->altsetting[1]; |
2209 |
+- if (get_iface_desc(alts)->bNumEndpoints < 1) |
2210 |
+- return -EINVAL; |
2211 |
++ if (get_iface_desc(alts)->bNumEndpoints < 1) { |
2212 |
++ err = -EINVAL; |
2213 |
++ goto end; |
2214 |
++ } |
2215 |
+ ep = get_endpoint(alts, 0)->bEndpointAddress; |
2216 |
+ |
2217 |
+ err = snd_usb_ctl_msg(chip->dev, |
2218 |
+diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c |
2219 |
+index dd40ca9d858a..4f81fedf0e54 100644 |
2220 |
+--- a/sound/usb/usx2y/usbusx2yaudio.c |
2221 |
++++ b/sound/usb/usx2y/usbusx2yaudio.c |
2222 |
+@@ -691,6 +691,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) |
2223 |
+ us->submitted = 2*NOOF_SETRATE_URBS; |
2224 |
+ for (i = 0; i < NOOF_SETRATE_URBS; ++i) { |
2225 |
+ struct urb *urb = us->urb[i]; |
2226 |
++ if (!urb) |
2227 |
++ continue; |
2228 |
+ if (urb->status) { |
2229 |
+ if (!err) |
2230 |
+ err = -ENODEV; |
2231 |
+diff --git a/tools/objtool/check.c b/tools/objtool/check.c |
2232 |
+index db105207757b..360845926f66 100644 |
2233 |
+--- a/tools/objtool/check.c |
2234 |
++++ b/tools/objtool/check.c |
2235 |
+@@ -2035,14 +2035,27 @@ static bool ignore_unreachable_insn(struct instruction *insn) |
2236 |
+ !strcmp(insn->sec->name, ".altinstr_aux")) |
2237 |
+ return true; |
2238 |
+ |
2239 |
++ if (!insn->func) |
2240 |
++ return false; |
2241 |
++ |
2242 |
++ /* |
2243 |
++ * CONFIG_UBSAN_TRAP inserts a UD2 when it sees |
2244 |
++ * __builtin_unreachable(). The BUG() macro has an unreachable() after |
2245 |
++ * the UD2, which causes GCC's undefined trap logic to emit another UD2 |
2246 |
++ * (or occasionally a JMP to UD2). |
2247 |
++ */ |
2248 |
++ if (list_prev_entry(insn, list)->dead_end && |
2249 |
++ (insn->type == INSN_BUG || |
2250 |
++ (insn->type == INSN_JUMP_UNCONDITIONAL && |
2251 |
++ insn->jump_dest && insn->jump_dest->type == INSN_BUG))) |
2252 |
++ return true; |
2253 |
++ |
2254 |
+ /* |
2255 |
+ * Check if this (or a subsequent) instruction is related to |
2256 |
+ * CONFIG_UBSAN or CONFIG_KASAN. |
2257 |
+ * |
2258 |
+ * End the search at 5 instructions to avoid going into the weeds. |
2259 |
+ */ |
2260 |
+- if (!insn->func) |
2261 |
+- return false; |
2262 |
+ for (i = 0; i < 5; i++) { |
2263 |
+ |
2264 |
+ if (is_kasan_insn(insn) || is_ubsan_insn(insn)) |
2265 |
+diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c |
2266 |
+index c3343820916a..7cbbbdd932f1 100644 |
2267 |
+--- a/tools/objtool/orc_dump.c |
2268 |
++++ b/tools/objtool/orc_dump.c |
2269 |
+@@ -78,7 +78,7 @@ int orc_dump(const char *_objname) |
2270 |
+ char *name; |
2271 |
+ size_t nr_sections; |
2272 |
+ Elf64_Addr orc_ip_addr = 0; |
2273 |
+- size_t shstrtab_idx; |
2274 |
++ size_t shstrtab_idx, strtab_idx = 0; |
2275 |
+ Elf *elf; |
2276 |
+ Elf_Scn *scn; |
2277 |
+ GElf_Shdr sh; |
2278 |
+@@ -139,6 +139,8 @@ int orc_dump(const char *_objname) |
2279 |
+ |
2280 |
+ if (!strcmp(name, ".symtab")) { |
2281 |
+ symtab = data; |
2282 |
++ } else if (!strcmp(name, ".strtab")) { |
2283 |
++ strtab_idx = i; |
2284 |
+ } else if (!strcmp(name, ".orc_unwind")) { |
2285 |
+ orc = data->d_buf; |
2286 |
+ orc_size = sh.sh_size; |
2287 |
+@@ -150,7 +152,7 @@ int orc_dump(const char *_objname) |
2288 |
+ } |
2289 |
+ } |
2290 |
+ |
2291 |
+- if (!symtab || !orc || !orc_ip) |
2292 |
++ if (!symtab || !strtab_idx || !orc || !orc_ip) |
2293 |
+ return 0; |
2294 |
+ |
2295 |
+ if (orc_size % sizeof(*orc) != 0) { |
2296 |
+@@ -171,21 +173,29 @@ int orc_dump(const char *_objname) |
2297 |
+ return -1; |
2298 |
+ } |
2299 |
+ |
2300 |
+- scn = elf_getscn(elf, sym.st_shndx); |
2301 |
+- if (!scn) { |
2302 |
+- WARN_ELF("elf_getscn"); |
2303 |
+- return -1; |
2304 |
+- } |
2305 |
+- |
2306 |
+- if (!gelf_getshdr(scn, &sh)) { |
2307 |
+- WARN_ELF("gelf_getshdr"); |
2308 |
+- return -1; |
2309 |
+- } |
2310 |
+- |
2311 |
+- name = elf_strptr(elf, shstrtab_idx, sh.sh_name); |
2312 |
+- if (!name || !*name) { |
2313 |
+- WARN_ELF("elf_strptr"); |
2314 |
+- return -1; |
2315 |
++ if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) { |
2316 |
++ scn = elf_getscn(elf, sym.st_shndx); |
2317 |
++ if (!scn) { |
2318 |
++ WARN_ELF("elf_getscn"); |
2319 |
++ return -1; |
2320 |
++ } |
2321 |
++ |
2322 |
++ if (!gelf_getshdr(scn, &sh)) { |
2323 |
++ WARN_ELF("gelf_getshdr"); |
2324 |
++ return -1; |
2325 |
++ } |
2326 |
++ |
2327 |
++ name = elf_strptr(elf, shstrtab_idx, sh.sh_name); |
2328 |
++ if (!name) { |
2329 |
++ WARN_ELF("elf_strptr"); |
2330 |
++ return -1; |
2331 |
++ } |
2332 |
++ } else { |
2333 |
++ name = elf_strptr(elf, strtab_idx, sym.st_name); |
2334 |
++ if (!name) { |
2335 |
++ WARN_ELF("elf_strptr"); |
2336 |
++ return -1; |
2337 |
++ } |
2338 |
+ } |
2339 |
+ |
2340 |
+ printf("%s+%llx:", name, (unsigned long long)rela.r_addend); |