Contents of /trunk/kernel-alx-legacy/patches-4.9/0371-4.9.272-all-fixes.patch
Parent Directory | Revision Log
Revision 3673 -
(show annotations)
(download)
Mon Oct 24 14:07:50 2022 UTC (23 months ago) by niro
File size: 29723 byte(s)
Mon Oct 24 14:07:50 2022 UTC (23 months ago) by niro
File size: 29723 byte(s)
-linux-4.9.272
1 | diff --git a/Makefile b/Makefile |
2 | index 4964c2494edb5..39aa8b66fc6ff 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 271 |
9 | +SUBLEVEL = 272 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c |
14 | index 5962badb33462..b6fd2a21b015e 100644 |
15 | --- a/arch/arm64/kernel/traps.c |
16 | +++ b/arch/arm64/kernel/traps.c |
17 | @@ -543,14 +543,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs) |
18 | } |
19 | #endif |
20 | |
21 | - if (show_unhandled_signals_ratelimited()) { |
22 | - pr_info("%s[%d]: syscall %d\n", current->comm, |
23 | - task_pid_nr(current), (int)regs->syscallno); |
24 | - dump_instr("", regs); |
25 | - if (user_mode(regs)) |
26 | - __show_regs(regs); |
27 | - } |
28 | - |
29 | return sys_ni_syscall(); |
30 | } |
31 | |
32 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
33 | index 29078eaf18c9b..cbc7f177bbd8e 100644 |
34 | --- a/arch/x86/kvm/svm.c |
35 | +++ b/arch/x86/kvm/svm.c |
36 | @@ -3412,7 +3412,7 @@ static int cr_interception(struct vcpu_svm *svm) |
37 | err = 0; |
38 | if (cr >= 16) { /* mov to cr */ |
39 | cr -= 16; |
40 | - val = kvm_register_read(&svm->vcpu, reg); |
41 | + val = kvm_register_readl(&svm->vcpu, reg); |
42 | switch (cr) { |
43 | case 0: |
44 | if (!check_selective_cr0_intercepted(svm, val)) |
45 | @@ -3457,7 +3457,7 @@ static int cr_interception(struct vcpu_svm *svm) |
46 | kvm_queue_exception(&svm->vcpu, UD_VECTOR); |
47 | return 1; |
48 | } |
49 | - kvm_register_write(&svm->vcpu, reg, val); |
50 | + kvm_register_writel(&svm->vcpu, reg, val); |
51 | } |
52 | kvm_complete_insn_gp(&svm->vcpu, err); |
53 | |
54 | @@ -3489,13 +3489,13 @@ static int dr_interception(struct vcpu_svm *svm) |
55 | if (dr >= 16) { /* mov to DRn */ |
56 | if (!kvm_require_dr(&svm->vcpu, dr - 16)) |
57 | return 1; |
58 | - val = kvm_register_read(&svm->vcpu, reg); |
59 | + val = kvm_register_readl(&svm->vcpu, reg); |
60 | kvm_set_dr(&svm->vcpu, dr - 16, val); |
61 | } else { |
62 | if (!kvm_require_dr(&svm->vcpu, dr)) |
63 | return 1; |
64 | kvm_get_dr(&svm->vcpu, dr, &val); |
65 | - kvm_register_write(&svm->vcpu, reg, val); |
66 | + kvm_register_writel(&svm->vcpu, reg, val); |
67 | } |
68 | |
69 | skip_emulated_instruction(&svm->vcpu); |
70 | diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c |
71 | index c0e54396f2502..dc8d2603612ed 100644 |
72 | --- a/drivers/firmware/efi/cper.c |
73 | +++ b/drivers/firmware/efi/cper.c |
74 | @@ -257,8 +257,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) |
75 | if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE)) |
76 | return 0; |
77 | |
78 | - n = 0; |
79 | - len = CPER_REC_LEN - 1; |
80 | + len = CPER_REC_LEN; |
81 | dmi_memdev_name(mem->mem_dev_handle, &bank, &device); |
82 | if (bank && device) |
83 | n = snprintf(msg, len, "DIMM location: %s %s ", bank, device); |
84 | @@ -267,7 +266,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) |
85 | "DIMM location: not present. DMI handle: 0x%.4x ", |
86 | mem->mem_dev_handle); |
87 | |
88 | - msg[n] = '\0'; |
89 | return n; |
90 | } |
91 | |
92 | diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c |
93 | index 9faa09e7c31f1..c2b991b9fa9e6 100644 |
94 | --- a/drivers/firmware/efi/memattr.c |
95 | +++ b/drivers/firmware/efi/memattr.c |
96 | @@ -68,11 +68,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out) |
97 | return false; |
98 | } |
99 | |
100 | - if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) { |
101 | - pr_warn("Entry attributes invalid: RO and XP bits both cleared\n"); |
102 | - return false; |
103 | - } |
104 | - |
105 | if (PAGE_SIZE > EFI_PAGE_SIZE && |
106 | (!PAGE_ALIGNED(in->phys_addr) || |
107 | !PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) { |
108 | diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c |
109 | index 606fd875740c0..800c477dd0761 100644 |
110 | --- a/drivers/hid/i2c-hid/i2c-hid-core.c |
111 | +++ b/drivers/hid/i2c-hid/i2c-hid-core.c |
112 | @@ -1157,8 +1157,8 @@ static int i2c_hid_probe(struct i2c_client *client, |
113 | hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); |
114 | hid->product = le16_to_cpu(ihid->hdesc.wProductID); |
115 | |
116 | - snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX", |
117 | - client->name, hid->vendor, hid->product); |
118 | + snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", |
119 | + client->name, (u16)hid->vendor, (u16)hid->product); |
120 | strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys)); |
121 | |
122 | ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); |
123 | diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c |
124 | index 08174d341f4a1..bc75f1efa0f4c 100644 |
125 | --- a/drivers/hid/usbhid/hid-pidff.c |
126 | +++ b/drivers/hid/usbhid/hid-pidff.c |
127 | @@ -1304,6 +1304,7 @@ int hid_pidff_init(struct hid_device *hid) |
128 | |
129 | if (pidff->pool[PID_DEVICE_MANAGED_POOL].value && |
130 | pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) { |
131 | + error = -EPERM; |
132 | hid_notice(hid, |
133 | "device does not support device managed pool\n"); |
134 | goto fail; |
135 | diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
136 | index 148e1ff2e5e0e..77dadbe1a4464 100644 |
137 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
138 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
139 | @@ -4262,7 +4262,6 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp) |
140 | |
141 | pf->fw_fid = le16_to_cpu(resp->fid); |
142 | pf->port_id = le16_to_cpu(resp->port_id); |
143 | - bp->dev->dev_port = pf->port_id; |
144 | memcpy(pf->mac_addr, resp->mac_address, ETH_ALEN); |
145 | memcpy(bp->dev->dev_addr, pf->mac_addr, ETH_ALEN); |
146 | pf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx); |
147 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
148 | index d418542924e16..297d3f599efda 100644 |
149 | --- a/drivers/net/usb/cdc_ncm.c |
150 | +++ b/drivers/net/usb/cdc_ncm.c |
151 | @@ -1563,6 +1563,15 @@ cdc_ncm_speed_change(struct usbnet *dev, |
152 | uint32_t rx_speed = le32_to_cpu(data->DLBitRRate); |
153 | uint32_t tx_speed = le32_to_cpu(data->ULBitRate); |
154 | |
155 | + /* if the speed hasn't changed, don't report it. |
156 | + * RTL8156 shipped before 2021 sends notification about every 32ms. |
157 | + */ |
158 | + if (dev->rx_speed == rx_speed && dev->tx_speed == tx_speed) |
159 | + return; |
160 | + |
161 | + dev->rx_speed = rx_speed; |
162 | + dev->tx_speed = tx_speed; |
163 | + |
164 | /* |
165 | * Currently the USB-NET API does not support reporting the actual |
166 | * device speed. Do print it instead. |
167 | @@ -1606,7 +1615,8 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) |
168 | * USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be |
169 | * sent by device after USB_CDC_NOTIFY_SPEED_CHANGE. |
170 | */ |
171 | - usbnet_link_change(dev, !!event->wValue, 0); |
172 | + if (netif_carrier_ok(dev->net) != !!event->wValue) |
173 | + usbnet_link_change(dev, !!event->wValue, 0); |
174 | break; |
175 | |
176 | case USB_CDC_NOTIFY_SPEED_CHANGE: |
177 | diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig |
178 | index 24ee2605b9f04..0da884bfc7a80 100644 |
179 | --- a/drivers/vfio/pci/Kconfig |
180 | +++ b/drivers/vfio/pci/Kconfig |
181 | @@ -1,6 +1,7 @@ |
182 | config VFIO_PCI |
183 | tristate "VFIO support for PCI devices" |
184 | depends on VFIO && PCI && EVENTFD |
185 | + depends on MMU |
186 | select VFIO_VIRQFD |
187 | select IRQ_BYPASS_MANAGER |
188 | help |
189 | diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c |
190 | index f3c2de04b20d3..5b0f09b211bee 100644 |
191 | --- a/drivers/vfio/pci/vfio_pci_config.c |
192 | +++ b/drivers/vfio/pci/vfio_pci_config.c |
193 | @@ -1576,7 +1576,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev) |
194 | if (len == 0xFF) { |
195 | len = vfio_ext_cap_len(vdev, ecap, epos); |
196 | if (len < 0) |
197 | - return ret; |
198 | + return len; |
199 | } |
200 | } |
201 | |
202 | diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c |
203 | index d143d08c4f0fe..9b1b6c1e218dc 100644 |
204 | --- a/drivers/vfio/platform/vfio_platform_common.c |
205 | +++ b/drivers/vfio/platform/vfio_platform_common.c |
206 | @@ -288,7 +288,7 @@ err_irq: |
207 | vfio_platform_regions_cleanup(vdev); |
208 | err_reg: |
209 | mutex_unlock(&driver_lock); |
210 | - module_put(THIS_MODULE); |
211 | + module_put(vdev->parent_module); |
212 | return ret; |
213 | } |
214 | |
215 | diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c |
216 | index c99f8bb1c56c4..e6c7509a3d873 100644 |
217 | --- a/drivers/xen/xen-pciback/vpci.c |
218 | +++ b/drivers/xen/xen-pciback/vpci.c |
219 | @@ -68,7 +68,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
220 | struct pci_dev *dev, int devid, |
221 | publish_pci_dev_cb publish_cb) |
222 | { |
223 | - int err = 0, slot, func = -1; |
224 | + int err = 0, slot, func = PCI_FUNC(dev->devfn); |
225 | struct pci_dev_entry *t, *dev_entry; |
226 | struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; |
227 | |
228 | @@ -93,23 +93,26 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
229 | |
230 | /* |
231 | * Keep multi-function devices together on the virtual PCI bus, except |
232 | - * virtual functions. |
233 | + * that we want to keep virtual functions at func 0 on their own. They |
234 | + * aren't multi-function devices and hence their presence at func 0 |
235 | + * may cause guests to not scan the other functions. |
236 | */ |
237 | - if (!dev->is_virtfn) { |
238 | + if (!dev->is_virtfn || func) { |
239 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { |
240 | if (list_empty(&vpci_dev->dev_list[slot])) |
241 | continue; |
242 | |
243 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), |
244 | struct pci_dev_entry, list); |
245 | + if (t->dev->is_virtfn && !PCI_FUNC(t->dev->devfn)) |
246 | + continue; |
247 | |
248 | if (match_slot(dev, t->dev)) { |
249 | pr_info("vpci: %s: assign to virtual slot %d func %d\n", |
250 | pci_name(dev), slot, |
251 | - PCI_FUNC(dev->devfn)); |
252 | + func); |
253 | list_add_tail(&dev_entry->list, |
254 | &vpci_dev->dev_list[slot]); |
255 | - func = PCI_FUNC(dev->devfn); |
256 | goto unlock; |
257 | } |
258 | } |
259 | @@ -122,7 +125,6 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, |
260 | pci_name(dev), slot); |
261 | list_add_tail(&dev_entry->list, |
262 | &vpci_dev->dev_list[slot]); |
263 | - func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); |
264 | goto unlock; |
265 | } |
266 | } |
267 | diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c |
268 | index 4f919628137cb..374d91830a900 100644 |
269 | --- a/fs/btrfs/file-item.c |
270 | +++ b/fs/btrfs/file-item.c |
271 | @@ -608,7 +608,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
272 | u64 end_byte = bytenr + len; |
273 | u64 csum_end; |
274 | struct extent_buffer *leaf; |
275 | - int ret; |
276 | + int ret = 0; |
277 | u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy); |
278 | int blocksize_bits = root->fs_info->sb->s_blocksize_bits; |
279 | |
280 | @@ -626,6 +626,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
281 | path->leave_spinning = 1; |
282 | ret = btrfs_search_slot(trans, root, &key, path, -1, 1); |
283 | if (ret > 0) { |
284 | + ret = 0; |
285 | if (path->slots[0] == 0) |
286 | break; |
287 | path->slots[0]--; |
288 | @@ -656,7 +657,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
289 | if (key.offset >= bytenr && csum_end <= end_byte) { |
290 | ret = btrfs_del_item(trans, root, path); |
291 | if (ret) |
292 | - goto out; |
293 | + break; |
294 | if (key.offset == bytenr) |
295 | break; |
296 | } else if (key.offset < bytenr && csum_end > end_byte) { |
297 | @@ -700,8 +701,9 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
298 | ret = btrfs_split_item(trans, root, path, &key, offset); |
299 | if (ret && ret != -EAGAIN) { |
300 | btrfs_abort_transaction(trans, ret); |
301 | - goto out; |
302 | + break; |
303 | } |
304 | + ret = 0; |
305 | |
306 | key.offset = end_byte - 1; |
307 | } else { |
308 | @@ -711,8 +713,6 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, |
309 | } |
310 | btrfs_release_path(path); |
311 | } |
312 | - ret = 0; |
313 | -out: |
314 | btrfs_free_path(path); |
315 | return ret; |
316 | } |
317 | diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
318 | index 5c86fecaf167e..11ecd798864c8 100644 |
319 | --- a/fs/btrfs/tree-log.c |
320 | +++ b/fs/btrfs/tree-log.c |
321 | @@ -1529,6 +1529,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, |
322 | break; |
323 | |
324 | if (ret == 1) { |
325 | + ret = 0; |
326 | if (path->slots[0] == 0) |
327 | break; |
328 | path->slots[0]--; |
329 | @@ -1541,17 +1542,19 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, |
330 | |
331 | ret = btrfs_del_item(trans, root, path); |
332 | if (ret) |
333 | - goto out; |
334 | + break; |
335 | |
336 | btrfs_release_path(path); |
337 | inode = read_one_inode(root, key.offset); |
338 | - if (!inode) |
339 | - return -EIO; |
340 | + if (!inode) { |
341 | + ret = -EIO; |
342 | + break; |
343 | + } |
344 | |
345 | ret = fixup_inode_link_count(trans, root, inode); |
346 | iput(inode); |
347 | if (ret) |
348 | - goto out; |
349 | + break; |
350 | |
351 | /* |
352 | * fixup on a directory may create new entries, |
353 | @@ -1560,8 +1563,6 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, |
354 | */ |
355 | key.offset = (u64)-1; |
356 | } |
357 | - ret = 0; |
358 | -out: |
359 | btrfs_release_path(path); |
360 | return ret; |
361 | } |
362 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
363 | index 7f291b7be7f3a..e2f31aee67c28 100644 |
364 | --- a/fs/ext4/extents.c |
365 | +++ b/fs/ext4/extents.c |
366 | @@ -3274,7 +3274,10 @@ static int ext4_split_extent_at(handle_t *handle, |
367 | ext4_ext_mark_unwritten(ex2); |
368 | |
369 | err = ext4_ext_insert_extent(handle, inode, ppath, &newex, flags); |
370 | - if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { |
371 | + if (err != -ENOSPC && err != -EDQUOT) |
372 | + goto out; |
373 | + |
374 | + if (EXT4_EXT_MAY_ZEROOUT & split_flag) { |
375 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { |
376 | if (split_flag & EXT4_EXT_DATA_VALID1) { |
377 | err = ext4_ext_zeroout(inode, ex2); |
378 | @@ -3300,30 +3303,30 @@ static int ext4_split_extent_at(handle_t *handle, |
379 | ext4_ext_pblock(&orig_ex)); |
380 | } |
381 | |
382 | - if (err) |
383 | - goto fix_extent_len; |
384 | - /* update the extent length and mark as initialized */ |
385 | - ex->ee_len = cpu_to_le16(ee_len); |
386 | - ext4_ext_try_to_merge(handle, inode, path, ex); |
387 | - err = ext4_ext_dirty(handle, inode, path + path->p_depth); |
388 | - if (err) |
389 | - goto fix_extent_len; |
390 | - |
391 | - /* update extent status tree */ |
392 | - err = ext4_zeroout_es(inode, &zero_ex); |
393 | - |
394 | - goto out; |
395 | - } else if (err) |
396 | - goto fix_extent_len; |
397 | - |
398 | -out: |
399 | - ext4_ext_show_leaf(inode, path); |
400 | - return err; |
401 | + if (!err) { |
402 | + /* update the extent length and mark as initialized */ |
403 | + ex->ee_len = cpu_to_le16(ee_len); |
404 | + ext4_ext_try_to_merge(handle, inode, path, ex); |
405 | + err = ext4_ext_dirty(handle, inode, path + path->p_depth); |
406 | + if (!err) |
407 | + /* update extent status tree */ |
408 | + err = ext4_zeroout_es(inode, &zero_ex); |
409 | + /* If we failed at this point, we don't know in which |
410 | + * state the extent tree exactly is so don't try to fix |
411 | + * length of the original extent as it may do even more |
412 | + * damage. |
413 | + */ |
414 | + goto out; |
415 | + } |
416 | + } |
417 | |
418 | fix_extent_len: |
419 | ex->ee_len = orig_ex.ee_len; |
420 | ext4_ext_dirty(handle, inode, path + path->p_depth); |
421 | return err; |
422 | +out: |
423 | + ext4_ext_show_leaf(inode, path); |
424 | + return err; |
425 | } |
426 | |
427 | /* |
428 | diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c |
429 | index c17285df12be2..3aa4441f5ab50 100644 |
430 | --- a/fs/ocfs2/file.c |
431 | +++ b/fs/ocfs2/file.c |
432 | @@ -1838,6 +1838,45 @@ out: |
433 | return ret; |
434 | } |
435 | |
436 | +/* |
437 | + * zero out partial blocks of one cluster. |
438 | + * |
439 | + * start: file offset where zero starts, will be made upper block aligned. |
440 | + * len: it will be trimmed to the end of current cluster if "start + len" |
441 | + * is bigger than it. |
442 | + */ |
443 | +static int ocfs2_zeroout_partial_cluster(struct inode *inode, |
444 | + u64 start, u64 len) |
445 | +{ |
446 | + int ret; |
447 | + u64 start_block, end_block, nr_blocks; |
448 | + u64 p_block, offset; |
449 | + u32 cluster, p_cluster, nr_clusters; |
450 | + struct super_block *sb = inode->i_sb; |
451 | + u64 end = ocfs2_align_bytes_to_clusters(sb, start); |
452 | + |
453 | + if (start + len < end) |
454 | + end = start + len; |
455 | + |
456 | + start_block = ocfs2_blocks_for_bytes(sb, start); |
457 | + end_block = ocfs2_blocks_for_bytes(sb, end); |
458 | + nr_blocks = end_block - start_block; |
459 | + if (!nr_blocks) |
460 | + return 0; |
461 | + |
462 | + cluster = ocfs2_bytes_to_clusters(sb, start); |
463 | + ret = ocfs2_get_clusters(inode, cluster, &p_cluster, |
464 | + &nr_clusters, NULL); |
465 | + if (ret) |
466 | + return ret; |
467 | + if (!p_cluster) |
468 | + return 0; |
469 | + |
470 | + offset = start_block - ocfs2_clusters_to_blocks(sb, cluster); |
471 | + p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset; |
472 | + return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS); |
473 | +} |
474 | + |
475 | /* |
476 | * Parts of this function taken from xfs_change_file_space() |
477 | */ |
478 | @@ -1848,7 +1887,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, |
479 | { |
480 | int ret; |
481 | s64 llen; |
482 | - loff_t size; |
483 | + loff_t size, orig_isize; |
484 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
485 | struct buffer_head *di_bh = NULL; |
486 | handle_t *handle; |
487 | @@ -1879,6 +1918,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, |
488 | goto out_inode_unlock; |
489 | } |
490 | |
491 | + orig_isize = i_size_read(inode); |
492 | switch (sr->l_whence) { |
493 | case 0: /*SEEK_SET*/ |
494 | break; |
495 | @@ -1886,7 +1926,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, |
496 | sr->l_start += f_pos; |
497 | break; |
498 | case 2: /*SEEK_END*/ |
499 | - sr->l_start += i_size_read(inode); |
500 | + sr->l_start += orig_isize; |
501 | break; |
502 | default: |
503 | ret = -EINVAL; |
504 | @@ -1940,6 +1980,14 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, |
505 | default: |
506 | ret = -EINVAL; |
507 | } |
508 | + |
509 | + /* zeroout eof blocks in the cluster. */ |
510 | + if (!ret && change_size && orig_isize < size) { |
511 | + ret = ocfs2_zeroout_partial_cluster(inode, orig_isize, |
512 | + size - orig_isize); |
513 | + if (!ret) |
514 | + i_size_write(inode, size); |
515 | + } |
516 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
517 | if (ret) { |
518 | mlog_errno(ret); |
519 | @@ -1956,9 +2004,6 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, |
520 | goto out_inode_unlock; |
521 | } |
522 | |
523 | - if (change_size && i_size_read(inode) < size) |
524 | - i_size_write(inode, size); |
525 | - |
526 | inode->i_ctime = inode->i_mtime = current_time(inode); |
527 | ret = ocfs2_mark_inode_dirty(handle, inode, di_bh); |
528 | if (ret < 0) |
529 | diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h |
530 | index fde7550754df6..52f47c2944f84 100644 |
531 | --- a/include/linux/usb/usbnet.h |
532 | +++ b/include/linux/usb/usbnet.h |
533 | @@ -80,6 +80,8 @@ struct usbnet { |
534 | # define EVENT_LINK_CHANGE 11 |
535 | # define EVENT_SET_RX_MODE 12 |
536 | # define EVENT_NO_IP_ALIGN 13 |
537 | + u32 rx_speed; /* in bps - NOT Mbps */ |
538 | + u32 tx_speed; /* in bps - NOT Mbps */ |
539 | }; |
540 | |
541 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
542 | diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h |
543 | index 028b754ae9b17..0baf2e21a533f 100644 |
544 | --- a/include/net/caif/caif_dev.h |
545 | +++ b/include/net/caif/caif_dev.h |
546 | @@ -119,7 +119,7 @@ void caif_free_client(struct cflayer *adap_layer); |
547 | * The link_support layer is used to add any Link Layer specific |
548 | * framing. |
549 | */ |
550 | -void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
551 | +int caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
552 | struct cflayer *link_support, int head_room, |
553 | struct cflayer **layer, int (**rcv_func)( |
554 | struct sk_buff *, struct net_device *, |
555 | diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h |
556 | index 70bfd017581fb..219094ace893c 100644 |
557 | --- a/include/net/caif/cfcnfg.h |
558 | +++ b/include/net/caif/cfcnfg.h |
559 | @@ -62,7 +62,7 @@ void cfcnfg_remove(struct cfcnfg *cfg); |
560 | * @fcs: Specify if checksum is used in CAIF Framing Layer. |
561 | * @head_room: Head space needed by link specific protocol. |
562 | */ |
563 | -void |
564 | +int |
565 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, |
566 | struct net_device *dev, struct cflayer *phy_layer, |
567 | enum cfcnfg_phy_preference pref, |
568 | diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h |
569 | index b5b020f3c72eb..bc3fae07a25f9 100644 |
570 | --- a/include/net/caif/cfserl.h |
571 | +++ b/include/net/caif/cfserl.h |
572 | @@ -9,4 +9,5 @@ |
573 | #include <net/caif/caif_layer.h> |
574 | |
575 | struct cflayer *cfserl_create(int instance, bool use_stx); |
576 | +void cfserl_release(struct cflayer *layer); |
577 | #endif |
578 | diff --git a/init/main.c b/init/main.c |
579 | index 7ad08957dd180..9e057314a15f3 100644 |
580 | --- a/init/main.c |
581 | +++ b/init/main.c |
582 | @@ -1005,7 +1005,7 @@ static noinline void __init kernel_init_freeable(void) |
583 | */ |
584 | set_cpus_allowed_ptr(current, cpu_all_mask); |
585 | |
586 | - cad_pid = task_pid(current); |
587 | + cad_pid = get_pid(task_pid(current)); |
588 | |
589 | smp_prepare_cpus(setup_max_cpus); |
590 | |
591 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
592 | index 02f44a408edbd..839c534bdcdb9 100644 |
593 | --- a/net/bluetooth/hci_core.c |
594 | +++ b/net/bluetooth/hci_core.c |
595 | @@ -1422,8 +1422,13 @@ static int hci_dev_do_open(struct hci_dev *hdev) |
596 | } else { |
597 | /* Init failed, cleanup */ |
598 | flush_work(&hdev->tx_work); |
599 | - flush_work(&hdev->cmd_work); |
600 | + |
601 | + /* Since hci_rx_work() is possible to awake new cmd_work |
602 | + * it should be flushed first to avoid unexpected call of |
603 | + * hci_cmd_work() |
604 | + */ |
605 | flush_work(&hdev->rx_work); |
606 | + flush_work(&hdev->cmd_work); |
607 | |
608 | skb_queue_purge(&hdev->cmd_q); |
609 | skb_queue_purge(&hdev->rx_q); |
610 | diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c |
611 | index 44b3146c61175..35f5585188de7 100644 |
612 | --- a/net/bluetooth/hci_sock.c |
613 | +++ b/net/bluetooth/hci_sock.c |
614 | @@ -750,7 +750,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) |
615 | /* Detach sockets from device */ |
616 | read_lock(&hci_sk_list.lock); |
617 | sk_for_each(sk, &hci_sk_list.head) { |
618 | - bh_lock_sock_nested(sk); |
619 | + lock_sock(sk); |
620 | if (hci_pi(sk)->hdev == hdev) { |
621 | hci_pi(sk)->hdev = NULL; |
622 | sk->sk_err = EPIPE; |
623 | @@ -759,7 +759,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) |
624 | |
625 | hci_dev_put(hdev); |
626 | } |
627 | - bh_unlock_sock(sk); |
628 | + release_sock(sk); |
629 | } |
630 | read_unlock(&hci_sk_list.lock); |
631 | } |
632 | diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c |
633 | index a0443d40d677c..a28ffbbf7450c 100644 |
634 | --- a/net/caif/caif_dev.c |
635 | +++ b/net/caif/caif_dev.c |
636 | @@ -303,7 +303,7 @@ static void dev_flowctrl(struct net_device *dev, int on) |
637 | caifd_put(caifd); |
638 | } |
639 | |
640 | -void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
641 | +int caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
642 | struct cflayer *link_support, int head_room, |
643 | struct cflayer **layer, |
644 | int (**rcv_func)(struct sk_buff *, struct net_device *, |
645 | @@ -314,11 +314,12 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
646 | enum cfcnfg_phy_preference pref; |
647 | struct cfcnfg *cfg = get_cfcnfg(dev_net(dev)); |
648 | struct caif_device_entry_list *caifdevs; |
649 | + int res; |
650 | |
651 | caifdevs = caif_device_list(dev_net(dev)); |
652 | caifd = caif_device_alloc(dev); |
653 | if (!caifd) |
654 | - return; |
655 | + return -ENOMEM; |
656 | *layer = &caifd->layer; |
657 | spin_lock_init(&caifd->flow_lock); |
658 | |
659 | @@ -340,7 +341,7 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
660 | sizeof(caifd->layer.name) - 1); |
661 | caifd->layer.name[sizeof(caifd->layer.name) - 1] = 0; |
662 | caifd->layer.transmit = transmit; |
663 | - cfcnfg_add_phy_layer(cfg, |
664 | + res = cfcnfg_add_phy_layer(cfg, |
665 | dev, |
666 | &caifd->layer, |
667 | pref, |
668 | @@ -350,6 +351,7 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, |
669 | mutex_unlock(&caifdevs->lock); |
670 | if (rcv_func) |
671 | *rcv_func = receive; |
672 | + return res; |
673 | } |
674 | EXPORT_SYMBOL(caif_enroll_dev); |
675 | |
676 | @@ -364,6 +366,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, |
677 | struct cflayer *layer, *link_support; |
678 | int head_room = 0; |
679 | struct caif_device_entry_list *caifdevs; |
680 | + int res; |
681 | |
682 | cfg = get_cfcnfg(dev_net(dev)); |
683 | caifdevs = caif_device_list(dev_net(dev)); |
684 | @@ -389,8 +392,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, |
685 | break; |
686 | } |
687 | } |
688 | - caif_enroll_dev(dev, caifdev, link_support, head_room, |
689 | + res = caif_enroll_dev(dev, caifdev, link_support, head_room, |
690 | &layer, NULL); |
691 | + if (res) |
692 | + cfserl_release(link_support); |
693 | caifdev->flowctrl = dev_flowctrl; |
694 | break; |
695 | |
696 | diff --git a/net/caif/caif_usb.c b/net/caif/caif_usb.c |
697 | index 5cd44f001f647..485dde566c1a9 100644 |
698 | --- a/net/caif/caif_usb.c |
699 | +++ b/net/caif/caif_usb.c |
700 | @@ -116,6 +116,11 @@ static struct cflayer *cfusbl_create(int phyid, u8 ethaddr[ETH_ALEN], |
701 | return (struct cflayer *) this; |
702 | } |
703 | |
704 | +static void cfusbl_release(struct cflayer *layer) |
705 | +{ |
706 | + kfree(layer); |
707 | +} |
708 | + |
709 | static struct packet_type caif_usb_type __read_mostly = { |
710 | .type = cpu_to_be16(ETH_P_802_EX1), |
711 | }; |
712 | @@ -128,6 +133,7 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, |
713 | struct cflayer *layer, *link_support; |
714 | struct usbnet *usbnet; |
715 | struct usb_device *usbdev; |
716 | + int res; |
717 | |
718 | /* Check whether we have a NCM device, and find its VID/PID. */ |
719 | if (!(dev->dev.parent && dev->dev.parent->driver && |
720 | @@ -170,8 +176,11 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, |
721 | if (dev->num_tx_queues > 1) |
722 | pr_warn("USB device uses more than one tx queue\n"); |
723 | |
724 | - caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN, |
725 | + res = caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN, |
726 | &layer, &caif_usb_type.func); |
727 | + if (res) |
728 | + goto err; |
729 | + |
730 | if (!pack_added) |
731 | dev_add_pack(&caif_usb_type); |
732 | pack_added = true; |
733 | @@ -181,6 +190,9 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, |
734 | layer->name[sizeof(layer->name) - 1] = 0; |
735 | |
736 | return 0; |
737 | +err: |
738 | + cfusbl_release(link_support); |
739 | + return res; |
740 | } |
741 | |
742 | static struct notifier_block caif_device_notifier = { |
743 | diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c |
744 | index fa39fc2987086..c45b531a6cd5c 100644 |
745 | --- a/net/caif/cfcnfg.c |
746 | +++ b/net/caif/cfcnfg.c |
747 | @@ -455,7 +455,7 @@ unlock: |
748 | rcu_read_unlock(); |
749 | } |
750 | |
751 | -void |
752 | +int |
753 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, |
754 | struct net_device *dev, struct cflayer *phy_layer, |
755 | enum cfcnfg_phy_preference pref, |
756 | @@ -464,7 +464,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, |
757 | { |
758 | struct cflayer *frml; |
759 | struct cfcnfg_phyinfo *phyinfo = NULL; |
760 | - int i; |
761 | + int i, res = 0; |
762 | u8 phyid; |
763 | |
764 | mutex_lock(&cnfg->lock); |
765 | @@ -478,12 +478,15 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, |
766 | goto got_phyid; |
767 | } |
768 | pr_warn("Too many CAIF Link Layers (max 6)\n"); |
769 | + res = -EEXIST; |
770 | goto out; |
771 | |
772 | got_phyid: |
773 | phyinfo = kzalloc(sizeof(struct cfcnfg_phyinfo), GFP_ATOMIC); |
774 | - if (!phyinfo) |
775 | + if (!phyinfo) { |
776 | + res = -ENOMEM; |
777 | goto out_err; |
778 | + } |
779 | |
780 | phy_layer->id = phyid; |
781 | phyinfo->pref = pref; |
782 | @@ -497,8 +500,10 @@ got_phyid: |
783 | |
784 | frml = cffrml_create(phyid, fcs); |
785 | |
786 | - if (!frml) |
787 | + if (!frml) { |
788 | + res = -ENOMEM; |
789 | goto out_err; |
790 | + } |
791 | phyinfo->frm_layer = frml; |
792 | layer_set_up(frml, cnfg->mux); |
793 | |
794 | @@ -516,11 +521,12 @@ got_phyid: |
795 | list_add_rcu(&phyinfo->node, &cnfg->phys); |
796 | out: |
797 | mutex_unlock(&cnfg->lock); |
798 | - return; |
799 | + return res; |
800 | |
801 | out_err: |
802 | kfree(phyinfo); |
803 | mutex_unlock(&cnfg->lock); |
804 | + return res; |
805 | } |
806 | EXPORT_SYMBOL(cfcnfg_add_phy_layer); |
807 | |
808 | diff --git a/net/caif/cfserl.c b/net/caif/cfserl.c |
809 | index ce60f06d76de3..af1e1e36dc90a 100644 |
810 | --- a/net/caif/cfserl.c |
811 | +++ b/net/caif/cfserl.c |
812 | @@ -31,6 +31,11 @@ static int cfserl_transmit(struct cflayer *layr, struct cfpkt *pkt); |
813 | static void cfserl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, |
814 | int phyid); |
815 | |
816 | +void cfserl_release(struct cflayer *layer) |
817 | +{ |
818 | + kfree(layer); |
819 | +} |
820 | + |
821 | struct cflayer *cfserl_create(int instance, bool use_stx) |
822 | { |
823 | struct cfserl *this = kzalloc(sizeof(struct cfserl), GFP_ATOMIC); |
824 | diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c |
825 | index c0930b9fe848b..7531cb1665d2b 100644 |
826 | --- a/net/ieee802154/nl-mac.c |
827 | +++ b/net/ieee802154/nl-mac.c |
828 | @@ -688,8 +688,10 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info) |
829 | nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) || |
830 | nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER, |
831 | be32_to_cpu(params.frame_counter)) || |
832 | - ieee802154_llsec_fill_key_id(msg, ¶ms.out_key)) |
833 | + ieee802154_llsec_fill_key_id(msg, ¶ms.out_key)) { |
834 | + rc = -ENOBUFS; |
835 | goto out_free; |
836 | + } |
837 | |
838 | dev_put(dev); |
839 | |
840 | diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c |
841 | index 77d73014bde31..11f53dc0c1c09 100644 |
842 | --- a/net/ieee802154/nl-phy.c |
843 | +++ b/net/ieee802154/nl-phy.c |
844 | @@ -249,8 +249,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info) |
845 | } |
846 | |
847 | if (nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) || |
848 | - nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) |
849 | + nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) { |
850 | + rc = -EMSGSIZE; |
851 | goto nla_put_failure; |
852 | + } |
853 | dev_put(dev); |
854 | |
855 | wpan_phy_put(phy); |
856 | diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c |
857 | index ba9e711f7e3d6..4e08305a55c48 100644 |
858 | --- a/net/netfilter/ipvs/ip_vs_ctl.c |
859 | +++ b/net/netfilter/ipvs/ip_vs_ctl.c |
860 | @@ -1256,7 +1256,7 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, |
861 | ip_vs_addr_copy(svc->af, &svc->addr, &u->addr); |
862 | svc->port = u->port; |
863 | svc->fwmark = u->fwmark; |
864 | - svc->flags = u->flags; |
865 | + svc->flags = u->flags & ~IP_VS_SVC_F_HASHED; |
866 | svc->timeout = u->timeout * HZ; |
867 | svc->netmask = u->netmask; |
868 | svc->ipvs = ipvs; |
869 | diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c |
870 | index 8396dc8ee2474..babe42ff3eecf 100644 |
871 | --- a/net/netfilter/nfnetlink_cthelper.c |
872 | +++ b/net/netfilter/nfnetlink_cthelper.c |
873 | @@ -355,10 +355,14 @@ static int |
874 | nfnl_cthelper_update(const struct nlattr * const tb[], |
875 | struct nf_conntrack_helper *helper) |
876 | { |
877 | + u32 size; |
878 | int ret; |
879 | |
880 | - if (tb[NFCTH_PRIV_DATA_LEN]) |
881 | - return -EBUSY; |
882 | + if (tb[NFCTH_PRIV_DATA_LEN]) { |
883 | + size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN])); |
884 | + if (size != helper->data_len) |
885 | + return -EBUSY; |
886 | + } |
887 | |
888 | if (tb[NFCTH_POLICY]) { |
889 | ret = nfnl_cthelper_update_policy(helper, tb[NFCTH_POLICY]); |
890 | diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c |
891 | index 22e340a9049c8..92c6fbfd51f79 100644 |
892 | --- a/net/nfc/llcp_sock.c |
893 | +++ b/net/nfc/llcp_sock.c |
894 | @@ -121,6 +121,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) |
895 | if (!llcp_sock->service_name) { |
896 | nfc_llcp_local_put(llcp_sock->local); |
897 | llcp_sock->local = NULL; |
898 | + llcp_sock->dev = NULL; |
899 | ret = -ENOMEM; |
900 | goto put_dev; |
901 | } |
902 | @@ -130,6 +131,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) |
903 | llcp_sock->local = NULL; |
904 | kfree(llcp_sock->service_name); |
905 | llcp_sock->service_name = NULL; |
906 | + llcp_sock->dev = NULL; |
907 | ret = -EADDRINUSE; |
908 | goto put_dev; |
909 | } |
910 | diff --git a/sound/core/timer.c b/sound/core/timer.c |
911 | index f8a4b2a2f8f6b..6475b85599364 100644 |
912 | --- a/sound/core/timer.c |
913 | +++ b/sound/core/timer.c |
914 | @@ -488,9 +488,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) |
915 | return; |
916 | if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) |
917 | return; |
918 | + event += 10; /* convert to SNDRV_TIMER_EVENT_MXXX */ |
919 | list_for_each_entry(ts, &ti->slave_active_head, active_list) |
920 | if (ts->ccallback) |
921 | - ts->ccallback(ts, event + 100, &tstamp, resolution); |
922 | + ts->ccallback(ts, event, &tstamp, resolution); |
923 | } |
924 | |
925 | /* start/continue a master timer */ |