Contents of /trunk/kernel-alx/patches-5.4/0171-5.4.72-all-fixes.patch
Parent Directory | Revision Log
Revision 3637 -
(show annotations)
(download)
Mon Oct 24 12:40:44 2022 UTC (20 months ago) by niro
File size: 34982 byte(s)
Mon Oct 24 12:40:44 2022 UTC (20 months ago) by niro
File size: 34982 byte(s)
-add missing
1 | diff --git a/Makefile b/Makefile |
2 | index f342e64c8c1d1..8db75cc76ed16 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,7 +1,7 @@ |
6 | # SPDX-License-Identifier: GPL-2.0 |
7 | VERSION = 5 |
8 | PATCHLEVEL = 4 |
9 | -SUBLEVEL = 71 |
10 | +SUBLEVEL = 72 |
11 | EXTRAVERSION = |
12 | NAME = Kleptomaniac Octopus |
13 | |
14 | diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile |
15 | index 1483966dcf23b..6da67789ac221 100644 |
16 | --- a/arch/arm/boot/compressed/Makefile |
17 | +++ b/arch/arm/boot/compressed/Makefile |
18 | @@ -121,7 +121,7 @@ ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \ |
19 | asflags-y := -DZIMAGE |
20 | |
21 | # Supply kernel BSS size to the decompressor via a linker symbol. |
22 | -KBSS_SZ = $(shell echo $$(($$($(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ |
23 | +KBSS_SZ = $(shell echo $$(($$($(NM) $(obj)/../../../../vmlinux | \ |
24 | sed -n -e 's/^\([^ ]*\) [AB] __bss_start$$/-0x\1/p' \ |
25 | -e 's/^\([^ ]*\) [AB] __bss_stop$$/+0x\1/p') )) ) |
26 | LDFLAGS_vmlinux = --defsym _kernel_bss_size=$(KBSS_SZ) |
27 | @@ -165,7 +165,7 @@ $(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S |
28 | # The .data section is already discarded by the linker script so no need |
29 | # to bother about it here. |
30 | check_for_bad_syms = \ |
31 | -bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ |
32 | +bad_syms=$$($(NM) $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ |
33 | [ -z "$$bad_syms" ] || \ |
34 | ( echo "following symbols must have non local/private scope:" >&2; \ |
35 | echo "$$bad_syms" >&2; false ) |
36 | diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile |
37 | index 5d361e4e3405a..ef1ac4d127dab 100644 |
38 | --- a/drivers/acpi/Makefile |
39 | +++ b/drivers/acpi/Makefile |
40 | @@ -48,7 +48,7 @@ acpi-y += acpi_pnp.o |
41 | acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o |
42 | acpi-y += power.o |
43 | acpi-y += event.o |
44 | -acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o |
45 | +acpi-y += evged.o |
46 | acpi-y += sysfs.o |
47 | acpi-y += property.o |
48 | acpi-$(CONFIG_X86) += acpi_cmos_rtc.o |
49 | diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c |
50 | index f85356a48e7ea..ec4b5033013eb 100644 |
51 | --- a/drivers/crypto/bcm/cipher.c |
52 | +++ b/drivers/crypto/bcm/cipher.c |
53 | @@ -2937,7 +2937,6 @@ static int aead_gcm_ccm_setkey(struct crypto_aead *cipher, |
54 | |
55 | ctx->enckeylen = keylen; |
56 | ctx->authkeylen = 0; |
57 | - memcpy(ctx->enckey, key, ctx->enckeylen); |
58 | |
59 | switch (ctx->enckeylen) { |
60 | case AES_KEYSIZE_128: |
61 | @@ -2953,6 +2952,8 @@ static int aead_gcm_ccm_setkey(struct crypto_aead *cipher, |
62 | goto badkey; |
63 | } |
64 | |
65 | + memcpy(ctx->enckey, key, ctx->enckeylen); |
66 | + |
67 | flow_log(" enckeylen:%u authkeylen:%u\n", ctx->enckeylen, |
68 | ctx->authkeylen); |
69 | flow_dump(" enc: ", ctx->enckey, ctx->enckeylen); |
70 | @@ -3013,6 +3014,10 @@ static int aead_gcm_esp_setkey(struct crypto_aead *cipher, |
71 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); |
72 | |
73 | flow_log("%s\n", __func__); |
74 | + |
75 | + if (keylen < GCM_ESP_SALT_SIZE) |
76 | + return -EINVAL; |
77 | + |
78 | ctx->salt_len = GCM_ESP_SALT_SIZE; |
79 | ctx->salt_offset = GCM_ESP_SALT_OFFSET; |
80 | memcpy(ctx->salt, key + keylen - GCM_ESP_SALT_SIZE, GCM_ESP_SALT_SIZE); |
81 | @@ -3041,6 +3046,10 @@ static int rfc4543_gcm_esp_setkey(struct crypto_aead *cipher, |
82 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); |
83 | |
84 | flow_log("%s\n", __func__); |
85 | + |
86 | + if (keylen < GCM_ESP_SALT_SIZE) |
87 | + return -EINVAL; |
88 | + |
89 | ctx->salt_len = GCM_ESP_SALT_SIZE; |
90 | ctx->salt_offset = GCM_ESP_SALT_OFFSET; |
91 | memcpy(ctx->salt, key + keylen - GCM_ESP_SALT_SIZE, GCM_ESP_SALT_SIZE); |
92 | @@ -3070,6 +3079,10 @@ static int aead_ccm_esp_setkey(struct crypto_aead *cipher, |
93 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); |
94 | |
95 | flow_log("%s\n", __func__); |
96 | + |
97 | + if (keylen < CCM_ESP_SALT_SIZE) |
98 | + return -EINVAL; |
99 | + |
100 | ctx->salt_len = CCM_ESP_SALT_SIZE; |
101 | ctx->salt_offset = CCM_ESP_SALT_OFFSET; |
102 | memcpy(ctx->salt, key + keylen - CCM_ESP_SALT_SIZE, CCM_ESP_SALT_SIZE); |
103 | diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c |
104 | index b50eb55f8f57c..0d67cf5ede514 100644 |
105 | --- a/drivers/crypto/qat/qat_common/qat_algs.c |
106 | +++ b/drivers/crypto/qat/qat_common/qat_algs.c |
107 | @@ -873,6 +873,11 @@ static int qat_alg_aead_dec(struct aead_request *areq) |
108 | struct icp_qat_fw_la_bulk_req *msg; |
109 | int digst_size = crypto_aead_authsize(aead_tfm); |
110 | int ret, ctr = 0; |
111 | + u32 cipher_len; |
112 | + |
113 | + cipher_len = areq->cryptlen - digst_size; |
114 | + if (cipher_len % AES_BLOCK_SIZE != 0) |
115 | + return -EINVAL; |
116 | |
117 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); |
118 | if (unlikely(ret)) |
119 | @@ -887,7 +892,7 @@ static int qat_alg_aead_dec(struct aead_request *areq) |
120 | qat_req->req.comn_mid.src_data_addr = qat_req->buf.blp; |
121 | qat_req->req.comn_mid.dest_data_addr = qat_req->buf.bloutp; |
122 | cipher_param = (void *)&qat_req->req.serv_specif_rqpars; |
123 | - cipher_param->cipher_length = areq->cryptlen - digst_size; |
124 | + cipher_param->cipher_length = cipher_len; |
125 | cipher_param->cipher_offset = areq->assoclen; |
126 | memcpy(cipher_param->u.cipher_IV_array, areq->iv, AES_BLOCK_SIZE); |
127 | auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); |
128 | @@ -916,6 +921,9 @@ static int qat_alg_aead_enc(struct aead_request *areq) |
129 | uint8_t *iv = areq->iv; |
130 | int ret, ctr = 0; |
131 | |
132 | + if (areq->cryptlen % AES_BLOCK_SIZE != 0) |
133 | + return -EINVAL; |
134 | + |
135 | ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); |
136 | if (unlikely(ret)) |
137 | return ret; |
138 | diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c |
139 | index ee9c656d121f1..2308c0b4f5e7e 100644 |
140 | --- a/drivers/media/usb/usbtv/usbtv-core.c |
141 | +++ b/drivers/media/usb/usbtv/usbtv-core.c |
142 | @@ -113,7 +113,8 @@ static int usbtv_probe(struct usb_interface *intf, |
143 | |
144 | usbtv_audio_fail: |
145 | /* we must not free at this point */ |
146 | - usb_get_dev(usbtv->udev); |
147 | + v4l2_device_get(&usbtv->v4l2_dev); |
148 | + /* this will undo the v4l2_device_get() */ |
149 | usbtv_video_free(usbtv); |
150 | |
151 | usbtv_video_fail: |
152 | diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c |
153 | index 65dc6c51037e3..7956abcbae22b 100644 |
154 | --- a/drivers/staging/comedi/drivers/vmk80xx.c |
155 | +++ b/drivers/staging/comedi/drivers/vmk80xx.c |
156 | @@ -667,6 +667,9 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev) |
157 | if (!devpriv->ep_rx || !devpriv->ep_tx) |
158 | return -ENODEV; |
159 | |
160 | + if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx)) |
161 | + return -EINVAL; |
162 | + |
163 | return 0; |
164 | } |
165 | |
166 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
167 | index ae98fe94fe91e..01a98d071c7c7 100644 |
168 | --- a/drivers/usb/serial/ftdi_sio.c |
169 | +++ b/drivers/usb/serial/ftdi_sio.c |
170 | @@ -1037,6 +1037,11 @@ static const struct usb_device_id id_table_combined[] = { |
171 | /* U-Blox devices */ |
172 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, |
173 | { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, |
174 | + /* FreeCalypso USB adapters */ |
175 | + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_BUF_PID), |
176 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
177 | + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_UNBUF_PID), |
178 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
179 | { } /* Terminating entry */ |
180 | }; |
181 | |
182 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
183 | index b5ca17a5967a0..3d47c6d72256e 100644 |
184 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
185 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
186 | @@ -39,6 +39,13 @@ |
187 | |
188 | #define FTDI_LUMEL_PD12_PID 0x6002 |
189 | |
190 | +/* |
191 | + * Custom USB adapters made by Falconia Partners LLC |
192 | + * for FreeCalypso project, ID codes allocated to Falconia by FTDI. |
193 | + */ |
194 | +#define FTDI_FALCONIA_JTAG_BUF_PID 0x7150 |
195 | +#define FTDI_FALCONIA_JTAG_UNBUF_PID 0x7151 |
196 | + |
197 | /* Sienna Serial Interface by Secyourit GmbH */ |
198 | #define FTDI_SIENNA_PID 0x8348 |
199 | |
200 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
201 | index f7a6ac05ac57a..eb5538a44ee9d 100644 |
202 | --- a/drivers/usb/serial/option.c |
203 | +++ b/drivers/usb/serial/option.c |
204 | @@ -528,6 +528,7 @@ static void option_instat_callback(struct urb *urb); |
205 | /* Cellient products */ |
206 | #define CELLIENT_VENDOR_ID 0x2692 |
207 | #define CELLIENT_PRODUCT_MEN200 0x9005 |
208 | +#define CELLIENT_PRODUCT_MPL200 0x9025 |
209 | |
210 | /* Hyundai Petatel Inc. products */ |
211 | #define PETATEL_VENDOR_ID 0x1ff4 |
212 | @@ -1186,6 +1187,8 @@ static const struct usb_device_id option_ids[] = { |
213 | .driver_info = NCTRL(2) | RSVD(3) }, |
214 | { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1053, 0xff), /* Telit FN980 (ECM) */ |
215 | .driver_info = NCTRL(0) | RSVD(1) }, |
216 | + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */ |
217 | + .driver_info = NCTRL(2) | RSVD(3) }, |
218 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
219 | .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
220 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
221 | @@ -1982,6 +1985,8 @@ static const struct usb_device_id option_ids[] = { |
222 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, |
223 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, |
224 | { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, |
225 | + { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MPL200), |
226 | + .driver_info = RSVD(1) | RSVD(4) }, |
227 | { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) }, |
228 | { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) }, |
229 | { USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, TPLINK_PRODUCT_LTE, 0xff, 0x00, 0x00) }, /* TP-Link LTE Module */ |
230 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c |
231 | index e6d9b79d35217..e290b250f45cc 100644 |
232 | --- a/drivers/usb/serial/pl2303.c |
233 | +++ b/drivers/usb/serial/pl2303.c |
234 | @@ -94,6 +94,7 @@ static const struct usb_device_id id_table[] = { |
235 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
236 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) }, |
237 | { USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) }, |
238 | + { USB_DEVICE(HP_VENDOR_ID, HP_LD381GC_PRODUCT_ID) }, |
239 | { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, |
240 | { USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) }, |
241 | { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, |
242 | diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h |
243 | index c98db6b650a5c..a897680473a78 100644 |
244 | --- a/drivers/usb/serial/pl2303.h |
245 | +++ b/drivers/usb/serial/pl2303.h |
246 | @@ -121,6 +121,7 @@ |
247 | |
248 | /* Hewlett-Packard POS Pole Displays */ |
249 | #define HP_VENDOR_ID 0x03f0 |
250 | +#define HP_LD381GC_PRODUCT_ID 0x0183 |
251 | #define HP_LM920_PRODUCT_ID 0x026b |
252 | #define HP_TD620_PRODUCT_ID 0x0956 |
253 | #define HP_LD960_PRODUCT_ID 0x0b39 |
254 | diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c |
255 | index 55f2b834cf130..e402620b89202 100644 |
256 | --- a/drivers/xen/events/events_base.c |
257 | +++ b/drivers/xen/events/events_base.c |
258 | @@ -91,6 +91,8 @@ static bool (*pirq_needs_eoi)(unsigned irq); |
259 | /* Xen will never allocate port zero for any purpose. */ |
260 | #define VALID_EVTCHN(chn) ((chn) != 0) |
261 | |
262 | +static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY]; |
263 | + |
264 | static struct irq_chip xen_dynamic_chip; |
265 | static struct irq_chip xen_percpu_chip; |
266 | static struct irq_chip xen_pirq_chip; |
267 | @@ -155,7 +157,18 @@ int get_evtchn_to_irq(unsigned evtchn) |
268 | /* Get info for IRQ */ |
269 | struct irq_info *info_for_irq(unsigned irq) |
270 | { |
271 | - return irq_get_chip_data(irq); |
272 | + if (irq < nr_legacy_irqs()) |
273 | + return legacy_info_ptrs[irq]; |
274 | + else |
275 | + return irq_get_chip_data(irq); |
276 | +} |
277 | + |
278 | +static void set_info_for_irq(unsigned int irq, struct irq_info *info) |
279 | +{ |
280 | + if (irq < nr_legacy_irqs()) |
281 | + legacy_info_ptrs[irq] = info; |
282 | + else |
283 | + irq_set_chip_data(irq, info); |
284 | } |
285 | |
286 | /* Constructors for packed IRQ information. */ |
287 | @@ -376,7 +389,7 @@ static void xen_irq_init(unsigned irq) |
288 | info->type = IRQT_UNBOUND; |
289 | info->refcnt = -1; |
290 | |
291 | - irq_set_chip_data(irq, info); |
292 | + set_info_for_irq(irq, info); |
293 | |
294 | list_add_tail(&info->list, &xen_irq_list_head); |
295 | } |
296 | @@ -425,14 +438,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi) |
297 | |
298 | static void xen_free_irq(unsigned irq) |
299 | { |
300 | - struct irq_info *info = irq_get_chip_data(irq); |
301 | + struct irq_info *info = info_for_irq(irq); |
302 | |
303 | if (WARN_ON(!info)) |
304 | return; |
305 | |
306 | list_del(&info->list); |
307 | |
308 | - irq_set_chip_data(irq, NULL); |
309 | + set_info_for_irq(irq, NULL); |
310 | |
311 | WARN_ON(info->refcnt > 0); |
312 | |
313 | @@ -602,7 +615,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi); |
314 | static void __unbind_from_irq(unsigned int irq) |
315 | { |
316 | int evtchn = evtchn_from_irq(irq); |
317 | - struct irq_info *info = irq_get_chip_data(irq); |
318 | + struct irq_info *info = info_for_irq(irq); |
319 | |
320 | if (info->refcnt > 0) { |
321 | info->refcnt--; |
322 | @@ -1106,7 +1119,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, |
323 | |
324 | void unbind_from_irqhandler(unsigned int irq, void *dev_id) |
325 | { |
326 | - struct irq_info *info = irq_get_chip_data(irq); |
327 | + struct irq_info *info = info_for_irq(irq); |
328 | |
329 | if (WARN_ON(!info)) |
330 | return; |
331 | @@ -1140,7 +1153,7 @@ int evtchn_make_refcounted(unsigned int evtchn) |
332 | if (irq == -1) |
333 | return -ENOENT; |
334 | |
335 | - info = irq_get_chip_data(irq); |
336 | + info = info_for_irq(irq); |
337 | |
338 | if (!info) |
339 | return -ENOENT; |
340 | @@ -1168,7 +1181,7 @@ int evtchn_get(unsigned int evtchn) |
341 | if (irq == -1) |
342 | goto done; |
343 | |
344 | - info = irq_get_chip_data(irq); |
345 | + info = info_for_irq(irq); |
346 | |
347 | if (!info) |
348 | goto done; |
349 | diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c |
350 | index b167649f5f5de..ace49a999ecec 100644 |
351 | --- a/fs/btrfs/block-group.c |
352 | +++ b/fs/btrfs/block-group.c |
353 | @@ -1186,7 +1186,6 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force) |
354 | { |
355 | struct btrfs_space_info *sinfo = cache->space_info; |
356 | u64 num_bytes; |
357 | - u64 sinfo_used; |
358 | u64 min_allocable_bytes; |
359 | int ret = -ENOSPC; |
360 | |
361 | @@ -1213,20 +1212,38 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force) |
362 | |
363 | num_bytes = cache->key.offset - cache->reserved - cache->pinned - |
364 | cache->bytes_super - btrfs_block_group_used(&cache->item); |
365 | - sinfo_used = btrfs_space_info_used(sinfo, true); |
366 | |
367 | /* |
368 | - * sinfo_used + num_bytes should always <= sinfo->total_bytes. |
369 | - * |
370 | - * Here we make sure if we mark this bg RO, we still have enough |
371 | - * free space as buffer (if min_allocable_bytes is not 0). |
372 | + * Data never overcommits, even in mixed mode, so do just the straight |
373 | + * check of left over space in how much we have allocated. |
374 | */ |
375 | - if (sinfo_used + num_bytes + min_allocable_bytes <= |
376 | - sinfo->total_bytes) { |
377 | + if (force) { |
378 | + ret = 0; |
379 | + } else if (sinfo->flags & BTRFS_BLOCK_GROUP_DATA) { |
380 | + u64 sinfo_used = btrfs_space_info_used(sinfo, true); |
381 | + |
382 | + /* |
383 | + * Here we make sure if we mark this bg RO, we still have enough |
384 | + * free space as buffer. |
385 | + */ |
386 | + if (sinfo_used + num_bytes <= sinfo->total_bytes) |
387 | + ret = 0; |
388 | + } else { |
389 | + /* |
390 | + * We overcommit metadata, so we need to do the |
391 | + * btrfs_can_overcommit check here, and we need to pass in |
392 | + * BTRFS_RESERVE_NO_FLUSH to give ourselves the most amount of |
393 | + * leeway to allow us to mark this block group as read only. |
394 | + */ |
395 | + if (btrfs_can_overcommit(cache->fs_info, sinfo, num_bytes, |
396 | + BTRFS_RESERVE_NO_FLUSH)) |
397 | + ret = 0; |
398 | + } |
399 | + |
400 | + if (!ret) { |
401 | sinfo->bytes_readonly += num_bytes; |
402 | cache->ro++; |
403 | list_add_tail(&cache->ro_list, &sinfo->ro_bgs); |
404 | - ret = 0; |
405 | } |
406 | out: |
407 | spin_unlock(&cache->lock); |
408 | @@ -1235,9 +1252,6 @@ out: |
409 | btrfs_info(cache->fs_info, |
410 | "unable to make block group %llu ro", |
411 | cache->key.objectid); |
412 | - btrfs_info(cache->fs_info, |
413 | - "sinfo_used=%llu bg_num_bytes=%llu min_allocable=%llu", |
414 | - sinfo_used, num_bytes, min_allocable_bytes); |
415 | btrfs_dump_space_info(cache->fs_info, cache->space_info, 0, 0); |
416 | } |
417 | return ret; |
418 | diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c |
419 | index 6f484f0d347eb..90500b6c41fc6 100644 |
420 | --- a/fs/btrfs/space-info.c |
421 | +++ b/fs/btrfs/space-info.c |
422 | @@ -160,10 +160,9 @@ static inline u64 calc_global_rsv_need_space(struct btrfs_block_rsv *global) |
423 | return (global->size << 1); |
424 | } |
425 | |
426 | -static int can_overcommit(struct btrfs_fs_info *fs_info, |
427 | - struct btrfs_space_info *space_info, u64 bytes, |
428 | - enum btrfs_reserve_flush_enum flush, |
429 | - bool system_chunk) |
430 | +int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, |
431 | + struct btrfs_space_info *space_info, u64 bytes, |
432 | + enum btrfs_reserve_flush_enum flush) |
433 | { |
434 | u64 profile; |
435 | u64 avail; |
436 | @@ -174,7 +173,7 @@ static int can_overcommit(struct btrfs_fs_info *fs_info, |
437 | if (space_info->flags & BTRFS_BLOCK_GROUP_DATA) |
438 | return 0; |
439 | |
440 | - if (system_chunk) |
441 | + if (space_info->flags & BTRFS_BLOCK_GROUP_SYSTEM) |
442 | profile = btrfs_system_alloc_profile(fs_info); |
443 | else |
444 | profile = btrfs_metadata_alloc_profile(fs_info); |
445 | @@ -228,8 +227,8 @@ again: |
446 | |
447 | /* Check and see if our ticket can be satisified now. */ |
448 | if ((used + ticket->bytes <= space_info->total_bytes) || |
449 | - can_overcommit(fs_info, space_info, ticket->bytes, flush, |
450 | - false)) { |
451 | + btrfs_can_overcommit(fs_info, space_info, ticket->bytes, |
452 | + flush)) { |
453 | btrfs_space_info_update_bytes_may_use(fs_info, |
454 | space_info, |
455 | ticket->bytes); |
456 | @@ -634,8 +633,7 @@ static void flush_space(struct btrfs_fs_info *fs_info, |
457 | |
458 | static inline u64 |
459 | btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info, |
460 | - struct btrfs_space_info *space_info, |
461 | - bool system_chunk) |
462 | + struct btrfs_space_info *space_info) |
463 | { |
464 | struct reserve_ticket *ticket; |
465 | u64 used; |
466 | @@ -650,14 +648,14 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info, |
467 | return to_reclaim; |
468 | |
469 | to_reclaim = min_t(u64, num_online_cpus() * SZ_1M, SZ_16M); |
470 | - if (can_overcommit(fs_info, space_info, to_reclaim, |
471 | - BTRFS_RESERVE_FLUSH_ALL, system_chunk)) |
472 | + if (btrfs_can_overcommit(fs_info, space_info, to_reclaim, |
473 | + BTRFS_RESERVE_FLUSH_ALL)) |
474 | return 0; |
475 | |
476 | used = btrfs_space_info_used(space_info, true); |
477 | |
478 | - if (can_overcommit(fs_info, space_info, SZ_1M, |
479 | - BTRFS_RESERVE_FLUSH_ALL, system_chunk)) |
480 | + if (btrfs_can_overcommit(fs_info, space_info, SZ_1M, |
481 | + BTRFS_RESERVE_FLUSH_ALL)) |
482 | expected = div_factor_fine(space_info->total_bytes, 95); |
483 | else |
484 | expected = div_factor_fine(space_info->total_bytes, 90); |
485 | @@ -673,7 +671,7 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info, |
486 | |
487 | static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info, |
488 | struct btrfs_space_info *space_info, |
489 | - u64 used, bool system_chunk) |
490 | + u64 used) |
491 | { |
492 | u64 thresh = div_factor_fine(space_info->total_bytes, 98); |
493 | |
494 | @@ -681,8 +679,7 @@ static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info, |
495 | if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh) |
496 | return 0; |
497 | |
498 | - if (!btrfs_calc_reclaim_metadata_size(fs_info, space_info, |
499 | - system_chunk)) |
500 | + if (!btrfs_calc_reclaim_metadata_size(fs_info, space_info)) |
501 | return 0; |
502 | |
503 | return (used >= thresh && !btrfs_fs_closing(fs_info) && |
504 | @@ -805,8 +802,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) |
505 | space_info = btrfs_find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA); |
506 | |
507 | spin_lock(&space_info->lock); |
508 | - to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info, space_info, |
509 | - false); |
510 | + to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info, space_info); |
511 | if (!to_reclaim) { |
512 | space_info->flush = 0; |
513 | spin_unlock(&space_info->lock); |
514 | @@ -825,8 +821,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) |
515 | return; |
516 | } |
517 | to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info, |
518 | - space_info, |
519 | - false); |
520 | + space_info); |
521 | if (last_tickets_id == space_info->tickets_id) { |
522 | flush_state++; |
523 | } else { |
524 | @@ -898,8 +893,7 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info, |
525 | int flush_state; |
526 | |
527 | spin_lock(&space_info->lock); |
528 | - to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info, space_info, |
529 | - false); |
530 | + to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info, space_info); |
531 | if (!to_reclaim) { |
532 | spin_unlock(&space_info->lock); |
533 | return; |
534 | @@ -1031,8 +1025,7 @@ static int handle_reserve_ticket(struct btrfs_fs_info *fs_info, |
535 | static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, |
536 | struct btrfs_space_info *space_info, |
537 | u64 orig_bytes, |
538 | - enum btrfs_reserve_flush_enum flush, |
539 | - bool system_chunk) |
540 | + enum btrfs_reserve_flush_enum flush) |
541 | { |
542 | struct reserve_ticket ticket; |
543 | u64 used; |
544 | @@ -1054,8 +1047,7 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, |
545 | */ |
546 | if (!pending_tickets && |
547 | ((used + orig_bytes <= space_info->total_bytes) || |
548 | - can_overcommit(fs_info, space_info, orig_bytes, flush, |
549 | - system_chunk))) { |
550 | + btrfs_can_overcommit(fs_info, space_info, orig_bytes, flush))) { |
551 | btrfs_space_info_update_bytes_may_use(fs_info, space_info, |
552 | orig_bytes); |
553 | ret = 0; |
554 | @@ -1097,8 +1089,7 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, |
555 | * the async reclaim as we will panic. |
556 | */ |
557 | if (!test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags) && |
558 | - need_do_async_reclaim(fs_info, space_info, |
559 | - used, system_chunk) && |
560 | + need_do_async_reclaim(fs_info, space_info, used) && |
561 | !work_busy(&fs_info->async_reclaim_work)) { |
562 | trace_btrfs_trigger_flush(fs_info, space_info->flags, |
563 | orig_bytes, flush, "preempt"); |
564 | @@ -1135,10 +1126,9 @@ int btrfs_reserve_metadata_bytes(struct btrfs_root *root, |
565 | struct btrfs_fs_info *fs_info = root->fs_info; |
566 | struct btrfs_block_rsv *global_rsv = &fs_info->global_block_rsv; |
567 | int ret; |
568 | - bool system_chunk = (root == fs_info->chunk_root); |
569 | |
570 | ret = __reserve_metadata_bytes(fs_info, block_rsv->space_info, |
571 | - orig_bytes, flush, system_chunk); |
572 | + orig_bytes, flush); |
573 | if (ret == -ENOSPC && |
574 | unlikely(root->orphan_cleanup_state == ORPHAN_CLEANUP_STARTED)) { |
575 | if (block_rsv != global_rsv && |
576 | diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h |
577 | index 8b9a1d8fefcb7..b9cffc62cafac 100644 |
578 | --- a/fs/btrfs/space-info.h |
579 | +++ b/fs/btrfs/space-info.h |
580 | @@ -129,6 +129,9 @@ int btrfs_reserve_metadata_bytes(struct btrfs_root *root, |
581 | enum btrfs_reserve_flush_enum flush); |
582 | void btrfs_try_granting_tickets(struct btrfs_fs_info *fs_info, |
583 | struct btrfs_space_info *space_info); |
584 | +int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, |
585 | + struct btrfs_space_info *space_info, u64 bytes, |
586 | + enum btrfs_reserve_flush_enum flush); |
587 | |
588 | static inline void btrfs_space_info_free_bytes_may_use( |
589 | struct btrfs_fs_info *fs_info, |
590 | diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c |
591 | index 6419e6dacc394..70387650436cf 100644 |
592 | --- a/fs/reiserfs/inode.c |
593 | +++ b/fs/reiserfs/inode.c |
594 | @@ -1553,11 +1553,7 @@ void reiserfs_read_locked_inode(struct inode *inode, |
595 | * set version 1, version 2 could be used too, because stat data |
596 | * key is the same in both versions |
597 | */ |
598 | - key.version = KEY_FORMAT_3_5; |
599 | - key.on_disk_key.k_dir_id = dirino; |
600 | - key.on_disk_key.k_objectid = inode->i_ino; |
601 | - key.on_disk_key.k_offset = 0; |
602 | - key.on_disk_key.k_type = 0; |
603 | + _make_cpu_key(&key, KEY_FORMAT_3_5, dirino, inode->i_ino, 0, 0, 3); |
604 | |
605 | /* look for the object's stat data */ |
606 | retval = search_item(inode->i_sb, &key, &path_to_sd); |
607 | diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c |
608 | index 28b241cd69870..fe63a7c3e0da2 100644 |
609 | --- a/fs/reiserfs/xattr.c |
610 | +++ b/fs/reiserfs/xattr.c |
611 | @@ -674,6 +674,13 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer, |
612 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
613 | return -EOPNOTSUPP; |
614 | |
615 | + /* |
616 | + * priv_root needn't be initialized during mount so allow initial |
617 | + * lookups to succeed. |
618 | + */ |
619 | + if (!REISERFS_SB(inode->i_sb)->priv_root) |
620 | + return 0; |
621 | + |
622 | dentry = xattr_lookup(inode, name, XATTR_REPLACE); |
623 | if (IS_ERR(dentry)) { |
624 | err = PTR_ERR(dentry); |
625 | diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h |
626 | index b689aceb636b1..3cd232cf29c66 100644 |
627 | --- a/include/net/bluetooth/hci_core.h |
628 | +++ b/include/net/bluetooth/hci_core.h |
629 | @@ -1308,16 +1308,34 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) |
630 | conn->security_cfm_cb(conn, status); |
631 | } |
632 | |
633 | -static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status, |
634 | - __u8 encrypt) |
635 | +static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status) |
636 | { |
637 | struct hci_cb *cb; |
638 | + __u8 encrypt; |
639 | + |
640 | + if (conn->state == BT_CONFIG) { |
641 | + if (!status) |
642 | + conn->state = BT_CONNECTED; |
643 | |
644 | - if (conn->sec_level == BT_SECURITY_SDP) |
645 | - conn->sec_level = BT_SECURITY_LOW; |
646 | + hci_connect_cfm(conn, status); |
647 | + hci_conn_drop(conn); |
648 | + return; |
649 | + } |
650 | |
651 | - if (conn->pending_sec_level > conn->sec_level) |
652 | - conn->sec_level = conn->pending_sec_level; |
653 | + if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
654 | + encrypt = 0x00; |
655 | + else if (test_bit(HCI_CONN_AES_CCM, &conn->flags)) |
656 | + encrypt = 0x02; |
657 | + else |
658 | + encrypt = 0x01; |
659 | + |
660 | + if (!status) { |
661 | + if (conn->sec_level == BT_SECURITY_SDP) |
662 | + conn->sec_level = BT_SECURITY_LOW; |
663 | + |
664 | + if (conn->pending_sec_level > conn->sec_level) |
665 | + conn->sec_level = conn->pending_sec_level; |
666 | + } |
667 | |
668 | mutex_lock(&hci_cb_list_lock); |
669 | list_for_each_entry(cb, &hci_cb_list, list) { |
670 | diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h |
671 | index 093aedebdf0ca..8efc2419a815f 100644 |
672 | --- a/include/net/bluetooth/l2cap.h |
673 | +++ b/include/net/bluetooth/l2cap.h |
674 | @@ -623,6 +623,8 @@ struct l2cap_ops { |
675 | struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, |
676 | unsigned long hdr_len, |
677 | unsigned long len, int nb); |
678 | + int (*filter) (struct l2cap_chan * chan, |
679 | + struct sk_buff *skb); |
680 | }; |
681 | |
682 | struct l2cap_conn { |
683 | diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c |
684 | index 26526be579c75..da7fd7c8c2dc0 100644 |
685 | --- a/net/bluetooth/a2mp.c |
686 | +++ b/net/bluetooth/a2mp.c |
687 | @@ -226,6 +226,9 @@ static int a2mp_discover_rsp(struct amp_mgr *mgr, struct sk_buff *skb, |
688 | struct a2mp_info_req req; |
689 | |
690 | found = true; |
691 | + |
692 | + memset(&req, 0, sizeof(req)); |
693 | + |
694 | req.id = cl->id; |
695 | a2mp_send(mgr, A2MP_GETINFO_REQ, __next_ident(mgr), |
696 | sizeof(req), &req); |
697 | @@ -305,6 +308,8 @@ static int a2mp_getinfo_req(struct amp_mgr *mgr, struct sk_buff *skb, |
698 | if (!hdev || hdev->dev_type != HCI_AMP) { |
699 | struct a2mp_info_rsp rsp; |
700 | |
701 | + memset(&rsp, 0, sizeof(rsp)); |
702 | + |
703 | rsp.id = req->id; |
704 | rsp.status = A2MP_STATUS_INVALID_CTRL_ID; |
705 | |
706 | @@ -348,6 +353,8 @@ static int a2mp_getinfo_rsp(struct amp_mgr *mgr, struct sk_buff *skb, |
707 | if (!ctrl) |
708 | return -ENOMEM; |
709 | |
710 | + memset(&req, 0, sizeof(req)); |
711 | + |
712 | req.id = rsp->id; |
713 | a2mp_send(mgr, A2MP_GETAMPASSOC_REQ, __next_ident(mgr), sizeof(req), |
714 | &req); |
715 | @@ -376,6 +383,8 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb, |
716 | struct a2mp_amp_assoc_rsp rsp; |
717 | rsp.id = req->id; |
718 | |
719 | + memset(&rsp, 0, sizeof(rsp)); |
720 | + |
721 | if (tmp) { |
722 | rsp.status = A2MP_STATUS_COLLISION_OCCURED; |
723 | amp_mgr_put(tmp); |
724 | @@ -464,7 +473,6 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, |
725 | struct a2mp_cmd *hdr) |
726 | { |
727 | struct a2mp_physlink_req *req = (void *) skb->data; |
728 | - |
729 | struct a2mp_physlink_rsp rsp; |
730 | struct hci_dev *hdev; |
731 | struct hci_conn *hcon; |
732 | @@ -475,6 +483,8 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, |
733 | |
734 | BT_DBG("local_id %d, remote_id %d", req->local_id, req->remote_id); |
735 | |
736 | + memset(&rsp, 0, sizeof(rsp)); |
737 | + |
738 | rsp.local_id = req->remote_id; |
739 | rsp.remote_id = req->local_id; |
740 | |
741 | @@ -553,6 +563,8 @@ static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, |
742 | |
743 | BT_DBG("local_id %d remote_id %d", req->local_id, req->remote_id); |
744 | |
745 | + memset(&rsp, 0, sizeof(rsp)); |
746 | + |
747 | rsp.local_id = req->remote_id; |
748 | rsp.remote_id = req->local_id; |
749 | rsp.status = A2MP_STATUS_SUCCESS; |
750 | @@ -675,6 +687,8 @@ static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) |
751 | if (err) { |
752 | struct a2mp_cmd_rej rej; |
753 | |
754 | + memset(&rej, 0, sizeof(rej)); |
755 | + |
756 | rej.reason = cpu_to_le16(0); |
757 | hdr = (void *) skb->data; |
758 | |
759 | @@ -898,6 +912,8 @@ void a2mp_send_getinfo_rsp(struct hci_dev *hdev) |
760 | |
761 | BT_DBG("%s mgr %p", hdev->name, mgr); |
762 | |
763 | + memset(&rsp, 0, sizeof(rsp)); |
764 | + |
765 | rsp.id = hdev->id; |
766 | rsp.status = A2MP_STATUS_INVALID_CTRL_ID; |
767 | |
768 | @@ -995,6 +1011,8 @@ void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status) |
769 | if (!mgr) |
770 | return; |
771 | |
772 | + memset(&rsp, 0, sizeof(rsp)); |
773 | + |
774 | hs_hcon = hci_conn_hash_lookup_state(hdev, AMP_LINK, BT_CONNECT); |
775 | if (!hs_hcon) { |
776 | rsp.status = A2MP_STATUS_UNABLE_START_LINK_CREATION; |
777 | @@ -1027,6 +1045,8 @@ void a2mp_discover_amp(struct l2cap_chan *chan) |
778 | |
779 | mgr->bredr_chan = chan; |
780 | |
781 | + memset(&req, 0, sizeof(req)); |
782 | + |
783 | req.mtu = cpu_to_le16(L2CAP_A2MP_DEFAULT_MTU); |
784 | req.ext_feat = 0; |
785 | a2mp_send(mgr, A2MP_DISCOVER_REQ, 1, sizeof(req), &req); |
786 | diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
787 | index 87691404d0c6b..ee57fa20bac3e 100644 |
788 | --- a/net/bluetooth/hci_conn.c |
789 | +++ b/net/bluetooth/hci_conn.c |
790 | @@ -1285,6 +1285,23 @@ int hci_conn_check_link_mode(struct hci_conn *conn) |
791 | return 0; |
792 | } |
793 | |
794 | + /* AES encryption is required for Level 4: |
795 | + * |
796 | + * BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 3, Part C |
797 | + * page 1319: |
798 | + * |
799 | + * 128-bit equivalent strength for link and encryption keys |
800 | + * required using FIPS approved algorithms (E0 not allowed, |
801 | + * SAFER+ not allowed, and P-192 not allowed; encryption key |
802 | + * not shortened) |
803 | + */ |
804 | + if (conn->sec_level == BT_SECURITY_FIPS && |
805 | + !test_bit(HCI_CONN_AES_CCM, &conn->flags)) { |
806 | + bt_dev_err(conn->hdev, |
807 | + "Invalid security: Missing AES-CCM usage"); |
808 | + return 0; |
809 | + } |
810 | + |
811 | if (hci_conn_ssp_enabled(conn) && |
812 | !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
813 | return 0; |
814 | diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
815 | index fd436e5d7b542..9917b399ddd0d 100644 |
816 | --- a/net/bluetooth/hci_event.c |
817 | +++ b/net/bluetooth/hci_event.c |
818 | @@ -2840,7 +2840,7 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
819 | &cp); |
820 | } else { |
821 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
822 | - hci_encrypt_cfm(conn, ev->status, 0x00); |
823 | + hci_encrypt_cfm(conn, ev->status); |
824 | } |
825 | } |
826 | |
827 | @@ -2925,22 +2925,7 @@ static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status, |
828 | conn->enc_key_size = rp->key_size; |
829 | } |
830 | |
831 | - if (conn->state == BT_CONFIG) { |
832 | - conn->state = BT_CONNECTED; |
833 | - hci_connect_cfm(conn, 0); |
834 | - hci_conn_drop(conn); |
835 | - } else { |
836 | - u8 encrypt; |
837 | - |
838 | - if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
839 | - encrypt = 0x00; |
840 | - else if (test_bit(HCI_CONN_AES_CCM, &conn->flags)) |
841 | - encrypt = 0x02; |
842 | - else |
843 | - encrypt = 0x01; |
844 | - |
845 | - hci_encrypt_cfm(conn, 0, encrypt); |
846 | - } |
847 | + hci_encrypt_cfm(conn, 0); |
848 | |
849 | unlock: |
850 | hci_dev_unlock(hdev); |
851 | @@ -2989,27 +2974,23 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) |
852 | |
853 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
854 | |
855 | + /* Check link security requirements are met */ |
856 | + if (!hci_conn_check_link_mode(conn)) |
857 | + ev->status = HCI_ERROR_AUTH_FAILURE; |
858 | + |
859 | if (ev->status && conn->state == BT_CONNECTED) { |
860 | if (ev->status == HCI_ERROR_PIN_OR_KEY_MISSING) |
861 | set_bit(HCI_CONN_AUTH_FAILURE, &conn->flags); |
862 | |
863 | + /* Notify upper layers so they can cleanup before |
864 | + * disconnecting. |
865 | + */ |
866 | + hci_encrypt_cfm(conn, ev->status); |
867 | hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); |
868 | hci_conn_drop(conn); |
869 | goto unlock; |
870 | } |
871 | |
872 | - /* In Secure Connections Only mode, do not allow any connections |
873 | - * that are not encrypted with AES-CCM using a P-256 authenticated |
874 | - * combination key. |
875 | - */ |
876 | - if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && |
877 | - (!test_bit(HCI_CONN_AES_CCM, &conn->flags) || |
878 | - conn->key_type != HCI_LK_AUTH_COMBINATION_P256)) { |
879 | - hci_connect_cfm(conn, HCI_ERROR_AUTH_FAILURE); |
880 | - hci_conn_drop(conn); |
881 | - goto unlock; |
882 | - } |
883 | - |
884 | /* Try reading the encryption key size for encrypted ACL links */ |
885 | if (!ev->status && ev->encrypt && conn->type == ACL_LINK) { |
886 | struct hci_cp_read_enc_key_size cp; |
887 | @@ -3058,14 +3039,7 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) |
888 | } |
889 | |
890 | notify: |
891 | - if (conn->state == BT_CONFIG) { |
892 | - if (!ev->status) |
893 | - conn->state = BT_CONNECTED; |
894 | - |
895 | - hci_connect_cfm(conn, ev->status); |
896 | - hci_conn_drop(conn); |
897 | - } else |
898 | - hci_encrypt_cfm(conn, ev->status, ev->encrypt); |
899 | + hci_encrypt_cfm(conn, ev->status); |
900 | |
901 | unlock: |
902 | hci_dev_unlock(hdev); |
903 | diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
904 | index 12a50e5a9f452..3499bace25eca 100644 |
905 | --- a/net/bluetooth/l2cap_core.c |
906 | +++ b/net/bluetooth/l2cap_core.c |
907 | @@ -6701,9 +6701,10 @@ static int l2cap_data_rcv(struct l2cap_chan *chan, struct sk_buff *skb) |
908 | goto drop; |
909 | } |
910 | |
911 | - if ((chan->mode == L2CAP_MODE_ERTM || |
912 | - chan->mode == L2CAP_MODE_STREAMING) && sk_filter(chan->data, skb)) |
913 | - goto drop; |
914 | + if (chan->ops->filter) { |
915 | + if (chan->ops->filter(chan, skb)) |
916 | + goto drop; |
917 | + } |
918 | |
919 | if (!control->sframe) { |
920 | int err; |
921 | diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c |
922 | index 390a9afab6473..40e96a610e2b4 100644 |
923 | --- a/net/bluetooth/l2cap_sock.c |
924 | +++ b/net/bluetooth/l2cap_sock.c |
925 | @@ -1479,6 +1479,19 @@ static void l2cap_sock_suspend_cb(struct l2cap_chan *chan) |
926 | sk->sk_state_change(sk); |
927 | } |
928 | |
929 | +static int l2cap_sock_filter(struct l2cap_chan *chan, struct sk_buff *skb) |
930 | +{ |
931 | + struct sock *sk = chan->data; |
932 | + |
933 | + switch (chan->mode) { |
934 | + case L2CAP_MODE_ERTM: |
935 | + case L2CAP_MODE_STREAMING: |
936 | + return sk_filter(sk, skb); |
937 | + } |
938 | + |
939 | + return 0; |
940 | +} |
941 | + |
942 | static const struct l2cap_ops l2cap_chan_ops = { |
943 | .name = "L2CAP Socket Interface", |
944 | .new_connection = l2cap_sock_new_connection_cb, |
945 | @@ -1493,6 +1506,7 @@ static const struct l2cap_ops l2cap_chan_ops = { |
946 | .set_shutdown = l2cap_sock_set_shutdown_cb, |
947 | .get_sndtimeo = l2cap_sock_get_sndtimeo_cb, |
948 | .alloc_skb = l2cap_sock_alloc_skb_cb, |
949 | + .filter = l2cap_sock_filter, |
950 | }; |
951 | |
952 | static void l2cap_sock_destruct(struct sock *sk) |
953 | diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c |
954 | index acb7c6d5643fe..5fce559a61bf5 100644 |
955 | --- a/net/bluetooth/mgmt.c |
956 | +++ b/net/bluetooth/mgmt.c |
957 | @@ -756,7 +756,8 @@ static u32 get_supported_settings(struct hci_dev *hdev) |
958 | |
959 | if (lmp_ssp_capable(hdev)) { |
960 | settings |= MGMT_SETTING_SSP; |
961 | - settings |= MGMT_SETTING_HS; |
962 | + if (IS_ENABLED(CONFIG_BT_HS)) |
963 | + settings |= MGMT_SETTING_HS; |
964 | } |
965 | |
966 | if (lmp_sc_capable(hdev)) |
967 | @@ -1771,6 +1772,10 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) |
968 | |
969 | BT_DBG("request for %s", hdev->name); |
970 | |
971 | + if (!IS_ENABLED(CONFIG_BT_HS)) |
972 | + return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, |
973 | + MGMT_STATUS_NOT_SUPPORTED); |
974 | + |
975 | status = mgmt_bredr_support(hdev); |
976 | if (status) |
977 | return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, status); |
978 | diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c |
979 | index 451eee24165ee..f5a9cb4088080 100644 |
980 | --- a/tools/perf/util/cs-etm.c |
981 | +++ b/tools/perf/util/cs-etm.c |
982 | @@ -94,6 +94,9 @@ struct cs_etm_queue { |
983 | struct cs_etm_traceid_queue **traceid_queues; |
984 | }; |
985 | |
986 | +/* RB tree for quick conversion between traceID and metadata pointers */ |
987 | +static struct intlist *traceid_list; |
988 | + |
989 | static int cs_etm__update_queues(struct cs_etm_auxtrace *etm); |
990 | static int cs_etm__process_queues(struct cs_etm_auxtrace *etm); |
991 | static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, |
992 | diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h |
993 | index 650ecc2a63492..4ad925d6d7996 100644 |
994 | --- a/tools/perf/util/cs-etm.h |
995 | +++ b/tools/perf/util/cs-etm.h |
996 | @@ -114,9 +114,6 @@ enum cs_etm_isa { |
997 | CS_ETM_ISA_T32, |
998 | }; |
999 | |
1000 | -/* RB tree for quick conversion between traceID and metadata pointers */ |
1001 | -struct intlist *traceid_list; |
1002 | - |
1003 | struct cs_etm_queue; |
1004 | |
1005 | struct cs_etm_packet { |