Contents of /trunk/kernel-alx-legacy/patches-4.9/0347-4.9.248-all-fixes.patch
Parent Directory | Revision Log
Revision 3649 -
(show annotations)
(download)
Mon Oct 24 14:07:29 2022 UTC (19 months, 3 weeks ago) by niro
File size: 57068 byte(s)
Mon Oct 24 14:07:29 2022 UTC (19 months, 3 weeks ago) by niro
File size: 57068 byte(s)
-linux-4.9.248
1 | diff --git a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt |
2 | index 5b6cd9b3f628a..0188bbd2e35f8 100644 |
3 | --- a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt |
4 | +++ b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt |
5 | @@ -27,7 +27,7 @@ Example (for ARM-based BeagleBone with NPC100 NFC controller on I2C2): |
6 | clock-frequency = <100000>; |
7 | |
8 | interrupt-parent = <&gpio1>; |
9 | - interrupts = <29 GPIO_ACTIVE_HIGH>; |
10 | + interrupts = <29 IRQ_TYPE_LEVEL_HIGH>; |
11 | |
12 | enable-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; |
13 | firmware-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; |
14 | diff --git a/Documentation/devicetree/bindings/net/nfc/pn544.txt b/Documentation/devicetree/bindings/net/nfc/pn544.txt |
15 | index dab69f36167c7..8541e8dafd55c 100644 |
16 | --- a/Documentation/devicetree/bindings/net/nfc/pn544.txt |
17 | +++ b/Documentation/devicetree/bindings/net/nfc/pn544.txt |
18 | @@ -27,7 +27,7 @@ Example (for ARM-based BeagleBone with PN544 on I2C2): |
19 | clock-frequency = <400000>; |
20 | |
21 | interrupt-parent = <&gpio1>; |
22 | - interrupts = <17 GPIO_ACTIVE_HIGH>; |
23 | + interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; |
24 | |
25 | enable-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>; |
26 | firmware-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; |
27 | diff --git a/Makefile b/Makefile |
28 | index 82f71f9460cb6..f6680569c0008 100644 |
29 | --- a/Makefile |
30 | +++ b/Makefile |
31 | @@ -1,6 +1,6 @@ |
32 | VERSION = 4 |
33 | PATCHLEVEL = 9 |
34 | -SUBLEVEL = 247 |
35 | +SUBLEVEL = 248 |
36 | EXTRAVERSION = |
37 | NAME = Roaring Lionus |
38 | |
39 | diff --git a/arch/x86/include/asm/insn.h b/arch/x86/include/asm/insn.h |
40 | index c2c01f84df75f..3e0e18d376d2c 100644 |
41 | --- a/arch/x86/include/asm/insn.h |
42 | +++ b/arch/x86/include/asm/insn.h |
43 | @@ -208,6 +208,21 @@ static inline int insn_offset_immediate(struct insn *insn) |
44 | return insn_offset_displacement(insn) + insn->displacement.nbytes; |
45 | } |
46 | |
47 | +/** |
48 | + * for_each_insn_prefix() -- Iterate prefixes in the instruction |
49 | + * @insn: Pointer to struct insn. |
50 | + * @idx: Index storage. |
51 | + * @prefix: Prefix byte. |
52 | + * |
53 | + * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix |
54 | + * and the index is stored in @idx (note that this @idx is just for a cursor, |
55 | + * do not change it.) |
56 | + * Since prefixes.nbytes can be bigger than 4 if some prefixes |
57 | + * are repeated, it cannot be used for looping over the prefixes. |
58 | + */ |
59 | +#define for_each_insn_prefix(insn, idx, prefix) \ |
60 | + for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++) |
61 | + |
62 | #define POP_SS_OPCODE 0x1f |
63 | #define MOV_SREG_OPCODE 0x8e |
64 | |
65 | diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c |
66 | index 73391c1bd2a9a..52bb7413f3524 100644 |
67 | --- a/arch/x86/kernel/uprobes.c |
68 | +++ b/arch/x86/kernel/uprobes.c |
69 | @@ -268,10 +268,11 @@ static volatile u32 good_2byte_insns[256 / 32] = { |
70 | |
71 | static bool is_prefix_bad(struct insn *insn) |
72 | { |
73 | + insn_byte_t p; |
74 | int i; |
75 | |
76 | - for (i = 0; i < insn->prefixes.nbytes; i++) { |
77 | - switch (insn->prefixes.bytes[i]) { |
78 | + for_each_insn_prefix(insn, i, p) { |
79 | + switch (p) { |
80 | case 0x26: /* INAT_PFX_ES */ |
81 | case 0x2E: /* INAT_PFX_CS */ |
82 | case 0x36: /* INAT_PFX_DS */ |
83 | @@ -711,6 +712,7 @@ static const struct uprobe_xol_ops branch_xol_ops = { |
84 | static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) |
85 | { |
86 | u8 opc1 = OPCODE1(insn); |
87 | + insn_byte_t p; |
88 | int i; |
89 | |
90 | switch (opc1) { |
91 | @@ -741,8 +743,8 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) |
92 | * Intel and AMD behavior differ in 64-bit mode: Intel ignores 66 prefix. |
93 | * No one uses these insns, reject any branch insns with such prefix. |
94 | */ |
95 | - for (i = 0; i < insn->prefixes.nbytes; i++) { |
96 | - if (insn->prefixes.bytes[i] == 0x66) |
97 | + for_each_insn_prefix(insn, i, p) { |
98 | + if (p == 0x66) |
99 | return -ENOTSUPP; |
100 | } |
101 | |
102 | diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c |
103 | index 5a148b515f3df..b91ad668202e7 100644 |
104 | --- a/drivers/i2c/busses/i2c-imx.c |
105 | +++ b/drivers/i2c/busses/i2c-imx.c |
106 | @@ -413,6 +413,19 @@ static void i2c_imx_dma_free(struct imx_i2c_struct *i2c_imx) |
107 | dma->chan_using = NULL; |
108 | } |
109 | |
110 | +static void i2c_imx_clear_irq(struct imx_i2c_struct *i2c_imx, unsigned int bits) |
111 | +{ |
112 | + unsigned int temp; |
113 | + |
114 | + /* |
115 | + * i2sr_clr_opcode is the value to clear all interrupts. Here we want to |
116 | + * clear only <bits>, so we write ~i2sr_clr_opcode with just <bits> |
117 | + * toggled. This is required because i.MX needs W0C and Vybrid uses W1C. |
118 | + */ |
119 | + temp = ~i2c_imx->hwdata->i2sr_clr_opcode ^ bits; |
120 | + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); |
121 | +} |
122 | + |
123 | static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) |
124 | { |
125 | unsigned long orig_jiffies = jiffies; |
126 | @@ -425,8 +438,7 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) |
127 | |
128 | /* check for arbitration lost */ |
129 | if (temp & I2SR_IAL) { |
130 | - temp &= ~I2SR_IAL; |
131 | - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); |
132 | + i2c_imx_clear_irq(i2c_imx, I2SR_IAL); |
133 | return -EAGAIN; |
134 | } |
135 | |
136 | @@ -453,6 +465,16 @@ static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) |
137 | dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); |
138 | return -ETIMEDOUT; |
139 | } |
140 | + |
141 | + /* check for arbitration lost */ |
142 | + if (i2c_imx->i2csr & I2SR_IAL) { |
143 | + dev_dbg(&i2c_imx->adapter.dev, "<%s> Arbitration lost\n", __func__); |
144 | + i2c_imx_clear_irq(i2c_imx, I2SR_IAL); |
145 | + |
146 | + i2c_imx->i2csr = 0; |
147 | + return -EAGAIN; |
148 | + } |
149 | + |
150 | dev_dbg(&i2c_imx->adapter.dev, "<%s> TRX complete\n", __func__); |
151 | i2c_imx->i2csr = 0; |
152 | return 0; |
153 | @@ -595,9 +617,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) |
154 | if (temp & I2SR_IIF) { |
155 | /* save status register */ |
156 | i2c_imx->i2csr = temp; |
157 | - temp &= ~I2SR_IIF; |
158 | - temp |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IIF); |
159 | - imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); |
160 | + i2c_imx_clear_irq(i2c_imx, I2SR_IIF); |
161 | wake_up(&i2c_imx->queue); |
162 | return IRQ_HANDLED; |
163 | } |
164 | diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c |
165 | index 7524e17ac966e..00366cf896171 100644 |
166 | --- a/drivers/i2c/busses/i2c-qup.c |
167 | +++ b/drivers/i2c/busses/i2c-qup.c |
168 | @@ -810,7 +810,8 @@ static int qup_i2c_bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, |
169 | if (ret || qup->bus_err || qup->qup_err) { |
170 | reinit_completion(&qup->xfer); |
171 | |
172 | - if (qup_i2c_change_state(qup, QUP_RUN_STATE)) { |
173 | + ret = qup_i2c_change_state(qup, QUP_RUN_STATE); |
174 | + if (ret) { |
175 | dev_err(qup->dev, "change to run state timed out"); |
176 | goto desc_err; |
177 | } |
178 | diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c |
179 | index ac2f3cd9478c9..aafe9989b33dc 100644 |
180 | --- a/drivers/infiniband/hw/i40iw/i40iw_main.c |
181 | +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c |
182 | @@ -54,10 +54,6 @@ |
183 | #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ |
184 | __stringify(DRV_VERSION_MINOR) "." __stringify(DRV_VERSION_BUILD) |
185 | |
186 | -static int push_mode; |
187 | -module_param(push_mode, int, 0644); |
188 | -MODULE_PARM_DESC(push_mode, "Low latency mode: 0=disabled (default), 1=enabled)"); |
189 | - |
190 | static int debug; |
191 | module_param(debug, int, 0644); |
192 | MODULE_PARM_DESC(debug, "debug flags: 0=disabled (default), 0x7fffffff=all"); |
193 | @@ -1524,7 +1520,6 @@ static enum i40iw_status_code i40iw_setup_init_state(struct i40iw_handler *hdl, |
194 | if (status) |
195 | goto exit; |
196 | iwdev->obj_next = iwdev->obj_mem; |
197 | - iwdev->push_mode = push_mode; |
198 | |
199 | init_waitqueue_head(&iwdev->vchnl_waitq); |
200 | init_waitqueue_head(&dev->vf_reqs); |
201 | diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
202 | index c3d2400e36b94..ece83aff2a2d3 100644 |
203 | --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
204 | +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c |
205 | @@ -208,38 +208,16 @@ static int i40iw_dealloc_ucontext(struct ib_ucontext *context) |
206 | */ |
207 | static int i40iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) |
208 | { |
209 | - struct i40iw_ucontext *ucontext; |
210 | - u64 db_addr_offset; |
211 | - u64 push_offset; |
212 | - |
213 | - ucontext = to_ucontext(context); |
214 | - if (ucontext->iwdev->sc_dev.is_pf) { |
215 | - db_addr_offset = I40IW_DB_ADDR_OFFSET; |
216 | - push_offset = I40IW_PUSH_OFFSET; |
217 | - if (vma->vm_pgoff) |
218 | - vma->vm_pgoff += I40IW_PF_FIRST_PUSH_PAGE_INDEX - 1; |
219 | - } else { |
220 | - db_addr_offset = I40IW_VF_DB_ADDR_OFFSET; |
221 | - push_offset = I40IW_VF_PUSH_OFFSET; |
222 | - if (vma->vm_pgoff) |
223 | - vma->vm_pgoff += I40IW_VF_FIRST_PUSH_PAGE_INDEX - 1; |
224 | - } |
225 | + struct i40iw_ucontext *ucontext = to_ucontext(context); |
226 | + u64 dbaddr; |
227 | |
228 | - vma->vm_pgoff += db_addr_offset >> PAGE_SHIFT; |
229 | + if (vma->vm_pgoff || vma->vm_end - vma->vm_start != PAGE_SIZE) |
230 | + return -EINVAL; |
231 | |
232 | - if (vma->vm_pgoff == (db_addr_offset >> PAGE_SHIFT)) { |
233 | - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
234 | - vma->vm_private_data = ucontext; |
235 | - } else { |
236 | - if ((vma->vm_pgoff - (push_offset >> PAGE_SHIFT)) % 2) |
237 | - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
238 | - else |
239 | - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); |
240 | - } |
241 | + dbaddr = I40IW_DB_ADDR_OFFSET + pci_resource_start(ucontext->iwdev->ldev->pcidev, 0); |
242 | |
243 | - if (io_remap_pfn_range(vma, vma->vm_start, |
244 | - vma->vm_pgoff + (pci_resource_start(ucontext->iwdev->ldev->pcidev, 0) >> PAGE_SHIFT), |
245 | - PAGE_SIZE, vma->vm_page_prot)) |
246 | + if (io_remap_pfn_range(vma, vma->vm_start, dbaddr >> PAGE_SHIFT, PAGE_SIZE, |
247 | + pgprot_noncached(vma->vm_page_prot))) |
248 | return -EAGAIN; |
249 | |
250 | return 0; |
251 | diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c |
252 | index 54a6691d7d878..637f1347cd13d 100644 |
253 | --- a/drivers/input/joystick/xpad.c |
254 | +++ b/drivers/input/joystick/xpad.c |
255 | @@ -258,6 +258,7 @@ static const struct xpad_device { |
256 | { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, |
257 | { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, |
258 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, |
259 | + { 0x1209, 0x2882, "Ardwiino Controller", 0, XTYPE_XBOX360 }, |
260 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
261 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, |
262 | { 0x12ab, 0x0303, "Mortal Kombat Klassic FightStick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
263 | @@ -435,6 +436,7 @@ static const struct usb_device_id xpad_table[] = { |
264 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ |
265 | XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ |
266 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ |
267 | + XPAD_XBOX360_VENDOR(0x1209), /* Ardwiino Controllers */ |
268 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
269 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
270 | XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ |
271 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
272 | index 82ff44637ed78..1f45010a5b814 100644 |
273 | --- a/drivers/input/serio/i8042-x86ia64io.h |
274 | +++ b/drivers/input/serio/i8042-x86ia64io.h |
275 | @@ -223,6 +223,10 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { |
276 | DMI_MATCH(DMI_SYS_VENDOR, "PEGATRON CORPORATION"), |
277 | DMI_MATCH(DMI_PRODUCT_NAME, "C15B"), |
278 | }, |
279 | + .matches = { |
280 | + DMI_MATCH(DMI_SYS_VENDOR, "ByteSpeed LLC"), |
281 | + DMI_MATCH(DMI_PRODUCT_NAME, "ByteSpeed Laptop C15B"), |
282 | + }, |
283 | }, |
284 | { } |
285 | }; |
286 | diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c |
287 | index 6b648339733fa..37f84ba11f05e 100644 |
288 | --- a/drivers/input/serio/i8042.c |
289 | +++ b/drivers/input/serio/i8042.c |
290 | @@ -1456,7 +1456,8 @@ static int __init i8042_setup_aux(void) |
291 | if (error) |
292 | goto err_free_ports; |
293 | |
294 | - if (aux_enable()) |
295 | + error = aux_enable(); |
296 | + if (error) |
297 | goto err_free_irq; |
298 | |
299 | i8042_aux_irq_registered = true; |
300 | diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
301 | index bb0448c91f672..f4a15d9f2bbb2 100644 |
302 | --- a/drivers/iommu/amd_iommu.c |
303 | +++ b/drivers/iommu/amd_iommu.c |
304 | @@ -3661,7 +3661,7 @@ static struct irq_chip amd_ir_chip; |
305 | |
306 | #define DTE_IRQ_PHYS_ADDR_MASK (((1ULL << 45)-1) << 6) |
307 | #define DTE_IRQ_REMAP_INTCTL (2ULL << 60) |
308 | -#define DTE_IRQ_TABLE_LEN (8ULL << 1) |
309 | +#define DTE_IRQ_TABLE_LEN (9ULL << 1) |
310 | #define DTE_IRQ_REMAP_ENABLE 1ULL |
311 | |
312 | static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table) |
313 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
314 | index 240d7850c8252..16437aa35bc4c 100644 |
315 | --- a/drivers/net/bonding/bond_main.c |
316 | +++ b/drivers/net/bonding/bond_main.c |
317 | @@ -1238,7 +1238,39 @@ static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave) |
318 | rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL); |
319 | } |
320 | |
321 | -static struct slave *bond_alloc_slave(struct bonding *bond) |
322 | +static void slave_kobj_release(struct kobject *kobj) |
323 | +{ |
324 | + struct slave *slave = to_slave(kobj); |
325 | + struct bonding *bond = bond_get_bond_by_slave(slave); |
326 | + |
327 | + cancel_delayed_work_sync(&slave->notify_work); |
328 | + if (BOND_MODE(bond) == BOND_MODE_8023AD) |
329 | + kfree(SLAVE_AD_INFO(slave)); |
330 | + |
331 | + kfree(slave); |
332 | +} |
333 | + |
334 | +static struct kobj_type slave_ktype = { |
335 | + .release = slave_kobj_release, |
336 | +#ifdef CONFIG_SYSFS |
337 | + .sysfs_ops = &slave_sysfs_ops, |
338 | +#endif |
339 | +}; |
340 | + |
341 | +static int bond_kobj_init(struct slave *slave) |
342 | +{ |
343 | + int err; |
344 | + |
345 | + err = kobject_init_and_add(&slave->kobj, &slave_ktype, |
346 | + &(slave->dev->dev.kobj), "bonding_slave"); |
347 | + if (err) |
348 | + kobject_put(&slave->kobj); |
349 | + |
350 | + return err; |
351 | +} |
352 | + |
353 | +static struct slave *bond_alloc_slave(struct bonding *bond, |
354 | + struct net_device *slave_dev) |
355 | { |
356 | struct slave *slave = NULL; |
357 | |
358 | @@ -1246,11 +1278,17 @@ static struct slave *bond_alloc_slave(struct bonding *bond) |
359 | if (!slave) |
360 | return NULL; |
361 | |
362 | + slave->bond = bond; |
363 | + slave->dev = slave_dev; |
364 | + |
365 | + if (bond_kobj_init(slave)) |
366 | + return NULL; |
367 | + |
368 | if (BOND_MODE(bond) == BOND_MODE_8023AD) { |
369 | SLAVE_AD_INFO(slave) = kzalloc(sizeof(struct ad_slave_info), |
370 | GFP_KERNEL); |
371 | if (!SLAVE_AD_INFO(slave)) { |
372 | - kfree(slave); |
373 | + kobject_put(&slave->kobj); |
374 | return NULL; |
375 | } |
376 | } |
377 | @@ -1259,17 +1297,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond) |
378 | return slave; |
379 | } |
380 | |
381 | -static void bond_free_slave(struct slave *slave) |
382 | -{ |
383 | - struct bonding *bond = bond_get_bond_by_slave(slave); |
384 | - |
385 | - cancel_delayed_work_sync(&slave->notify_work); |
386 | - if (BOND_MODE(bond) == BOND_MODE_8023AD) |
387 | - kfree(SLAVE_AD_INFO(slave)); |
388 | - |
389 | - kfree(slave); |
390 | -} |
391 | - |
392 | static void bond_fill_ifbond(struct bonding *bond, struct ifbond *info) |
393 | { |
394 | info->bond_mode = BOND_MODE(bond); |
395 | @@ -1449,14 +1476,12 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) |
396 | bond->dev->addr_assign_type == NET_ADDR_RANDOM) |
397 | bond_set_dev_addr(bond->dev, slave_dev); |
398 | |
399 | - new_slave = bond_alloc_slave(bond); |
400 | + new_slave = bond_alloc_slave(bond, slave_dev); |
401 | if (!new_slave) { |
402 | res = -ENOMEM; |
403 | goto err_undo_flags; |
404 | } |
405 | |
406 | - new_slave->bond = bond; |
407 | - new_slave->dev = slave_dev; |
408 | /* Set the new_slave's queue_id to be zero. Queue ID mapping |
409 | * is set via sysfs or module option if desired. |
410 | */ |
411 | @@ -1781,7 +1806,7 @@ err_restore_mtu: |
412 | dev_set_mtu(slave_dev, new_slave->original_mtu); |
413 | |
414 | err_free: |
415 | - bond_free_slave(new_slave); |
416 | + kobject_put(&new_slave->kobj); |
417 | |
418 | err_undo_flags: |
419 | /* Enslave of first slave has failed and we need to fix master's mac */ |
420 | @@ -1965,7 +1990,7 @@ static int __bond_release_one(struct net_device *bond_dev, |
421 | if (!netif_is_bond_master(slave_dev)) |
422 | slave_dev->priv_flags &= ~IFF_BONDING; |
423 | |
424 | - bond_free_slave(slave); |
425 | + kobject_put(&slave->kobj); |
426 | |
427 | return 0; |
428 | } |
429 | diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c |
430 | index 3f756fa2f603b..68bbac4715c35 100644 |
431 | --- a/drivers/net/bonding/bond_sysfs_slave.c |
432 | +++ b/drivers/net/bonding/bond_sysfs_slave.c |
433 | @@ -125,7 +125,6 @@ static const struct slave_attribute *slave_attrs[] = { |
434 | }; |
435 | |
436 | #define to_slave_attr(_at) container_of(_at, struct slave_attribute, attr) |
437 | -#define to_slave(obj) container_of(obj, struct slave, kobj) |
438 | |
439 | static ssize_t slave_show(struct kobject *kobj, |
440 | struct attribute *attr, char *buf) |
441 | @@ -136,28 +135,15 @@ static ssize_t slave_show(struct kobject *kobj, |
442 | return slave_attr->show(slave, buf); |
443 | } |
444 | |
445 | -static const struct sysfs_ops slave_sysfs_ops = { |
446 | +const struct sysfs_ops slave_sysfs_ops = { |
447 | .show = slave_show, |
448 | }; |
449 | |
450 | -static struct kobj_type slave_ktype = { |
451 | -#ifdef CONFIG_SYSFS |
452 | - .sysfs_ops = &slave_sysfs_ops, |
453 | -#endif |
454 | -}; |
455 | - |
456 | int bond_sysfs_slave_add(struct slave *slave) |
457 | { |
458 | const struct slave_attribute **a; |
459 | int err; |
460 | |
461 | - err = kobject_init_and_add(&slave->kobj, &slave_ktype, |
462 | - &(slave->dev->dev.kobj), "bonding_slave"); |
463 | - if (err) { |
464 | - kobject_put(&slave->kobj); |
465 | - return err; |
466 | - } |
467 | - |
468 | for (a = slave_attrs; *a; ++a) { |
469 | err = sysfs_create_file(&slave->kobj, &((*a)->attr)); |
470 | if (err) { |
471 | @@ -175,6 +161,4 @@ void bond_sysfs_slave_del(struct slave *slave) |
472 | |
473 | for (a = slave_attrs; *a; ++a) |
474 | sysfs_remove_file(&slave->kobj, &((*a)->attr)); |
475 | - |
476 | - kobject_put(&slave->kobj); |
477 | } |
478 | diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c |
479 | index e4b5b057f4178..f012649891dad 100644 |
480 | --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c |
481 | +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c |
482 | @@ -3111,6 +3111,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, |
483 | GFP_KERNEL | __GFP_COMP); |
484 | if (!avail) { |
485 | CH_ALERT(adapter, "free list queue 0 initialization failed\n"); |
486 | + ret = -ENOMEM; |
487 | goto err; |
488 | } |
489 | if (avail < q->fl[0].size) |
490 | diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
491 | index 88c837504c7d6..a8ff4f8a6b87d 100644 |
492 | --- a/drivers/net/ethernet/ibm/ibmvnic.c |
493 | +++ b/drivers/net/ethernet/ibm/ibmvnic.c |
494 | @@ -985,6 +985,12 @@ restart_poll: |
495 | |
496 | if (!pending_scrq(adapter, adapter->rx_scrq[scrq_num])) |
497 | break; |
498 | + /* The queue entry at the current index is peeked at above |
499 | + * to determine that there is a valid descriptor awaiting |
500 | + * processing. We want to be sure that the current slot |
501 | + * holds a valid descriptor before reading its contents. |
502 | + */ |
503 | + dma_rmb(); |
504 | next = ibmvnic_next_scrq(adapter, adapter->rx_scrq[scrq_num]); |
505 | rx_buff = |
506 | (struct ibmvnic_rx_buff *)be64_to_cpu(next-> |
507 | @@ -1373,13 +1379,18 @@ restart_loop: |
508 | while (pending_scrq(adapter, scrq)) { |
509 | unsigned int pool = scrq->pool_index; |
510 | |
511 | + /* The queue entry at the current index is peeked at above |
512 | + * to determine that there is a valid descriptor awaiting |
513 | + * processing. We want to be sure that the current slot |
514 | + * holds a valid descriptor before reading its contents. |
515 | + */ |
516 | + dma_rmb(); |
517 | + |
518 | next = ibmvnic_next_scrq(adapter, scrq); |
519 | for (i = 0; i < next->tx_comp.num_comps; i++) { |
520 | - if (next->tx_comp.rcs[i]) { |
521 | + if (next->tx_comp.rcs[i]) |
522 | dev_err(dev, "tx error %x\n", |
523 | next->tx_comp.rcs[i]); |
524 | - continue; |
525 | - } |
526 | index = be32_to_cpu(next->tx_comp.correlators[i]); |
527 | txbuff = &adapter->tx_pool[pool].tx_buff[index]; |
528 | |
529 | @@ -1707,6 +1718,11 @@ static union sub_crq *ibmvnic_next_scrq(struct ibmvnic_adapter *adapter, |
530 | } |
531 | spin_unlock_irqrestore(&scrq->lock, flags); |
532 | |
533 | + /* Ensure that the entire buffer descriptor has been |
534 | + * loaded before reading its contents |
535 | + */ |
536 | + dma_rmb(); |
537 | + |
538 | return entry; |
539 | } |
540 | |
541 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
542 | index a57d5a81eb05d..858c99864047c 100644 |
543 | --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
544 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |
545 | @@ -331,6 +331,24 @@ out_free: |
546 | return err; |
547 | } |
548 | |
549 | +static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index, |
550 | + u32 npages) |
551 | +{ |
552 | + u32 pages_set = 0; |
553 | + unsigned int n; |
554 | + |
555 | + for_each_clear_bit(n, &fwp->bitmask, MLX5_NUM_4K_IN_PAGE) { |
556 | + MLX5_ARRAY_SET64(manage_pages_out, out, pas, index + pages_set, |
557 | + fwp->addr + (n * MLX5_ADAPTER_PAGE_SIZE)); |
558 | + pages_set++; |
559 | + |
560 | + if (!--npages) |
561 | + break; |
562 | + } |
563 | + |
564 | + return pages_set; |
565 | +} |
566 | + |
567 | static int reclaim_pages_cmd(struct mlx5_core_dev *dev, |
568 | u32 *in, int in_size, u32 *out, int out_size) |
569 | { |
570 | @@ -354,8 +372,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev, |
571 | if (fwp->func_id != func_id) |
572 | continue; |
573 | |
574 | - MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr); |
575 | - i++; |
576 | + i += fwp_fill_manage_pages_out(fwp, out, i, npages - i); |
577 | } |
578 | |
579 | MLX5_SET(manage_pages_out, out, output_num_entries, i); |
580 | diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c |
581 | index dcd56ac687482..585225fbe2933 100644 |
582 | --- a/drivers/net/ethernet/pasemi/pasemi_mac.c |
583 | +++ b/drivers/net/ethernet/pasemi/pasemi_mac.c |
584 | @@ -1089,16 +1089,20 @@ static int pasemi_mac_open(struct net_device *dev) |
585 | |
586 | mac->tx = pasemi_mac_setup_tx_resources(dev); |
587 | |
588 | - if (!mac->tx) |
589 | + if (!mac->tx) { |
590 | + ret = -ENOMEM; |
591 | goto out_tx_ring; |
592 | + } |
593 | |
594 | /* We might already have allocated rings in case mtu was changed |
595 | * before interface was brought up. |
596 | */ |
597 | if (dev->mtu > 1500 && !mac->num_cs) { |
598 | pasemi_mac_setup_csrings(mac); |
599 | - if (!mac->num_cs) |
600 | + if (!mac->num_cs) { |
601 | + ret = -ENOMEM; |
602 | goto out_tx_ring; |
603 | + } |
604 | } |
605 | |
606 | /* Zero out rmon counters */ |
607 | diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c |
608 | index 2b16a5fed9ded..0cf5324d493e8 100644 |
609 | --- a/drivers/net/usb/ipheth.c |
610 | +++ b/drivers/net/usb/ipheth.c |
611 | @@ -70,7 +70,7 @@ |
612 | #define IPHETH_USBINTF_SUBCLASS 253 |
613 | #define IPHETH_USBINTF_PROTO 1 |
614 | |
615 | -#define IPHETH_BUF_SIZE 1516 |
616 | +#define IPHETH_BUF_SIZE 1514 |
617 | #define IPHETH_IP_ALIGN 2 /* padding at front of URB */ |
618 | #define IPHETH_TX_TIMEOUT (5 * HZ) |
619 | |
620 | diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c |
621 | index 1e945aa77734b..fc51922839f82 100644 |
622 | --- a/drivers/pinctrl/intel/pinctrl-baytrail.c |
623 | +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c |
624 | @@ -1017,6 +1017,21 @@ static void byt_gpio_disable_free(struct pinctrl_dev *pctl_dev, |
625 | pm_runtime_put(&vg->pdev->dev); |
626 | } |
627 | |
628 | +static void byt_gpio_direct_irq_check(struct byt_gpio *vg, |
629 | + unsigned int offset) |
630 | +{ |
631 | + void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); |
632 | + |
633 | + /* |
634 | + * Before making any direction modifications, do a check if gpio is set |
635 | + * for direct IRQ. On Bay Trail, setting GPIO to output does not make |
636 | + * sense, so let's at least inform the caller before they shoot |
637 | + * themselves in the foot. |
638 | + */ |
639 | + if (readl(conf_reg) & BYT_DIRECT_IRQ_EN) |
640 | + dev_info_once(&vg->pdev->dev, "Potential Error: Setting GPIO with direct_irq_en to output"); |
641 | +} |
642 | + |
643 | static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
644 | struct pinctrl_gpio_range *range, |
645 | unsigned int offset, |
646 | @@ -1024,7 +1039,6 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
647 | { |
648 | struct byt_gpio *vg = pinctrl_dev_get_drvdata(pctl_dev); |
649 | void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); |
650 | - void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); |
651 | unsigned long flags; |
652 | u32 value; |
653 | |
654 | @@ -1035,14 +1049,8 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev, |
655 | if (input) |
656 | value |= BYT_OUTPUT_EN; |
657 | else |
658 | - /* |
659 | - * Before making any direction modifications, do a check if gpio |
660 | - * is set for direct IRQ. On baytrail, setting GPIO to output |
661 | - * does not make sense, so let's at least warn the caller before |
662 | - * they shoot themselves in the foot. |
663 | - */ |
664 | - WARN(readl(conf_reg) & BYT_DIRECT_IRQ_EN, |
665 | - "Potential Error: Setting GPIO with direct_irq_en to output"); |
666 | + byt_gpio_direct_irq_check(vg, offset); |
667 | + |
668 | writel(value, val_reg); |
669 | |
670 | raw_spin_unlock_irqrestore(&byt_lock, flags); |
671 | @@ -1382,19 +1390,50 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) |
672 | |
673 | static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) |
674 | { |
675 | - return pinctrl_gpio_direction_input(chip->base + offset); |
676 | + struct byt_gpio *vg = gpiochip_get_data(chip); |
677 | + void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); |
678 | + unsigned long flags; |
679 | + u32 reg; |
680 | + |
681 | + raw_spin_lock_irqsave(&byt_lock, flags); |
682 | + |
683 | + reg = readl(val_reg); |
684 | + reg &= ~BYT_DIR_MASK; |
685 | + reg |= BYT_OUTPUT_EN; |
686 | + writel(reg, val_reg); |
687 | + |
688 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
689 | + return 0; |
690 | } |
691 | |
692 | +/* |
693 | + * Note despite the temptation this MUST NOT be converted into a call to |
694 | + * pinctrl_gpio_direction_output() + byt_gpio_set() that does not work this |
695 | + * MUST be done as a single BYT_VAL_REG register write. |
696 | + * See the commit message of the commit adding this comment for details. |
697 | + */ |
698 | static int byt_gpio_direction_output(struct gpio_chip *chip, |
699 | unsigned int offset, int value) |
700 | { |
701 | - int ret = pinctrl_gpio_direction_output(chip->base + offset); |
702 | + struct byt_gpio *vg = gpiochip_get_data(chip); |
703 | + void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); |
704 | + unsigned long flags; |
705 | + u32 reg; |
706 | |
707 | - if (ret) |
708 | - return ret; |
709 | + raw_spin_lock_irqsave(&byt_lock, flags); |
710 | |
711 | - byt_gpio_set(chip, offset, value); |
712 | + byt_gpio_direct_irq_check(vg, offset); |
713 | |
714 | + reg = readl(val_reg); |
715 | + reg &= ~BYT_DIR_MASK; |
716 | + if (value) |
717 | + reg |= BYT_LEVEL; |
718 | + else |
719 | + reg &= ~BYT_LEVEL; |
720 | + |
721 | + writel(reg, val_reg); |
722 | + |
723 | + raw_spin_unlock_irqrestore(&byt_lock, flags); |
724 | return 0; |
725 | } |
726 | |
727 | diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c |
728 | index 1906b2319e5bd..5453910d8abc3 100644 |
729 | --- a/drivers/spi/spi-bcm-qspi.c |
730 | +++ b/drivers/spi/spi-bcm-qspi.c |
731 | @@ -1185,7 +1185,7 @@ int bcm_qspi_probe(struct platform_device *pdev, |
732 | if (!of_match_node(bcm_qspi_of_match, dev->of_node)) |
733 | return -ENODEV; |
734 | |
735 | - master = spi_alloc_master(dev, sizeof(struct bcm_qspi)); |
736 | + master = devm_spi_alloc_master(dev, sizeof(struct bcm_qspi)); |
737 | if (!master) { |
738 | dev_err(dev, "error allocating spi_master\n"); |
739 | return -ENOMEM; |
740 | @@ -1218,21 +1218,17 @@ int bcm_qspi_probe(struct platform_device *pdev, |
741 | |
742 | if (res) { |
743 | qspi->base[MSPI] = devm_ioremap_resource(dev, res); |
744 | - if (IS_ERR(qspi->base[MSPI])) { |
745 | - ret = PTR_ERR(qspi->base[MSPI]); |
746 | - goto qspi_resource_err; |
747 | - } |
748 | + if (IS_ERR(qspi->base[MSPI])) |
749 | + return PTR_ERR(qspi->base[MSPI]); |
750 | } else { |
751 | - goto qspi_resource_err; |
752 | + return 0; |
753 | } |
754 | |
755 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bspi"); |
756 | if (res) { |
757 | qspi->base[BSPI] = devm_ioremap_resource(dev, res); |
758 | - if (IS_ERR(qspi->base[BSPI])) { |
759 | - ret = PTR_ERR(qspi->base[BSPI]); |
760 | - goto qspi_resource_err; |
761 | - } |
762 | + if (IS_ERR(qspi->base[BSPI])) |
763 | + return PTR_ERR(qspi->base[BSPI]); |
764 | qspi->bspi_mode = true; |
765 | } else { |
766 | qspi->bspi_mode = false; |
767 | @@ -1243,18 +1239,14 @@ int bcm_qspi_probe(struct platform_device *pdev, |
768 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs_reg"); |
769 | if (res) { |
770 | qspi->base[CHIP_SELECT] = devm_ioremap_resource(dev, res); |
771 | - if (IS_ERR(qspi->base[CHIP_SELECT])) { |
772 | - ret = PTR_ERR(qspi->base[CHIP_SELECT]); |
773 | - goto qspi_resource_err; |
774 | - } |
775 | + if (IS_ERR(qspi->base[CHIP_SELECT])) |
776 | + return PTR_ERR(qspi->base[CHIP_SELECT]); |
777 | } |
778 | |
779 | qspi->dev_ids = kcalloc(num_irqs, sizeof(struct bcm_qspi_dev_id), |
780 | GFP_KERNEL); |
781 | - if (!qspi->dev_ids) { |
782 | - ret = -ENOMEM; |
783 | - goto qspi_resource_err; |
784 | - } |
785 | + if (!qspi->dev_ids) |
786 | + return -ENOMEM; |
787 | |
788 | for (val = 0; val < num_irqs; val++) { |
789 | irq = -1; |
790 | @@ -1330,7 +1322,7 @@ int bcm_qspi_probe(struct platform_device *pdev, |
791 | qspi->xfer_mode.addrlen = -1; |
792 | qspi->xfer_mode.hp = -1; |
793 | |
794 | - ret = devm_spi_register_master(&pdev->dev, master); |
795 | + ret = spi_register_master(master); |
796 | if (ret < 0) { |
797 | dev_err(dev, "can't register master\n"); |
798 | goto qspi_reg_err; |
799 | @@ -1343,8 +1335,6 @@ qspi_reg_err: |
800 | clk_disable_unprepare(qspi->clk); |
801 | qspi_probe_err: |
802 | kfree(qspi->dev_ids); |
803 | -qspi_resource_err: |
804 | - spi_master_put(master); |
805 | return ret; |
806 | } |
807 | /* probe function to be called by SoC specific platform driver probe */ |
808 | @@ -1355,10 +1345,10 @@ int bcm_qspi_remove(struct platform_device *pdev) |
809 | struct bcm_qspi *qspi = platform_get_drvdata(pdev); |
810 | |
811 | platform_set_drvdata(pdev, NULL); |
812 | + spi_unregister_master(qspi->master); |
813 | bcm_qspi_hw_uninit(qspi); |
814 | clk_disable_unprepare(qspi->clk); |
815 | kfree(qspi->dev_ids); |
816 | - spi_unregister_master(qspi->master); |
817 | |
818 | return 0; |
819 | } |
820 | diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c |
821 | index df6abc75bc167..6824beae18e4a 100644 |
822 | --- a/drivers/spi/spi-bcm2835.c |
823 | +++ b/drivers/spi/spi-bcm2835.c |
824 | @@ -737,7 +737,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
825 | struct resource *res; |
826 | int err; |
827 | |
828 | - master = spi_alloc_master(&pdev->dev, sizeof(*bs)); |
829 | + master = devm_spi_alloc_master(&pdev->dev, sizeof(*bs)); |
830 | if (!master) { |
831 | dev_err(&pdev->dev, "spi_alloc_master() failed\n"); |
832 | return -ENOMEM; |
833 | @@ -759,23 +759,20 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
834 | |
835 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
836 | bs->regs = devm_ioremap_resource(&pdev->dev, res); |
837 | - if (IS_ERR(bs->regs)) { |
838 | - err = PTR_ERR(bs->regs); |
839 | - goto out_master_put; |
840 | - } |
841 | + if (IS_ERR(bs->regs)) |
842 | + return PTR_ERR(bs->regs); |
843 | |
844 | bs->clk = devm_clk_get(&pdev->dev, NULL); |
845 | if (IS_ERR(bs->clk)) { |
846 | err = PTR_ERR(bs->clk); |
847 | dev_err(&pdev->dev, "could not get clk: %d\n", err); |
848 | - goto out_master_put; |
849 | + return err; |
850 | } |
851 | |
852 | bs->irq = platform_get_irq(pdev, 0); |
853 | if (bs->irq <= 0) { |
854 | dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq); |
855 | - err = bs->irq ? bs->irq : -ENODEV; |
856 | - goto out_master_put; |
857 | + return bs->irq ? bs->irq : -ENODEV; |
858 | } |
859 | |
860 | clk_prepare_enable(bs->clk); |
861 | @@ -790,21 +787,20 @@ static int bcm2835_spi_probe(struct platform_device *pdev) |
862 | dev_name(&pdev->dev), master); |
863 | if (err) { |
864 | dev_err(&pdev->dev, "could not request IRQ: %d\n", err); |
865 | - goto out_clk_disable; |
866 | + goto out_dma_release; |
867 | } |
868 | |
869 | err = spi_register_master(master); |
870 | if (err) { |
871 | dev_err(&pdev->dev, "could not register SPI master: %d\n", err); |
872 | - goto out_clk_disable; |
873 | + goto out_dma_release; |
874 | } |
875 | |
876 | return 0; |
877 | |
878 | -out_clk_disable: |
879 | +out_dma_release: |
880 | + bcm2835_dma_release(master); |
881 | clk_disable_unprepare(bs->clk); |
882 | -out_master_put: |
883 | - spi_master_put(master); |
884 | return err; |
885 | } |
886 | |
887 | diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
888 | index 3fadc564d781c..e0632ee1723b0 100644 |
889 | --- a/drivers/spi/spi.c |
890 | +++ b/drivers/spi/spi.c |
891 | @@ -1827,6 +1827,46 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) |
892 | } |
893 | EXPORT_SYMBOL_GPL(spi_alloc_master); |
894 | |
895 | +static void devm_spi_release_master(struct device *dev, void *master) |
896 | +{ |
897 | + spi_master_put(*(struct spi_master **)master); |
898 | +} |
899 | + |
900 | +/** |
901 | + * devm_spi_alloc_master - resource-managed spi_alloc_master() |
902 | + * @dev: physical device of SPI master |
903 | + * @size: how much zeroed driver-private data to allocate |
904 | + * Context: can sleep |
905 | + * |
906 | + * Allocate an SPI master and automatically release a reference on it |
907 | + * when @dev is unbound from its driver. Drivers are thus relieved from |
908 | + * having to call spi_master_put(). |
909 | + * |
910 | + * The arguments to this function are identical to spi_alloc_master(). |
911 | + * |
912 | + * Return: the SPI master structure on success, else NULL. |
913 | + */ |
914 | +struct spi_master *devm_spi_alloc_master(struct device *dev, unsigned int size) |
915 | +{ |
916 | + struct spi_master **ptr, *master; |
917 | + |
918 | + ptr = devres_alloc(devm_spi_release_master, sizeof(*ptr), |
919 | + GFP_KERNEL); |
920 | + if (!ptr) |
921 | + return NULL; |
922 | + |
923 | + master = spi_alloc_master(dev, size); |
924 | + if (master) { |
925 | + *ptr = master; |
926 | + devres_add(dev, ptr); |
927 | + } else { |
928 | + devres_free(ptr); |
929 | + } |
930 | + |
931 | + return master; |
932 | +} |
933 | +EXPORT_SYMBOL_GPL(devm_spi_alloc_master); |
934 | + |
935 | #ifdef CONFIG_OF |
936 | static int of_spi_register_master(struct spi_master *master) |
937 | { |
938 | @@ -2007,6 +2047,11 @@ int devm_spi_register_master(struct device *dev, struct spi_master *master) |
939 | } |
940 | EXPORT_SYMBOL_GPL(devm_spi_register_master); |
941 | |
942 | +static int devm_spi_match_master(struct device *dev, void *res, void *master) |
943 | +{ |
944 | + return *(struct spi_master **)res == master; |
945 | +} |
946 | + |
947 | static int __unregister(struct device *dev, void *null) |
948 | { |
949 | spi_unregister_device(to_spi_device(dev)); |
950 | @@ -2025,18 +2070,25 @@ static int __unregister(struct device *dev, void *null) |
951 | */ |
952 | void spi_unregister_master(struct spi_master *master) |
953 | { |
954 | + device_for_each_child(&master->dev, NULL, __unregister); |
955 | + |
956 | if (master->queued) { |
957 | if (spi_destroy_queue(master)) |
958 | dev_err(&master->dev, "queue remove failed\n"); |
959 | } |
960 | |
961 | - device_for_each_child(&master->dev, NULL, __unregister); |
962 | - |
963 | mutex_lock(&board_lock); |
964 | list_del(&master->list); |
965 | mutex_unlock(&board_lock); |
966 | |
967 | - device_unregister(&master->dev); |
968 | + device_del(&master->dev); |
969 | + |
970 | + /* Release the last reference on the master if its driver |
971 | + * has not yet been converted to devm_spi_alloc_master(). |
972 | + */ |
973 | + if (!devres_find(master->dev.parent, devm_spi_release_master, |
974 | + devm_spi_match_master, master)) |
975 | + put_device(&master->dev); |
976 | } |
977 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
978 | |
979 | diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
980 | index 15e0116e1232e..7b4aca20cb299 100644 |
981 | --- a/drivers/tty/tty_io.c |
982 | +++ b/drivers/tty/tty_io.c |
983 | @@ -544,8 +544,8 @@ static void __proc_set_tty(struct tty_struct *tty) |
984 | put_pid(tty->session); |
985 | put_pid(tty->pgrp); |
986 | tty->pgrp = get_pid(task_pgrp(current)); |
987 | - spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
988 | tty->session = get_pid(task_session(current)); |
989 | + spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
990 | if (current->signal->tty) { |
991 | tty_debug(tty, "current tty %s not NULL!!\n", |
992 | current->signal->tty->name); |
993 | @@ -935,21 +935,24 @@ void disassociate_ctty(int on_exit) |
994 | spin_lock_irq(¤t->sighand->siglock); |
995 | put_pid(current->signal->tty_old_pgrp); |
996 | current->signal->tty_old_pgrp = NULL; |
997 | - |
998 | tty = tty_kref_get(current->signal->tty); |
999 | + spin_unlock_irq(¤t->sighand->siglock); |
1000 | + |
1001 | if (tty) { |
1002 | unsigned long flags; |
1003 | + |
1004 | + tty_lock(tty); |
1005 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
1006 | put_pid(tty->session); |
1007 | put_pid(tty->pgrp); |
1008 | tty->session = NULL; |
1009 | tty->pgrp = NULL; |
1010 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
1011 | + tty_unlock(tty); |
1012 | tty_kref_put(tty); |
1013 | } else |
1014 | tty_debug_hangup(tty, "no current tty\n"); |
1015 | |
1016 | - spin_unlock_irq(¤t->sighand->siglock); |
1017 | /* Now clear signal->tty under the lock */ |
1018 | read_lock(&tasklist_lock); |
1019 | session_clear_tty(task_session(current)); |
1020 | @@ -2628,14 +2631,19 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t |
1021 | return -ENOTTY; |
1022 | if (retval) |
1023 | return retval; |
1024 | - if (!current->signal->tty || |
1025 | - (current->signal->tty != real_tty) || |
1026 | - (real_tty->session != task_session(current))) |
1027 | - return -ENOTTY; |
1028 | + |
1029 | if (get_user(pgrp_nr, p)) |
1030 | return -EFAULT; |
1031 | if (pgrp_nr < 0) |
1032 | return -EINVAL; |
1033 | + |
1034 | + spin_lock_irq(&real_tty->ctrl_lock); |
1035 | + if (!current->signal->tty || |
1036 | + (current->signal->tty != real_tty) || |
1037 | + (real_tty->session != task_session(current))) { |
1038 | + retval = -ENOTTY; |
1039 | + goto out_unlock_ctrl; |
1040 | + } |
1041 | rcu_read_lock(); |
1042 | pgrp = find_vpid(pgrp_nr); |
1043 | retval = -ESRCH; |
1044 | @@ -2645,12 +2653,12 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t |
1045 | if (session_of_pgrp(pgrp) != task_session(current)) |
1046 | goto out_unlock; |
1047 | retval = 0; |
1048 | - spin_lock_irq(&tty->ctrl_lock); |
1049 | put_pid(real_tty->pgrp); |
1050 | real_tty->pgrp = get_pid(pgrp); |
1051 | - spin_unlock_irq(&tty->ctrl_lock); |
1052 | out_unlock: |
1053 | rcu_read_unlock(); |
1054 | +out_unlock_ctrl: |
1055 | + spin_unlock_irq(&real_tty->ctrl_lock); |
1056 | return retval; |
1057 | } |
1058 | |
1059 | @@ -2662,21 +2670,31 @@ out_unlock: |
1060 | * |
1061 | * Obtain the session id of the tty. If there is no session |
1062 | * return an error. |
1063 | - * |
1064 | - * Locking: none. Reference to current->signal->tty is safe. |
1065 | */ |
1066 | |
1067 | static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p) |
1068 | { |
1069 | + unsigned long flags; |
1070 | + pid_t sid; |
1071 | + |
1072 | /* |
1073 | * (tty == real_tty) is a cheap way of |
1074 | * testing if the tty is NOT a master pty. |
1075 | */ |
1076 | if (tty == real_tty && current->signal->tty != real_tty) |
1077 | return -ENOTTY; |
1078 | + |
1079 | + spin_lock_irqsave(&real_tty->ctrl_lock, flags); |
1080 | if (!real_tty->session) |
1081 | - return -ENOTTY; |
1082 | - return put_user(pid_vnr(real_tty->session), p); |
1083 | + goto err; |
1084 | + sid = pid_vnr(real_tty->session); |
1085 | + spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); |
1086 | + |
1087 | + return put_user(sid, p); |
1088 | + |
1089 | +err: |
1090 | + spin_unlock_irqrestore(&real_tty->ctrl_lock, flags); |
1091 | + return -ENOTTY; |
1092 | } |
1093 | |
1094 | /** |
1095 | @@ -3094,10 +3112,14 @@ void __do_SAK(struct tty_struct *tty) |
1096 | struct task_struct *g, *p; |
1097 | struct pid *session; |
1098 | int i; |
1099 | + unsigned long flags; |
1100 | |
1101 | if (!tty) |
1102 | return; |
1103 | - session = tty->session; |
1104 | + |
1105 | + spin_lock_irqsave(&tty->ctrl_lock, flags); |
1106 | + session = get_pid(tty->session); |
1107 | + spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
1108 | |
1109 | tty_ldisc_flush(tty); |
1110 | |
1111 | @@ -3129,6 +3151,7 @@ void __do_SAK(struct tty_struct *tty) |
1112 | task_unlock(p); |
1113 | } while_each_thread(g, p); |
1114 | read_unlock(&tasklist_lock); |
1115 | + put_pid(session); |
1116 | #endif |
1117 | } |
1118 | |
1119 | diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
1120 | index bea11be98526c..68489557752da 100644 |
1121 | --- a/drivers/usb/gadget/function/f_fs.c |
1122 | +++ b/drivers/usb/gadget/function/f_fs.c |
1123 | @@ -1224,7 +1224,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, |
1124 | case FUNCTIONFS_ENDPOINT_DESC: |
1125 | { |
1126 | int desc_idx; |
1127 | - struct usb_endpoint_descriptor *desc; |
1128 | + struct usb_endpoint_descriptor desc1, *desc; |
1129 | |
1130 | switch (epfile->ffs->gadget->speed) { |
1131 | case USB_SPEED_SUPER: |
1132 | @@ -1236,10 +1236,12 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, |
1133 | default: |
1134 | desc_idx = 0; |
1135 | } |
1136 | + |
1137 | desc = epfile->ep->descs[desc_idx]; |
1138 | + memcpy(&desc1, desc, desc->bLength); |
1139 | |
1140 | spin_unlock_irq(&epfile->ffs->eps_lock); |
1141 | - ret = copy_to_user((void *)value, desc, sizeof(*desc)); |
1142 | + ret = copy_to_user((void *)value, &desc1, desc1.bLength); |
1143 | if (ret) |
1144 | ret = -EFAULT; |
1145 | return ret; |
1146 | diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
1147 | index cfa02d7123623..fc1c8f4f34c18 100644 |
1148 | --- a/drivers/usb/serial/ch341.c |
1149 | +++ b/drivers/usb/serial/ch341.c |
1150 | @@ -70,10 +70,11 @@ |
1151 | |
1152 | |
1153 | static const struct usb_device_id id_table[] = { |
1154 | - { USB_DEVICE(0x4348, 0x5523) }, |
1155 | + { USB_DEVICE(0x1a86, 0x5512) }, |
1156 | + { USB_DEVICE(0x1a86, 0x5523) }, |
1157 | { USB_DEVICE(0x1a86, 0x7522) }, |
1158 | { USB_DEVICE(0x1a86, 0x7523) }, |
1159 | - { USB_DEVICE(0x1a86, 0x5523) }, |
1160 | + { USB_DEVICE(0x4348, 0x5523) }, |
1161 | { }, |
1162 | }; |
1163 | MODULE_DEVICE_TABLE(usb, id_table); |
1164 | diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c |
1165 | index 6cb45757818fa..64f5765df5b61 100644 |
1166 | --- a/drivers/usb/serial/kl5kusb105.c |
1167 | +++ b/drivers/usb/serial/kl5kusb105.c |
1168 | @@ -293,12 +293,12 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) |
1169 | priv->cfg.unknown2 = cfg->unknown2; |
1170 | spin_unlock_irqrestore(&priv->lock, flags); |
1171 | |
1172 | + kfree(cfg); |
1173 | + |
1174 | /* READ_ON and urb submission */ |
1175 | rc = usb_serial_generic_open(tty, port); |
1176 | - if (rc) { |
1177 | - retval = rc; |
1178 | - goto err_free_cfg; |
1179 | - } |
1180 | + if (rc) |
1181 | + return rc; |
1182 | |
1183 | rc = usb_control_msg(port->serial->dev, |
1184 | usb_sndctrlpipe(port->serial->dev, 0), |
1185 | @@ -341,8 +341,6 @@ err_disable_read: |
1186 | KLSI_TIMEOUT); |
1187 | err_generic_close: |
1188 | usb_serial_generic_close(port); |
1189 | -err_free_cfg: |
1190 | - kfree(cfg); |
1191 | |
1192 | return retval; |
1193 | } |
1194 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1195 | index 34ac1265afe46..e8643612e9a39 100644 |
1196 | --- a/drivers/usb/serial/option.c |
1197 | +++ b/drivers/usb/serial/option.c |
1198 | @@ -419,6 +419,7 @@ static void option_instat_callback(struct urb *urb); |
1199 | #define CINTERION_PRODUCT_PH8 0x0053 |
1200 | #define CINTERION_PRODUCT_AHXX 0x0055 |
1201 | #define CINTERION_PRODUCT_PLXX 0x0060 |
1202 | +#define CINTERION_PRODUCT_EXS82 0x006c |
1203 | #define CINTERION_PRODUCT_PH8_2RMNET 0x0082 |
1204 | #define CINTERION_PRODUCT_PH8_AUDIO 0x0083 |
1205 | #define CINTERION_PRODUCT_AHXX_2RMNET 0x0084 |
1206 | @@ -1885,6 +1886,7 @@ static const struct usb_device_id option_ids[] = { |
1207 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) }, |
1208 | { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_CLS8, 0xff), |
1209 | .driver_info = RSVD(0) | RSVD(4) }, |
1210 | + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EXS82, 0xff) }, |
1211 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, |
1212 | { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1213 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, |
1214 | @@ -2031,12 +2033,13 @@ static const struct usb_device_id option_ids[] = { |
1215 | .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
1216 | { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ |
1217 | .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
1218 | - { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 */ |
1219 | + { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ |
1220 | .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, |
1221 | { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ |
1222 | .driver_info = RSVD(4) | RSVD(5) }, |
1223 | { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ |
1224 | .driver_info = RSVD(6) }, |
1225 | + { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ |
1226 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */ |
1227 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */ |
1228 | { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */ |
1229 | diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
1230 | index 7391634520ab2..6afaacb791a13 100644 |
1231 | --- a/fs/btrfs/volumes.c |
1232 | +++ b/fs/btrfs/volumes.c |
1233 | @@ -2431,9 +2431,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) |
1234 | btrfs_set_super_num_devices(root->fs_info->super_copy, |
1235 | tmp + 1); |
1236 | |
1237 | - /* add sysfs device entry */ |
1238 | - btrfs_sysfs_add_device_link(root->fs_info->fs_devices, device); |
1239 | - |
1240 | /* |
1241 | * we've got more storage, clear any full flags on the space |
1242 | * infos |
1243 | @@ -2441,6 +2438,10 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) |
1244 | btrfs_clear_space_info_full(root->fs_info); |
1245 | |
1246 | unlock_chunks(root); |
1247 | + |
1248 | + /* add sysfs device entry */ |
1249 | + btrfs_sysfs_add_device_link(root->fs_info->fs_devices, device); |
1250 | + |
1251 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
1252 | |
1253 | if (seeding_dev) { |
1254 | diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
1255 | index df8fab6fc2cac..af78de9ef036c 100644 |
1256 | --- a/fs/cifs/connect.c |
1257 | +++ b/fs/cifs/connect.c |
1258 | @@ -730,6 +730,8 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) |
1259 | list_del_init(&server->tcp_ses_list); |
1260 | spin_unlock(&cifs_tcp_ses_lock); |
1261 | |
1262 | + cancel_delayed_work_sync(&server->echo); |
1263 | + |
1264 | spin_lock(&GlobalMid_Lock); |
1265 | server->tcpStatus = CifsExiting; |
1266 | spin_unlock(&GlobalMid_Lock); |
1267 | diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
1268 | index 9621badb95995..56a94535c246f 100644 |
1269 | --- a/fs/gfs2/rgrp.c |
1270 | +++ b/fs/gfs2/rgrp.c |
1271 | @@ -1000,6 +1000,10 @@ static int gfs2_ri_update(struct gfs2_inode *ip) |
1272 | if (error < 0) |
1273 | return error; |
1274 | |
1275 | + if (RB_EMPTY_ROOT(&sdp->sd_rindex_tree)) { |
1276 | + fs_err(sdp, "no resource groups found in the file system.\n"); |
1277 | + return -ENOENT; |
1278 | + } |
1279 | set_rgrp_preferences(sdp); |
1280 | |
1281 | sdp->sd_rindex_uptodate = 1; |
1282 | diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h |
1283 | index 7e39719e27cbc..27edc7f2de31b 100644 |
1284 | --- a/include/linux/if_vlan.h |
1285 | +++ b/include/linux/if_vlan.h |
1286 | @@ -30,6 +30,8 @@ |
1287 | #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ |
1288 | #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ |
1289 | |
1290 | +#define VLAN_MAX_DEPTH 8 /* Max. number of nested VLAN tags parsed */ |
1291 | + |
1292 | /* |
1293 | * struct vlan_hdr - vlan header |
1294 | * @h_vlan_TCI: priority and VLAN ID |
1295 | @@ -495,10 +497,10 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) |
1296 | * Returns the EtherType of the packet, regardless of whether it is |
1297 | * vlan encapsulated (normal or hardware accelerated) or not. |
1298 | */ |
1299 | -static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, |
1300 | +static inline __be16 __vlan_get_protocol(const struct sk_buff *skb, __be16 type, |
1301 | int *depth) |
1302 | { |
1303 | - unsigned int vlan_depth = skb->mac_len; |
1304 | + unsigned int vlan_depth = skb->mac_len, parse_depth = VLAN_MAX_DEPTH; |
1305 | |
1306 | /* if type is 802.1Q/AD then the header should already be |
1307 | * present at mac_len - VLAN_HLEN (if mac_len > 0), or at |
1308 | @@ -513,13 +515,12 @@ static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, |
1309 | vlan_depth = ETH_HLEN; |
1310 | } |
1311 | do { |
1312 | - struct vlan_hdr *vh; |
1313 | + struct vlan_hdr vhdr, *vh; |
1314 | |
1315 | - if (unlikely(!pskb_may_pull(skb, |
1316 | - vlan_depth + VLAN_HLEN))) |
1317 | + vh = skb_header_pointer(skb, vlan_depth, sizeof(vhdr), &vhdr); |
1318 | + if (unlikely(!vh || !--parse_depth)) |
1319 | return 0; |
1320 | |
1321 | - vh = (struct vlan_hdr *)(skb->data + vlan_depth); |
1322 | type = vh->h_vlan_encapsulated_proto; |
1323 | vlan_depth += VLAN_HLEN; |
1324 | } while (eth_type_vlan(type)); |
1325 | @@ -538,11 +539,25 @@ static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type, |
1326 | * Returns the EtherType of the packet, regardless of whether it is |
1327 | * vlan encapsulated (normal or hardware accelerated) or not. |
1328 | */ |
1329 | -static inline __be16 vlan_get_protocol(struct sk_buff *skb) |
1330 | +static inline __be16 vlan_get_protocol(const struct sk_buff *skb) |
1331 | { |
1332 | return __vlan_get_protocol(skb, skb->protocol, NULL); |
1333 | } |
1334 | |
1335 | +/* A getter for the SKB protocol field which will handle VLAN tags consistently |
1336 | + * whether VLAN acceleration is enabled or not. |
1337 | + */ |
1338 | +static inline __be16 skb_protocol(const struct sk_buff *skb, bool skip_vlan) |
1339 | +{ |
1340 | + if (!skip_vlan) |
1341 | + /* VLAN acceleration strips the VLAN header from the skb and |
1342 | + * moves it to skb->vlan_proto |
1343 | + */ |
1344 | + return skb_vlan_tag_present(skb) ? skb->vlan_proto : skb->protocol; |
1345 | + |
1346 | + return vlan_get_protocol(skb); |
1347 | +} |
1348 | + |
1349 | static inline void vlan_set_encap_proto(struct sk_buff *skb, |
1350 | struct vlan_hdr *vhdr) |
1351 | { |
1352 | diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h |
1353 | index 4b743ac353962..8470695e5dd78 100644 |
1354 | --- a/include/linux/spi/spi.h |
1355 | +++ b/include/linux/spi/spi.h |
1356 | @@ -601,6 +601,8 @@ extern void spi_finalize_current_transfer(struct spi_master *master); |
1357 | /* the spi driver core manages memory for the spi_master classdev */ |
1358 | extern struct spi_master * |
1359 | spi_alloc_master(struct device *host, unsigned size); |
1360 | +extern struct spi_master * |
1361 | +devm_spi_alloc_master(struct device *dev, unsigned int size); |
1362 | |
1363 | extern int spi_register_master(struct spi_master *master); |
1364 | extern int devm_spi_register_master(struct device *dev, |
1365 | diff --git a/include/linux/tty.h b/include/linux/tty.h |
1366 | index 15cf871046b39..a41146b6eaf42 100644 |
1367 | --- a/include/linux/tty.h |
1368 | +++ b/include/linux/tty.h |
1369 | @@ -293,6 +293,10 @@ struct tty_struct { |
1370 | struct termiox *termiox; /* May be NULL for unsupported */ |
1371 | char name[64]; |
1372 | struct pid *pgrp; /* Protected by ctrl lock */ |
1373 | + /* |
1374 | + * Writes protected by both ctrl lock and legacy mutex, readers must use |
1375 | + * at least one of them. |
1376 | + */ |
1377 | struct pid *session; |
1378 | unsigned long flags; |
1379 | int count; |
1380 | diff --git a/include/net/bonding.h b/include/net/bonding.h |
1381 | index 8750c2c4871a3..bd29fd190bb12 100644 |
1382 | --- a/include/net/bonding.h |
1383 | +++ b/include/net/bonding.h |
1384 | @@ -170,6 +170,11 @@ struct slave { |
1385 | struct rtnl_link_stats64 slave_stats; |
1386 | }; |
1387 | |
1388 | +static inline struct slave *to_slave(struct kobject *kobj) |
1389 | +{ |
1390 | + return container_of(kobj, struct slave, kobj); |
1391 | +} |
1392 | + |
1393 | struct bond_up_slave { |
1394 | unsigned int count; |
1395 | struct rcu_head rcu; |
1396 | @@ -694,6 +699,9 @@ extern struct bond_parm_tbl ad_select_tbl[]; |
1397 | /* exported from bond_netlink.c */ |
1398 | extern struct rtnl_link_ops bond_link_ops; |
1399 | |
1400 | +/* exported from bond_sysfs_slave.c */ |
1401 | +extern const struct sysfs_ops slave_sysfs_ops; |
1402 | + |
1403 | static inline void bond_tx_drop(struct net_device *dev, struct sk_buff *skb) |
1404 | { |
1405 | atomic_long_inc(&dev->tx_dropped); |
1406 | diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h |
1407 | index dce2d586d9cec..245d999c0eac8 100644 |
1408 | --- a/include/net/inet_ecn.h |
1409 | +++ b/include/net/inet_ecn.h |
1410 | @@ -3,6 +3,7 @@ |
1411 | |
1412 | #include <linux/ip.h> |
1413 | #include <linux/skbuff.h> |
1414 | +#include <linux/if_vlan.h> |
1415 | |
1416 | #include <net/inet_sock.h> |
1417 | #include <net/dsfield.h> |
1418 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
1419 | index 51e47e18764e3..16ca877745f62 100644 |
1420 | --- a/kernel/trace/ftrace.c |
1421 | +++ b/kernel/trace/ftrace.c |
1422 | @@ -1634,6 +1634,8 @@ static bool test_rec_ops_needs_regs(struct dyn_ftrace *rec) |
1423 | static struct ftrace_ops * |
1424 | ftrace_find_tramp_ops_any(struct dyn_ftrace *rec); |
1425 | static struct ftrace_ops * |
1426 | +ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude); |
1427 | +static struct ftrace_ops * |
1428 | ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops); |
1429 | |
1430 | static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, |
1431 | @@ -1771,7 +1773,7 @@ static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, |
1432 | * to it. |
1433 | */ |
1434 | if (ftrace_rec_count(rec) == 1 && |
1435 | - ftrace_find_tramp_ops_any(rec)) |
1436 | + ftrace_find_tramp_ops_any_other(rec, ops)) |
1437 | rec->flags |= FTRACE_FL_TRAMP; |
1438 | else |
1439 | rec->flags &= ~FTRACE_FL_TRAMP; |
1440 | @@ -2199,6 +2201,24 @@ ftrace_find_tramp_ops_any(struct dyn_ftrace *rec) |
1441 | return NULL; |
1442 | } |
1443 | |
1444 | +static struct ftrace_ops * |
1445 | +ftrace_find_tramp_ops_any_other(struct dyn_ftrace *rec, struct ftrace_ops *op_exclude) |
1446 | +{ |
1447 | + struct ftrace_ops *op; |
1448 | + unsigned long ip = rec->ip; |
1449 | + |
1450 | + do_for_each_ftrace_op(op, ftrace_ops_list) { |
1451 | + |
1452 | + if (op == op_exclude || !op->trampoline) |
1453 | + continue; |
1454 | + |
1455 | + if (hash_contains_ip(ip, op->func_hash)) |
1456 | + return op; |
1457 | + } while_for_each_ftrace_op(op); |
1458 | + |
1459 | + return NULL; |
1460 | +} |
1461 | + |
1462 | static struct ftrace_ops * |
1463 | ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, |
1464 | struct ftrace_ops *op) |
1465 | diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
1466 | index 2fdebbb30839e..005929d13c7db 100644 |
1467 | --- a/kernel/trace/trace.c |
1468 | +++ b/kernel/trace/trace.c |
1469 | @@ -2134,7 +2134,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr, |
1470 | * two. They are that meaningful. |
1471 | */ |
1472 | ftrace_trace_stack(tr, buffer, flags, regs ? 0 : 4, pc, regs); |
1473 | - ftrace_trace_userstack(buffer, flags, pc); |
1474 | + ftrace_trace_userstack(tr, buffer, flags, pc); |
1475 | } |
1476 | |
1477 | void |
1478 | @@ -2299,14 +2299,15 @@ void trace_dump_stack(int skip) |
1479 | static DEFINE_PER_CPU(int, user_stack_count); |
1480 | |
1481 | void |
1482 | -ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) |
1483 | +ftrace_trace_userstack(struct trace_array *tr, |
1484 | + struct ring_buffer *buffer, unsigned long flags, int pc) |
1485 | { |
1486 | struct trace_event_call *call = &event_user_stack; |
1487 | struct ring_buffer_event *event; |
1488 | struct userstack_entry *entry; |
1489 | struct stack_trace trace; |
1490 | |
1491 | - if (!(global_trace.trace_flags & TRACE_ITER_USERSTACKTRACE)) |
1492 | + if (!(tr->trace_flags & TRACE_ITER_USERSTACKTRACE)) |
1493 | return; |
1494 | |
1495 | /* |
1496 | diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h |
1497 | index 950c0e12a391a..d9b7910ef3658 100644 |
1498 | --- a/kernel/trace/trace.h |
1499 | +++ b/kernel/trace/trace.h |
1500 | @@ -689,13 +689,15 @@ void update_max_tr_single(struct trace_array *tr, |
1501 | #endif /* CONFIG_TRACER_MAX_TRACE */ |
1502 | |
1503 | #ifdef CONFIG_STACKTRACE |
1504 | -void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, |
1505 | +void ftrace_trace_userstack(struct trace_array *tr, |
1506 | + struct ring_buffer *buffer, unsigned long flags, |
1507 | int pc); |
1508 | |
1509 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
1510 | int pc); |
1511 | #else |
1512 | -static inline void ftrace_trace_userstack(struct ring_buffer *buffer, |
1513 | +static inline void ftrace_trace_userstack(struct trace_array *tr, |
1514 | + struct ring_buffer *buffer, |
1515 | unsigned long flags, int pc) |
1516 | { |
1517 | } |
1518 | diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c |
1519 | index 62e045c9d4529..7104d5e64abb3 100644 |
1520 | --- a/net/bridge/br_netfilter_hooks.c |
1521 | +++ b/net/bridge/br_netfilter_hooks.c |
1522 | @@ -716,6 +716,11 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff |
1523 | mtu_reserved = nf_bridge_mtu_reduction(skb); |
1524 | mtu = skb->dev->mtu; |
1525 | |
1526 | + if (nf_bridge->pkt_otherhost) { |
1527 | + skb->pkt_type = PACKET_OTHERHOST; |
1528 | + nf_bridge->pkt_otherhost = false; |
1529 | + } |
1530 | + |
1531 | if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) |
1532 | mtu = nf_bridge->frag_max_size; |
1533 | |
1534 | @@ -809,8 +814,6 @@ static unsigned int br_nf_post_routing(void *priv, |
1535 | else |
1536 | return NF_ACCEPT; |
1537 | |
1538 | - /* We assume any code from br_dev_queue_push_xmit onwards doesn't care |
1539 | - * about the value of skb->pkt_type. */ |
1540 | if (skb->pkt_type == PACKET_OTHERHOST) { |
1541 | skb->pkt_type = PACKET_HOST; |
1542 | nf_bridge->pkt_otherhost = true; |
1543 | diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c |
1544 | index ba81655a584bd..b139c149c42ac 100644 |
1545 | --- a/net/iucv/af_iucv.c |
1546 | +++ b/net/iucv/af_iucv.c |
1547 | @@ -1753,7 +1753,7 @@ static int iucv_callback_connreq(struct iucv_path *path, |
1548 | } |
1549 | |
1550 | /* Create the new socket */ |
1551 | - nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); |
1552 | + nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); |
1553 | if (!nsk) { |
1554 | err = pr_iucv->path_sever(path, user_data); |
1555 | iucv_path_free(path); |
1556 | @@ -1963,7 +1963,7 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) |
1557 | goto out; |
1558 | } |
1559 | |
1560 | - nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); |
1561 | + nsk = iucv_sock_alloc(NULL, sk->sk_protocol, GFP_ATOMIC, 0); |
1562 | bh_lock_sock(sk); |
1563 | if ((sk->sk_state != IUCV_LISTEN) || |
1564 | sk_acceptq_is_full(sk) || |
1565 | diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c |
1566 | index 344456206b70b..0f371e50d9c4e 100644 |
1567 | --- a/net/rose/rose_loopback.c |
1568 | +++ b/net/rose/rose_loopback.c |
1569 | @@ -99,10 +99,19 @@ static void rose_loopback_timer(unsigned long param) |
1570 | } |
1571 | |
1572 | if (frametype == ROSE_CALL_REQUEST) { |
1573 | - if ((dev = rose_dev_get(dest)) != NULL) { |
1574 | - if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) |
1575 | - kfree_skb(skb); |
1576 | - } else { |
1577 | + if (!rose_loopback_neigh->dev) { |
1578 | + kfree_skb(skb); |
1579 | + continue; |
1580 | + } |
1581 | + |
1582 | + dev = rose_dev_get(dest); |
1583 | + if (!dev) { |
1584 | + kfree_skb(skb); |
1585 | + continue; |
1586 | + } |
1587 | + |
1588 | + if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0) { |
1589 | + dev_put(dev); |
1590 | kfree_skb(skb); |
1591 | } |
1592 | } else { |
1593 | diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c |
1594 | index 7bee5ca336fac..9c3fbf4553cc7 100644 |
1595 | --- a/net/x25/af_x25.c |
1596 | +++ b/net/x25/af_x25.c |
1597 | @@ -679,7 +679,8 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
1598 | int len, i, rc = 0; |
1599 | |
1600 | if (addr_len != sizeof(struct sockaddr_x25) || |
1601 | - addr->sx25_family != AF_X25) { |
1602 | + addr->sx25_family != AF_X25 || |
1603 | + strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN) { |
1604 | rc = -EINVAL; |
1605 | goto out; |
1606 | } |
1607 | @@ -773,7 +774,8 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, |
1608 | |
1609 | rc = -EINVAL; |
1610 | if (addr_len != sizeof(struct sockaddr_x25) || |
1611 | - addr->sx25_family != AF_X25) |
1612 | + addr->sx25_family != AF_X25 || |
1613 | + strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN) |
1614 | goto out; |
1615 | |
1616 | rc = -ENETUNREACH; |
1617 | diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
1618 | index 184089c5e8cbc..6089ed6efc8dd 100644 |
1619 | --- a/sound/pci/hda/hda_generic.c |
1620 | +++ b/sound/pci/hda/hda_generic.c |
1621 | @@ -1327,16 +1327,20 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs, |
1622 | struct nid_path *path; |
1623 | hda_nid_t pin = pins[i]; |
1624 | |
1625 | - path = snd_hda_get_path_from_idx(codec, path_idx[i]); |
1626 | - if (path) { |
1627 | - badness += assign_out_path_ctls(codec, path); |
1628 | - continue; |
1629 | + if (!spec->obey_preferred_dacs) { |
1630 | + path = snd_hda_get_path_from_idx(codec, path_idx[i]); |
1631 | + if (path) { |
1632 | + badness += assign_out_path_ctls(codec, path); |
1633 | + continue; |
1634 | + } |
1635 | } |
1636 | |
1637 | dacs[i] = get_preferred_dac(codec, pin); |
1638 | if (dacs[i]) { |
1639 | if (is_dac_already_used(codec, dacs[i])) |
1640 | badness += bad->shared_primary; |
1641 | + } else if (spec->obey_preferred_dacs) { |
1642 | + badness += BAD_NO_PRIMARY_DAC; |
1643 | } |
1644 | |
1645 | if (!dacs[i]) |
1646 | diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h |
1647 | index 6d1cb2fb447d4..33e7eafd93b3d 100644 |
1648 | --- a/sound/pci/hda/hda_generic.h |
1649 | +++ b/sound/pci/hda/hda_generic.h |
1650 | @@ -229,6 +229,7 @@ struct hda_gen_spec { |
1651 | unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */ |
1652 | unsigned int power_down_unused:1; /* power down unused widgets */ |
1653 | unsigned int dac_min_mute:1; /* minimal = mute for DACs */ |
1654 | + unsigned int obey_preferred_dacs:1; /* obey preferred_dacs assignment */ |
1655 | |
1656 | /* other internal flags */ |
1657 | unsigned int no_analog:1; /* digital I/O only */ |
1658 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1659 | index df6d0211df515..73acdd43bdc93 100644 |
1660 | --- a/sound/pci/hda/patch_realtek.c |
1661 | +++ b/sound/pci/hda/patch_realtek.c |
1662 | @@ -380,6 +380,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) |
1663 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); |
1664 | break; |
1665 | case 0x10ec0892: |
1666 | + case 0x10ec0897: |
1667 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); |
1668 | break; |
1669 | case 0x10ec0899: |
1670 | @@ -7487,6 +7488,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { |
1671 | HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882), |
1672 | HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882), |
1673 | HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662), |
1674 | + HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662), |
1675 | HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882), |
1676 | HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882), |
1677 | {} /* terminator */ |
1678 | diff --git a/tools/objtool/arch/x86/include/asm/insn.h b/tools/objtool/arch/x86/include/asm/insn.h |
1679 | index b3e32b010ab19..b56241a446393 100644 |
1680 | --- a/tools/objtool/arch/x86/include/asm/insn.h |
1681 | +++ b/tools/objtool/arch/x86/include/asm/insn.h |
1682 | @@ -208,4 +208,19 @@ static inline int insn_offset_immediate(struct insn *insn) |
1683 | return insn_offset_displacement(insn) + insn->displacement.nbytes; |
1684 | } |
1685 | |
1686 | +/** |
1687 | + * for_each_insn_prefix() -- Iterate prefixes in the instruction |
1688 | + * @insn: Pointer to struct insn. |
1689 | + * @idx: Index storage. |
1690 | + * @prefix: Prefix byte. |
1691 | + * |
1692 | + * Iterate prefix bytes of given @insn. Each prefix byte is stored in @prefix |
1693 | + * and the index is stored in @idx (note that this @idx is just for a cursor, |
1694 | + * do not change it.) |
1695 | + * Since prefixes.nbytes can be bigger than 4 if some prefixes |
1696 | + * are repeated, it cannot be used for looping over the prefixes. |
1697 | + */ |
1698 | +#define for_each_insn_prefix(insn, idx, prefix) \ |
1699 | + for (idx = 0; idx < ARRAY_SIZE(insn->prefixes.bytes) && (prefix = insn->prefixes.bytes[idx]) != 0; idx++) |
1700 | + |
1701 | #endif /* _ASM_X86_INSN_H */ |