Magellan Linux

Contents of /trunk/kernel-magellan/patches-4.14/0101-4.14.2-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3028 - (show annotations) (download)
Tue Nov 28 13:16:20 2017 UTC (6 years, 5 months ago) by niro
File size: 19682 byte(s)
-linux-4.14.2
1 diff --git a/Makefile b/Makefile
2 index 01f9df1af256..75d89dc2b94a 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 4
8 PATCHLEVEL = 14
9 -SUBLEVEL = 1
10 +SUBLEVEL = 2
11 EXTRAVERSION =
12 NAME = Petit Gorille
13
14 diff --git a/block/bio.c b/block/bio.c
15 index 101c2a9b5481..33fa6b4af312 100644
16 --- a/block/bio.c
17 +++ b/block/bio.c
18 @@ -597,6 +597,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
19 * so we don't set nor calculate new physical/hw segment counts here
20 */
21 bio->bi_disk = bio_src->bi_disk;
22 + bio->bi_partno = bio_src->bi_partno;
23 bio_set_flag(bio, BIO_CLONED);
24 bio->bi_opf = bio_src->bi_opf;
25 bio->bi_write_hint = bio_src->bi_write_hint;
26 diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
27 index 810b138f5897..c82d9fd2f05a 100644
28 --- a/drivers/char/ipmi/ipmi_msghandler.c
29 +++ b/drivers/char/ipmi/ipmi_msghandler.c
30 @@ -4030,7 +4030,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
31 }
32
33 static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
34 - struct list_head *timeouts, long timeout_period,
35 + struct list_head *timeouts,
36 + unsigned long timeout_period,
37 int slot, unsigned long *flags,
38 unsigned int *waiting_msgs)
39 {
40 @@ -4043,8 +4044,8 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
41 if (!ent->inuse)
42 return;
43
44 - ent->timeout -= timeout_period;
45 - if (ent->timeout > 0) {
46 + if (timeout_period < ent->timeout) {
47 + ent->timeout -= timeout_period;
48 (*waiting_msgs)++;
49 return;
50 }
51 @@ -4110,7 +4111,8 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
52 }
53 }
54
55 -static unsigned int ipmi_timeout_handler(ipmi_smi_t intf, long timeout_period)
56 +static unsigned int ipmi_timeout_handler(ipmi_smi_t intf,
57 + unsigned long timeout_period)
58 {
59 struct list_head timeouts;
60 struct ipmi_recv_msg *msg, *msg2;
61 diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
62 index 36f47e8d06a3..bc3984ffe867 100644
63 --- a/drivers/char/ipmi/ipmi_si_intf.c
64 +++ b/drivers/char/ipmi/ipmi_si_intf.c
65 @@ -3424,7 +3424,7 @@ static inline void wait_for_timer_and_thread(struct smi_info *smi_info)
66 del_timer_sync(&smi_info->si_timer);
67 }
68
69 -static int is_new_interface(struct smi_info *info)
70 +static struct smi_info *find_dup_si(struct smi_info *info)
71 {
72 struct smi_info *e;
73
74 @@ -3439,24 +3439,36 @@ static int is_new_interface(struct smi_info *info)
75 */
76 if (info->slave_addr && !e->slave_addr)
77 e->slave_addr = info->slave_addr;
78 - return 0;
79 + return e;
80 }
81 }
82
83 - return 1;
84 + return NULL;
85 }
86
87 static int add_smi(struct smi_info *new_smi)
88 {
89 int rv = 0;
90 + struct smi_info *dup;
91
92 mutex_lock(&smi_infos_lock);
93 - if (!is_new_interface(new_smi)) {
94 - pr_info(PFX "%s-specified %s state machine: duplicate\n",
95 - ipmi_addr_src_to_str(new_smi->addr_source),
96 - si_to_str[new_smi->si_type]);
97 - rv = -EBUSY;
98 - goto out_err;
99 + dup = find_dup_si(new_smi);
100 + if (dup) {
101 + if (new_smi->addr_source == SI_ACPI &&
102 + dup->addr_source == SI_SMBIOS) {
103 + /* We prefer ACPI over SMBIOS. */
104 + dev_info(dup->dev,
105 + "Removing SMBIOS-specified %s state machine in favor of ACPI\n",
106 + si_to_str[new_smi->si_type]);
107 + cleanup_one_si(dup);
108 + } else {
109 + dev_info(new_smi->dev,
110 + "%s-specified %s state machine: duplicate\n",
111 + ipmi_addr_src_to_str(new_smi->addr_source),
112 + si_to_str[new_smi->si_type]);
113 + rv = -EBUSY;
114 + goto out_err;
115 + }
116 }
117
118 pr_info(PFX "Adding %s-specified %s state machine\n",
119 @@ -3865,7 +3877,8 @@ static void cleanup_one_si(struct smi_info *to_clean)
120 poll(to_clean);
121 schedule_timeout_uninterruptible(1);
122 }
123 - disable_si_irq(to_clean, false);
124 + if (to_clean->handlers)
125 + disable_si_irq(to_clean, false);
126 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
127 poll(to_clean);
128 schedule_timeout_uninterruptible(1);
129 diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c
130 index 610638a80383..461bf0b8a094 100644
131 --- a/drivers/char/tpm/tpm-dev-common.c
132 +++ b/drivers/char/tpm/tpm-dev-common.c
133 @@ -110,6 +110,12 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf,
134 return -EFAULT;
135 }
136
137 + if (in_size < 6 ||
138 + in_size < be32_to_cpu(*((__be32 *) (priv->data_buffer + 2)))) {
139 + mutex_unlock(&priv->buffer_mutex);
140 + return -EINVAL;
141 + }
142 +
143 /* atomic tpm command send and result receive. We only hold the ops
144 * lock during this period so that the tpm can be unregistered even if
145 * the char dev is held open.
146 diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
147 index e92859dab7ae..e191c4ebeaf4 100644
148 --- a/drivers/net/ethernet/fealnx.c
149 +++ b/drivers/net/ethernet/fealnx.c
150 @@ -257,8 +257,8 @@ enum rx_desc_status_bits {
151 RXFSD = 0x00000800, /* first descriptor */
152 RXLSD = 0x00000400, /* last descriptor */
153 ErrorSummary = 0x80, /* error summary */
154 - RUNT = 0x40, /* runt packet received */
155 - LONG = 0x20, /* long packet received */
156 + RUNTPKT = 0x40, /* runt packet received */
157 + LONGPKT = 0x20, /* long packet received */
158 FAE = 0x10, /* frame align error */
159 CRC = 0x08, /* crc error */
160 RXER = 0x04, /* receive error */
161 @@ -1632,7 +1632,7 @@ static int netdev_rx(struct net_device *dev)
162 dev->name, rx_status);
163
164 dev->stats.rx_errors++; /* end of a packet. */
165 - if (rx_status & (LONG | RUNT))
166 + if (rx_status & (LONGPKT | RUNTPKT))
167 dev->stats.rx_length_errors++;
168 if (rx_status & RXER)
169 dev->stats.rx_frame_errors++;
170 diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
171 index 47cab1bde065..9e1b74590682 100644
172 --- a/drivers/net/usb/cdc_ncm.c
173 +++ b/drivers/net/usb/cdc_ncm.c
174 @@ -771,7 +771,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
175 int err;
176 u8 iface_no;
177 struct usb_cdc_parsed_header hdr;
178 - u16 curr_ntb_format;
179 + __le16 curr_ntb_format;
180
181 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
182 if (!ctx)
183 @@ -889,7 +889,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
184 goto error2;
185 }
186
187 - if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
188 + if (curr_ntb_format == cpu_to_le16(USB_CDC_NCM_NTB32_FORMAT)) {
189 dev_info(&intf->dev, "resetting NTB format to 16-bit");
190 err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_FORMAT,
191 USB_TYPE_CLASS | USB_DIR_OUT
192 diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
193 index d7c49cf1d5e9..a2f4e52fadb5 100644
194 --- a/drivers/net/vxlan.c
195 +++ b/drivers/net/vxlan.c
196 @@ -1623,26 +1623,19 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
197 static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
198 {
199 struct vxlan_dev *vxlan = netdev_priv(dev);
200 - struct nd_msg *msg;
201 - const struct ipv6hdr *iphdr;
202 const struct in6_addr *daddr;
203 - struct neighbour *n;
204 + const struct ipv6hdr *iphdr;
205 struct inet6_dev *in6_dev;
206 + struct neighbour *n;
207 + struct nd_msg *msg;
208
209 in6_dev = __in6_dev_get(dev);
210 if (!in6_dev)
211 goto out;
212
213 - if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + sizeof(struct nd_msg)))
214 - goto out;
215 -
216 iphdr = ipv6_hdr(skb);
217 daddr = &iphdr->daddr;
218 -
219 msg = (struct nd_msg *)(iphdr + 1);
220 - if (msg->icmph.icmp6_code != 0 ||
221 - msg->icmph.icmp6_type != NDISC_NEIGHBOUR_SOLICITATION)
222 - goto out;
223
224 if (ipv6_addr_loopback(daddr) ||
225 ipv6_addr_is_multicast(&msg->target))
226 @@ -2240,11 +2233,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
227 static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
228 {
229 struct vxlan_dev *vxlan = netdev_priv(dev);
230 + struct vxlan_rdst *rdst, *fdst = NULL;
231 const struct ip_tunnel_info *info;
232 - struct ethhdr *eth;
233 bool did_rsc = false;
234 - struct vxlan_rdst *rdst, *fdst = NULL;
235 struct vxlan_fdb *f;
236 + struct ethhdr *eth;
237 __be32 vni = 0;
238
239 info = skb_tunnel_info(skb);
240 @@ -2269,12 +2262,14 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
241 if (ntohs(eth->h_proto) == ETH_P_ARP)
242 return arp_reduce(dev, skb, vni);
243 #if IS_ENABLED(CONFIG_IPV6)
244 - else if (ntohs(eth->h_proto) == ETH_P_IPV6) {
245 - struct ipv6hdr *hdr, _hdr;
246 - if ((hdr = skb_header_pointer(skb,
247 - skb_network_offset(skb),
248 - sizeof(_hdr), &_hdr)) &&
249 - hdr->nexthdr == IPPROTO_ICMPV6)
250 + else if (ntohs(eth->h_proto) == ETH_P_IPV6 &&
251 + pskb_may_pull(skb, sizeof(struct ipv6hdr) +
252 + sizeof(struct nd_msg)) &&
253 + ipv6_hdr(skb)->nexthdr == IPPROTO_ICMPV6) {
254 + struct nd_msg *m = (struct nd_msg *)(ipv6_hdr(skb) + 1);
255 +
256 + if (m->icmph.icmp6_code == 0 &&
257 + m->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION)
258 return neigh_reduce(dev, skb, vni);
259 }
260 #endif
261 diff --git a/drivers/tty/serial/8250/8250_fintek.c b/drivers/tty/serial/8250/8250_fintek.c
262 index e500f7dd2470..4bd376c08b59 100644
263 --- a/drivers/tty/serial/8250/8250_fintek.c
264 +++ b/drivers/tty/serial/8250/8250_fintek.c
265 @@ -118,6 +118,9 @@ static int fintek_8250_enter_key(u16 base_port, u8 key)
266 if (!request_muxed_region(base_port, 2, "8250_fintek"))
267 return -EBUSY;
268
269 + /* Force to deactive all SuperIO in this base_port */
270 + outb(EXIT_KEY, base_port + ADDR_PORT);
271 +
272 outb(key, base_port + ADDR_PORT);
273 outb(key, base_port + ADDR_PORT);
274 return 0;
275 diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
276 index 7754053deeda..26a22b100df1 100644
277 --- a/drivers/tty/serial/omap-serial.c
278 +++ b/drivers/tty/serial/omap-serial.c
279 @@ -693,7 +693,7 @@ static void serial_omap_set_mctrl(struct uart_port *port, unsigned int mctrl)
280 if ((mctrl & TIOCM_RTS) && (port->status & UPSTAT_AUTORTS))
281 up->efr |= UART_EFR_RTS;
282 else
283 - up->efr &= UART_EFR_RTS;
284 + up->efr &= ~UART_EFR_RTS;
285 serial_out(up, UART_EFR, up->efr);
286 serial_out(up, UART_LCR, lcr);
287
288 diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
289 index a37f003530d7..1175a1722411 100644
290 --- a/fs/coda/upcall.c
291 +++ b/fs/coda/upcall.c
292 @@ -447,8 +447,7 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
293 UPARG(CODA_FSYNC);
294
295 inp->coda_fsync.VFid = *fid;
296 - error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs),
297 - &outsize, inp);
298 + error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
299
300 CODA_FREE(inp, insize);
301 return error;
302 diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
303 index 74407c6dd592..ec8f75813beb 100644
304 --- a/fs/ocfs2/dlm/dlmrecovery.c
305 +++ b/fs/ocfs2/dlm/dlmrecovery.c
306 @@ -2419,6 +2419,7 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
307 dlm_lockres_put(res);
308 continue;
309 }
310 + dlm_move_lockres_to_recovery_list(dlm, res);
311 } else if (res->owner == dlm->node_num) {
312 dlm_free_dead_locks(dlm, res, dead_node);
313 __dlm_lockres_calc_usage(dlm, res);
314 diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
315 index 6e41fc8fabbe..dc455d45a66a 100644
316 --- a/fs/ocfs2/file.c
317 +++ b/fs/ocfs2/file.c
318 @@ -1161,6 +1161,13 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
319 }
320 size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE;
321 if (size_change) {
322 + /*
323 + * Here we should wait dio to finish before inode lock
324 + * to avoid a deadlock between ocfs2_setattr() and
325 + * ocfs2_dio_end_io_write()
326 + */
327 + inode_dio_wait(inode);
328 +
329 status = ocfs2_rw_lock(inode, 1);
330 if (status < 0) {
331 mlog_errno(status);
332 @@ -1200,8 +1207,6 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
333 if (status)
334 goto bail_unlock;
335
336 - inode_dio_wait(inode);
337 -
338 if (i_size_read(inode) >= attr->ia_size) {
339 if (ocfs2_should_order_data(inode)) {
340 status = ocfs2_begin_ordered_truncate(inode,
341 diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
342 index c9c4a81b9767..18b06983131a 100644
343 --- a/include/linux/mmzone.h
344 +++ b/include/linux/mmzone.h
345 @@ -700,7 +700,8 @@ typedef struct pglist_data {
346 * is the first PFN that needs to be initialised.
347 */
348 unsigned long first_deferred_pfn;
349 - unsigned long static_init_size;
350 + /* Number of non-deferred pages */
351 + unsigned long static_init_pgcnt;
352 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
353
354 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
355 diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
356 index e012b9be777e..fed95fa941e6 100644
357 --- a/kernel/rcu/tree_plugin.h
358 +++ b/kernel/rcu/tree_plugin.h
359 @@ -1507,7 +1507,7 @@ static void rcu_prepare_for_idle(void)
360 rdtp->last_accelerate = jiffies;
361 for_each_rcu_flavor(rsp) {
362 rdp = this_cpu_ptr(rsp->rda);
363 - if (rcu_segcblist_pend_cbs(&rdp->cblist))
364 + if (!rcu_segcblist_pend_cbs(&rdp->cblist))
365 continue;
366 rnp = rdp->mynode;
367 raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
368 diff --git a/mm/page_alloc.c b/mm/page_alloc.c
369 index 77e4d3c5c57b..82a6270c9743 100644
370 --- a/mm/page_alloc.c
371 +++ b/mm/page_alloc.c
372 @@ -290,28 +290,37 @@ EXPORT_SYMBOL(nr_online_nodes);
373 int page_group_by_mobility_disabled __read_mostly;
374
375 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
376 +
377 +/*
378 + * Determine how many pages need to be initialized durig early boot
379 + * (non-deferred initialization).
380 + * The value of first_deferred_pfn will be set later, once non-deferred pages
381 + * are initialized, but for now set it ULONG_MAX.
382 + */
383 static inline void reset_deferred_meminit(pg_data_t *pgdat)
384 {
385 - unsigned long max_initialise;
386 - unsigned long reserved_lowmem;
387 + phys_addr_t start_addr, end_addr;
388 + unsigned long max_pgcnt;
389 + unsigned long reserved;
390
391 /*
392 * Initialise at least 2G of a node but also take into account that
393 * two large system hashes that can take up 1GB for 0.25TB/node.
394 */
395 - max_initialise = max(2UL << (30 - PAGE_SHIFT),
396 - (pgdat->node_spanned_pages >> 8));
397 + max_pgcnt = max(2UL << (30 - PAGE_SHIFT),
398 + (pgdat->node_spanned_pages >> 8));
399
400 /*
401 * Compensate the all the memblock reservations (e.g. crash kernel)
402 * from the initial estimation to make sure we will initialize enough
403 * memory to boot.
404 */
405 - reserved_lowmem = memblock_reserved_memory_within(pgdat->node_start_pfn,
406 - pgdat->node_start_pfn + max_initialise);
407 - max_initialise += reserved_lowmem;
408 + start_addr = PFN_PHYS(pgdat->node_start_pfn);
409 + end_addr = PFN_PHYS(pgdat->node_start_pfn + max_pgcnt);
410 + reserved = memblock_reserved_memory_within(start_addr, end_addr);
411 + max_pgcnt += PHYS_PFN(reserved);
412
413 - pgdat->static_init_size = min(max_initialise, pgdat->node_spanned_pages);
414 + pgdat->static_init_pgcnt = min(max_pgcnt, pgdat->node_spanned_pages);
415 pgdat->first_deferred_pfn = ULONG_MAX;
416 }
417
418 @@ -338,7 +347,7 @@ static inline bool update_defer_init(pg_data_t *pgdat,
419 if (zone_end < pgdat_end_pfn(pgdat))
420 return true;
421 (*nr_initialised)++;
422 - if ((*nr_initialised > pgdat->static_init_size) &&
423 + if ((*nr_initialised > pgdat->static_init_pgcnt) &&
424 (pfn & (PAGES_PER_SECTION - 1)) == 0) {
425 pgdat->first_deferred_pfn = pfn;
426 return false;
427 diff --git a/mm/page_ext.c b/mm/page_ext.c
428 index 4f0367d472c4..2c16216c29b6 100644
429 --- a/mm/page_ext.c
430 +++ b/mm/page_ext.c
431 @@ -125,7 +125,6 @@ struct page_ext *lookup_page_ext(struct page *page)
432 struct page_ext *base;
433
434 base = NODE_DATA(page_to_nid(page))->node_page_ext;
435 -#if defined(CONFIG_DEBUG_VM)
436 /*
437 * The sanity checks the page allocator does upon freeing a
438 * page can reach here before the page_ext arrays are
439 @@ -134,7 +133,6 @@ struct page_ext *lookup_page_ext(struct page *page)
440 */
441 if (unlikely(!base))
442 return NULL;
443 -#endif
444 index = pfn - round_down(node_start_pfn(page_to_nid(page)),
445 MAX_ORDER_NR_PAGES);
446 return get_entry(base, index);
447 @@ -199,7 +197,6 @@ struct page_ext *lookup_page_ext(struct page *page)
448 {
449 unsigned long pfn = page_to_pfn(page);
450 struct mem_section *section = __pfn_to_section(pfn);
451 -#if defined(CONFIG_DEBUG_VM)
452 /*
453 * The sanity checks the page allocator does upon freeing a
454 * page can reach here before the page_ext arrays are
455 @@ -208,7 +205,6 @@ struct page_ext *lookup_page_ext(struct page *page)
456 */
457 if (!section->page_ext)
458 return NULL;
459 -#endif
460 return get_entry(section->page_ext, pfn);
461 }
462
463 diff --git a/mm/pagewalk.c b/mm/pagewalk.c
464 index 8bd4afa83cb8..23a3e415ac2c 100644
465 --- a/mm/pagewalk.c
466 +++ b/mm/pagewalk.c
467 @@ -188,8 +188,12 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
468 do {
469 next = hugetlb_entry_end(h, addr, end);
470 pte = huge_pte_offset(walk->mm, addr & hmask, sz);
471 - if (pte && walk->hugetlb_entry)
472 +
473 + if (pte)
474 err = walk->hugetlb_entry(pte, hmask, addr, next, walk);
475 + else if (walk->pte_hole)
476 + err = walk->pte_hole(addr, next, walk);
477 +
478 if (err)
479 break;
480 } while (addr = next, addr != end);
481 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
482 index b93148e8e9fb..15c99dfa3d72 100644
483 --- a/net/netlink/af_netlink.c
484 +++ b/net/netlink/af_netlink.c
485 @@ -2136,7 +2136,7 @@ static int netlink_dump(struct sock *sk)
486 struct sk_buff *skb = NULL;
487 struct nlmsghdr *nlh;
488 struct module *module;
489 - int len, err = -ENOBUFS;
490 + int err = -ENOBUFS;
491 int alloc_min_size;
492 int alloc_size;
493
494 @@ -2183,9 +2183,11 @@ static int netlink_dump(struct sock *sk)
495 skb_reserve(skb, skb_tailroom(skb) - alloc_size);
496 netlink_skb_set_owner_r(skb, sk);
497
498 - len = cb->dump(skb, cb);
499 + if (nlk->dump_done_errno > 0)
500 + nlk->dump_done_errno = cb->dump(skb, cb);
501
502 - if (len > 0) {
503 + if (nlk->dump_done_errno > 0 ||
504 + skb_tailroom(skb) < nlmsg_total_size(sizeof(nlk->dump_done_errno))) {
505 mutex_unlock(nlk->cb_mutex);
506
507 if (sk_filter(sk, skb))
508 @@ -2195,13 +2197,15 @@ static int netlink_dump(struct sock *sk)
509 return 0;
510 }
511
512 - nlh = nlmsg_put_answer(skb, cb, NLMSG_DONE, sizeof(len), NLM_F_MULTI);
513 - if (!nlh)
514 + nlh = nlmsg_put_answer(skb, cb, NLMSG_DONE,
515 + sizeof(nlk->dump_done_errno), NLM_F_MULTI);
516 + if (WARN_ON(!nlh))
517 goto errout_skb;
518
519 nl_dump_check_consistent(cb, nlh);
520
521 - memcpy(nlmsg_data(nlh), &len, sizeof(len));
522 + memcpy(nlmsg_data(nlh), &nlk->dump_done_errno,
523 + sizeof(nlk->dump_done_errno));
524
525 if (sk_filter(sk, skb))
526 kfree_skb(skb);
527 @@ -2273,6 +2277,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
528 }
529
530 nlk->cb_running = true;
531 + nlk->dump_done_errno = INT_MAX;
532
533 mutex_unlock(nlk->cb_mutex);
534
535 diff --git a/net/netlink/af_netlink.h b/net/netlink/af_netlink.h
536 index 028188597eaa..962de7b3c023 100644
537 --- a/net/netlink/af_netlink.h
538 +++ b/net/netlink/af_netlink.h
539 @@ -34,6 +34,7 @@ struct netlink_sock {
540 wait_queue_head_t wait;
541 bool bound;
542 bool cb_running;
543 + int dump_done_errno;
544 struct netlink_callback cb;
545 struct mutex *cb_mutex;
546 struct mutex cb_def_mutex;
547 diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
548 index a6dfa86c0201..3b18085e3b10 100644
549 --- a/net/sctp/ipv6.c
550 +++ b/net/sctp/ipv6.c
551 @@ -807,9 +807,10 @@ static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname,
552 addr->v6.sin6_flowinfo = 0;
553 addr->v6.sin6_port = sh->source;
554 addr->v6.sin6_addr = ipv6_hdr(skb)->saddr;
555 - if (ipv6_addr_type(&addr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) {
556 + if (ipv6_addr_type(&addr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
557 addr->v6.sin6_scope_id = sctp_v6_skb_iif(skb);
558 - }
559 + else
560 + addr->v6.sin6_scope_id = 0;
561 }
562
563 *addr_len = sctp_v6_addr_to_user(sctp_sk(skb->sk), addr);
564 diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
565 index 809ba70fbbbf..7d769b948de8 100644
566 --- a/security/integrity/ima/ima_appraise.c
567 +++ b/security/integrity/ima/ima_appraise.c
568 @@ -320,6 +320,9 @@ void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
569 if (iint->flags & IMA_DIGSIG)
570 return;
571
572 + if (iint->ima_file_status != INTEGRITY_PASS)
573 + return;
574 +
575 rc = ima_collect_measurement(iint, file, NULL, 0, ima_hash_algo);
576 if (rc < 0)
577 return;