diff options
author | Mike Pagano <mpagano@gentoo.org> | 2020-02-04 13:47:17 -0500 |
---|---|---|
committer | Mike Pagano <mpagano@gentoo.org> | 2020-02-04 13:47:17 -0500 |
commit | 4c1e450a7187e3b4f37da18101df940780949972 (patch) | |
tree | 90a9ac32d6d2dbc1562bf7b1a45f98c8ffd3bc00 | |
parent | Linux patch 5.5.1 (diff) | |
download | linux-patches-4c1e450a7187e3b4f37da18101df940780949972.tar.gz linux-patches-4c1e450a7187e3b4f37da18101df940780949972.tar.bz2 linux-patches-4c1e450a7187e3b4f37da18101df940780949972.zip |
Fix patch name. Add Linux 5.5.25.5-3
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1000_linux-5.5.1.patch (renamed from 1001_linux-5.5.1.patch) | 0 | ||||
-rw-r--r-- | 1001_linux-5.5.2.patch | 807 |
3 files changed, 811 insertions, 0 deletions
diff --git a/0000_README b/0000_README index b1a233d1..65e90137 100644 --- a/0000_README +++ b/0000_README @@ -47,6 +47,10 @@ Patch: 1000_linux-5.5.1.patch From: http://www.kernel.org Desc: Linux 5.5.1 +Patch: 1001_linux-5.5.2.patch +From: http://www.kernel.org +Desc: Linux 5.5.2 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1001_linux-5.5.1.patch b/1000_linux-5.5.1.patch index b3d73e1b..b3d73e1b 100644 --- a/1001_linux-5.5.1.patch +++ b/1000_linux-5.5.1.patch diff --git a/1001_linux-5.5.2.patch b/1001_linux-5.5.2.patch new file mode 100644 index 00000000..2e099da3 --- /dev/null +++ b/1001_linux-5.5.2.patch @@ -0,0 +1,807 @@ +diff --git a/Documentation/ABI/testing/sysfs-class-devfreq b/Documentation/ABI/testing/sysfs-class-devfreq +index 01196e19afca..75897e2fde43 100644 +--- a/Documentation/ABI/testing/sysfs-class-devfreq ++++ b/Documentation/ABI/testing/sysfs-class-devfreq +@@ -7,6 +7,13 @@ Description: + The name of devfreq object denoted as ... is same as the + name of device using devfreq. + ++What: /sys/class/devfreq/.../name ++Date: November 2019 ++Contact: Chanwoo Choi <cw00.choi@samsung.com> ++Description: ++ The /sys/class/devfreq/.../name shows the name of device ++ of the corresponding devfreq object. ++ + What: /sys/class/devfreq/.../governor + Date: September 2011 + Contact: MyungJoo Ham <myungjoo.ham@samsung.com> +diff --git a/Makefile b/Makefile +index ec2caaef8b2d..cfbdf5f920fd 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 5 +-SUBLEVEL = 1 ++SUBLEVEL = 2 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile +index 1f012c506434..cd3414898d10 100644 +--- a/arch/arm64/boot/Makefile ++++ b/arch/arm64/boot/Makefile +@@ -16,7 +16,7 @@ + + OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S + +-targets := Image Image.gz ++targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo + + $(obj)/Image: vmlinux FORCE + $(call if_changed,objcopy) +diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c +index ce4fcf76e53e..eb86a2f26986 100644 +--- a/arch/powerpc/kvm/book3s_pr.c ++++ b/arch/powerpc/kvm/book3s_pr.c +@@ -2030,6 +2030,7 @@ static int kvm_vm_ioctl_get_smmu_info_pr(struct kvm *kvm, + { + /* We should not get called */ + BUG(); ++ return 0; + } + #endif /* CONFIG_PPC64 */ + +diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +index dac7209a0708..954fd048ad9b 100644 +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +@@ -1970,7 +1970,7 @@ static int rdt_get_tree(struct fs_context *fc) + + if (rdt_mon_capable) { + ret = mongroup_create_dir(rdtgroup_default.kn, +- NULL, "mon_groups", ++ &rdtgroup_default, "mon_groups", + &kn_mongrp); + if (ret < 0) + goto out_info; +@@ -2205,7 +2205,11 @@ static void free_all_child_rdtgrp(struct rdtgroup *rdtgrp) + list_for_each_entry_safe(sentry, stmp, head, mon.crdtgrp_list) { + free_rmid(sentry->mon.rmid); + list_del(&sentry->mon.crdtgrp_list); +- kfree(sentry); ++ ++ if (atomic_read(&sentry->waitcount) != 0) ++ sentry->flags = RDT_DELETED; ++ else ++ kfree(sentry); + } + } + +@@ -2243,7 +2247,11 @@ static void rmdir_all_sub(void) + + kernfs_remove(rdtgrp->kn); + list_del(&rdtgrp->rdtgroup_list); +- kfree(rdtgrp); ++ ++ if (atomic_read(&rdtgrp->waitcount) != 0) ++ rdtgrp->flags = RDT_DELETED; ++ else ++ kfree(rdtgrp); + } + /* Notify online CPUs to update per cpu storage and PQR_ASSOC MSR */ + update_closid_rmid(cpu_online_mask, &rdtgroup_default); +@@ -2446,7 +2454,7 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, + /* + * Create the mon_data directory first. + */ +- ret = mongroup_create_dir(parent_kn, NULL, "mon_data", &kn); ++ ret = mongroup_create_dir(parent_kn, prgrp, "mon_data", &kn); + if (ret) + return ret; + +@@ -2645,7 +2653,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, + uint files = 0; + int ret; + +- prdtgrp = rdtgroup_kn_lock_live(prgrp_kn); ++ prdtgrp = rdtgroup_kn_lock_live(parent_kn); + if (!prdtgrp) { + ret = -ENODEV; + goto out_unlock; +@@ -2718,7 +2726,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, + kernfs_activate(kn); + + /* +- * The caller unlocks the prgrp_kn upon success. ++ * The caller unlocks the parent_kn upon success. + */ + return 0; + +@@ -2729,7 +2737,7 @@ out_destroy: + out_free_rgrp: + kfree(rdtgrp); + out_unlock: +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2767,7 +2775,7 @@ static int rdtgroup_mkdir_mon(struct kernfs_node *parent_kn, + */ + list_add_tail(&rdtgrp->mon.crdtgrp_list, &prgrp->mon.crdtgrp_list); + +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2810,7 +2818,7 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn, + * Create an empty mon_groups directory to hold the subset + * of tasks and cpus to monitor. + */ +- ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL); ++ ret = mongroup_create_dir(kn, rdtgrp, "mon_groups", NULL); + if (ret) { + rdt_last_cmd_puts("kernfs subdir error\n"); + goto out_del_list; +@@ -2826,7 +2834,7 @@ out_id_free: + out_common_fail: + mkdir_rdt_prepare_clean(rdtgrp); + out_unlock: +- rdtgroup_kn_unlock(prgrp_kn); ++ rdtgroup_kn_unlock(parent_kn); + return ret; + } + +@@ -2952,13 +2960,13 @@ static int rdtgroup_rmdir_ctrl(struct kernfs_node *kn, struct rdtgroup *rdtgrp, + closid_free(rdtgrp->closid); + free_rmid(rdtgrp->mon.rmid); + ++ rdtgroup_ctrl_remove(kn, rdtgrp); ++ + /* + * Free all the child monitor group rmids. + */ + free_all_child_rdtgrp(rdtgrp); + +- rdtgroup_ctrl_remove(kn, rdtgrp); +- + return 0; + } + +diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c +index 4f24e46ebe7c..56db949a7b70 100644 +--- a/drivers/char/ttyprintk.c ++++ b/drivers/char/ttyprintk.c +@@ -15,10 +15,11 @@ + #include <linux/serial.h> + #include <linux/tty.h> + #include <linux/module.h> ++#include <linux/spinlock.h> + + struct ttyprintk_port { + struct tty_port port; +- struct mutex port_write_mutex; ++ spinlock_t spinlock; + }; + + static struct ttyprintk_port tpk_port; +@@ -99,11 +100,12 @@ static int tpk_open(struct tty_struct *tty, struct file *filp) + static void tpk_close(struct tty_struct *tty, struct file *filp) + { + struct ttyprintk_port *tpkp = tty->driver_data; ++ unsigned long flags; + +- mutex_lock(&tpkp->port_write_mutex); ++ spin_lock_irqsave(&tpkp->spinlock, flags); + /* flush tpk_printk buffer */ + tpk_printk(NULL, 0); +- mutex_unlock(&tpkp->port_write_mutex); ++ spin_unlock_irqrestore(&tpkp->spinlock, flags); + + tty_port_close(&tpkp->port, tty, filp); + } +@@ -115,13 +117,14 @@ static int tpk_write(struct tty_struct *tty, + const unsigned char *buf, int count) + { + struct ttyprintk_port *tpkp = tty->driver_data; ++ unsigned long flags; + int ret; + + + /* exclusive use of tpk_printk within this tty */ +- mutex_lock(&tpkp->port_write_mutex); ++ spin_lock_irqsave(&tpkp->spinlock, flags); + ret = tpk_printk(buf, count); +- mutex_unlock(&tpkp->port_write_mutex); ++ spin_unlock_irqrestore(&tpkp->spinlock, flags); + + return ret; + } +@@ -171,7 +174,7 @@ static int __init ttyprintk_init(void) + { + int ret = -ENOMEM; + +- mutex_init(&tpk_port.port_write_mutex); ++ spin_lock_init(&tpk_port.spinlock); + + ttyprintk_driver = tty_alloc_driver(1, + TTY_DRIVER_RESET_TERMIOS | +diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c +index 57f6944d65a6..07602083c743 100644 +--- a/drivers/devfreq/devfreq.c ++++ b/drivers/devfreq/devfreq.c +@@ -1259,6 +1259,14 @@ err_out: + } + EXPORT_SYMBOL(devfreq_remove_governor); + ++static ssize_t name_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct devfreq *devfreq = to_devfreq(dev); ++ return sprintf(buf, "%s\n", dev_name(devfreq->dev.parent)); ++} ++static DEVICE_ATTR_RO(name); ++ + static ssize_t governor_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -1592,6 +1600,7 @@ static ssize_t trans_stat_show(struct device *dev, + static DEVICE_ATTR_RO(trans_stat); + + static struct attribute *devfreq_attrs[] = { ++ &dev_attr_name.attr, + &dev_attr_governor.attr, + &dev_attr_available_governors.attr, + &dev_attr_cur_freq.attr, +diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c +index ac93e88d7038..89b4b5d84cdf 100644 +--- a/drivers/media/usb/dvb-usb/af9005.c ++++ b/drivers/media/usb/dvb-usb/af9005.c +@@ -554,7 +554,7 @@ static int af9005_boot_packet(struct usb_device *udev, int type, u8 *reply, + u8 *buf, int size) + { + u16 checksum; +- int act_len, i, ret; ++ int act_len = 0, i, ret; + + memset(buf, 0, size); + buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff); +diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c +index dd5bb230cec1..99a39339d45d 100644 +--- a/drivers/media/usb/dvb-usb/digitv.c ++++ b/drivers/media/usb/dvb-usb/digitv.c +@@ -230,18 +230,22 @@ static struct rc_map_table rc_map_digitv_table[] = { + + static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) + { +- int i; ++ int ret, i; + u8 key[5]; + u8 b[4] = { 0 }; + + *event = 0; + *state = REMOTE_NO_KEY_PRESSED; + +- digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); ++ ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4); ++ if (ret) ++ return ret; + + /* Tell the device we've read the remote. Not sure how necessary + this is, but the Nebula SDK does it. */ +- digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); ++ ret = digitv_ctrl_msg(d, USB_WRITE_REMOTE, 0, b, 4, NULL, 0); ++ if (ret) ++ return ret; + + /* if something is inside the buffer, simulate key press */ + if (key[1] != 0) +diff --git a/drivers/media/usb/dvb-usb/dvb-usb-urb.c b/drivers/media/usb/dvb-usb/dvb-usb-urb.c +index c1b4e94a37f8..2aabf90d8697 100644 +--- a/drivers/media/usb/dvb-usb/dvb-usb-urb.c ++++ b/drivers/media/usb/dvb-usb/dvb-usb-urb.c +@@ -12,7 +12,7 @@ + int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, + u16 rlen, int delay_ms) + { +- int actlen,ret = -ENOMEM; ++ int actlen = 0, ret = -ENOMEM; + + if (!d || wbuf == NULL || wlen == 0) + return -EINVAL; +diff --git a/drivers/media/usb/dvb-usb/vp7045.c b/drivers/media/usb/dvb-usb/vp7045.c +index 80c1cf05384b..2baf57216d19 100644 +--- a/drivers/media/usb/dvb-usb/vp7045.c ++++ b/drivers/media/usb/dvb-usb/vp7045.c +@@ -96,10 +96,14 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) + + static int vp7045_rc_query(struct dvb_usb_device *d) + { ++ int ret; + u8 key; +- vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); + +- deb_rc("remote query key: %x %d\n",key,key); ++ ret = vp7045_usb_op(d, RC_VAL_READ, NULL, 0, &key, 1, 20); ++ if (ret) ++ return ret; ++ ++ deb_rc("remote query key: %x\n", key); + + if (key != 0x44) { + /* +@@ -115,15 +119,18 @@ static int vp7045_rc_query(struct dvb_usb_device *d) + + static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) + { +- int i = 0; +- u8 v,br[2]; ++ int i, ret; ++ u8 v, br[2]; + for (i=0; i < len; i++) { + v = offset + i; +- vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); ++ ret = vp7045_usb_op(d, GET_EE_VALUE, &v, 1, br, 2, 5); ++ if (ret) ++ return ret; ++ + buf[i] = br[1]; + } +- deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); +- debug_dump(buf,i,deb_info); ++ deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ", offset, i); ++ debug_dump(buf, i, deb_info); + return 0; + } + +diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c +index 4add2b12d330..c1b307bbe540 100644 +--- a/drivers/media/usb/gspca/gspca.c ++++ b/drivers/media/usb/gspca/gspca.c +@@ -1461,7 +1461,7 @@ int gspca_dev_probe2(struct usb_interface *intf, + pr_err("couldn't kzalloc gspca struct\n"); + return -ENOMEM; + } +- gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL); ++ gspca_dev->usb_buf = kzalloc(USB_BUF_SZ, GFP_KERNEL); + if (!gspca_dev->usb_buf) { + pr_err("out of memory\n"); + ret = -ENOMEM; +diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c +index f452a94abdc3..6ccfef72d0e1 100644 +--- a/fs/btrfs/super.c ++++ b/fs/btrfs/super.c +@@ -2104,7 +2104,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) + */ + thresh = SZ_4M; + +- if (!mixed && total_free_meta - thresh < block_rsv->size) ++ /* ++ * We only want to claim there's no available space if we can no longer ++ * allocate chunks for our metadata profile and our global reserve will ++ * not fit in the free metadata space. If we aren't ->full then we ++ * still can allocate chunks and thus are fine using the currently ++ * calculated f_bavail. ++ */ ++ if (!mixed && block_rsv->space_info->full && ++ total_free_meta - thresh < block_rsv->size) + buf->f_bavail = 0; + + buf->f_type = BTRFS_SUPER_MAGIC; +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c +index 9434f6dd8df3..de254369c554 100644 +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) + if (server->tcpStatus != CifsNeedReconnect) + break; + +- if (--retries) ++ if (retries && --retries) + continue; + + /* +diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c +index 55fed7daf2b1..aa0359b7e2ac 100644 +--- a/fs/gfs2/lops.c ++++ b/fs/gfs2/lops.c +@@ -259,7 +259,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, + struct super_block *sb = sdp->sd_vfs; + struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES); + +- bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9); ++ bio->bi_iter.bi_sector = blkno << (sb->s_blocksize_bits - 9); + bio_set_dev(bio, sb->s_bdev); + bio->bi_end_io = end_io; + bio->bi_private = sdp; +@@ -472,6 +472,20 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index, + put_page(page); /* Once more for find_or_create_page */ + } + ++static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs) ++{ ++ struct bio *new; ++ ++ new = bio_alloc(GFP_NOIO, nr_iovecs); ++ bio_copy_dev(new, prev); ++ new->bi_iter.bi_sector = bio_end_sector(prev); ++ new->bi_opf = prev->bi_opf; ++ new->bi_write_hint = prev->bi_write_hint; ++ bio_chain(new, prev); ++ submit_bio(prev); ++ return new; ++} ++ + /** + * gfs2_find_jhead - find the head of a log + * @jd: The journal descriptor +@@ -488,15 +502,15 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); + struct address_space *mapping = jd->jd_inode->i_mapping; + unsigned int block = 0, blocks_submitted = 0, blocks_read = 0; +- unsigned int bsize = sdp->sd_sb.sb_bsize; ++ unsigned int bsize = sdp->sd_sb.sb_bsize, off; + unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; + unsigned int shift = PAGE_SHIFT - bsize_shift; +- unsigned int readhead_blocks = BIO_MAX_PAGES << shift; ++ unsigned int readahead_blocks = BIO_MAX_PAGES << shift; + struct gfs2_journal_extent *je; + int sz, ret = 0; + struct bio *bio = NULL; + struct page *page = NULL; +- bool done = false; ++ bool bio_chained = false, done = false; + errseq_t since; + + memset(head, 0, sizeof(*head)); +@@ -505,9 +519,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + + since = filemap_sample_wb_err(mapping); + list_for_each_entry(je, &jd->extent_list, list) { +- for (; block < je->lblock + je->blocks; block++) { +- u64 dblock; ++ u64 dblock = je->dblock; + ++ for (; block < je->lblock + je->blocks; block++, dblock++) { + if (!page) { + page = find_or_create_page(mapping, + block >> shift, GFP_NOFS); +@@ -516,35 +530,41 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, + done = true; + goto out; + } ++ off = 0; + } + +- if (bio) { +- unsigned int off; +- +- off = (block << bsize_shift) & ~PAGE_MASK; ++ if (!bio || (bio_chained && !off)) { ++ /* start new bio */ ++ } else { + sz = bio_add_page(bio, page, bsize, off); +- if (sz == bsize) { /* block added */ +- if (off + bsize == PAGE_SIZE) { +- page = NULL; +- goto page_added; +- } +- continue; ++ if (sz == bsize) ++ goto block_added; ++ if (off) { ++ unsigned int blocks = ++ (PAGE_SIZE - off) >> bsize_shift; ++ ++ bio = gfs2_chain_bio(bio, blocks); ++ bio_chained = true; ++ goto add_block_to_new_bio; + } ++ } ++ ++ if (bio) { + blocks_submitted = block + 1; + submit_bio(bio); +- bio = NULL; + } + +- dblock = je->dblock + (block - je->lblock); + bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read); + bio->bi_opf = REQ_OP_READ; +- sz = bio_add_page(bio, page, bsize, 0); +- gfs2_assert_warn(sdp, sz == bsize); +- if (bsize == PAGE_SIZE) ++ bio_chained = false; ++add_block_to_new_bio: ++ sz = bio_add_page(bio, page, bsize, off); ++ BUG_ON(sz != bsize); ++block_added: ++ off += bsize; ++ if (off == PAGE_SIZE) + page = NULL; +- +-page_added: +- if (blocks_submitted < blocks_read + readhead_blocks) { ++ if (blocks_submitted < blocks_read + readahead_blocks) { + /* Keep at least one bio in flight */ + continue; + } +diff --git a/fs/namei.c b/fs/namei.c +index 4fb61e0754ed..6cc88b6d68c8 100644 +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -3202,8 +3202,8 @@ static int do_last(struct nameidata *nd, + struct file *file, const struct open_flags *op) + { + struct dentry *dir = nd->path.dentry; +- kuid_t dir_uid = dir->d_inode->i_uid; +- umode_t dir_mode = dir->d_inode->i_mode; ++ kuid_t dir_uid = nd->inode->i_uid; ++ umode_t dir_mode = nd->inode->i_mode; + int open_flag = op->open_flag; + bool will_truncate = (open_flag & O_TRUNC) != 0; + bool got_write = false; +diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c +index 3244037b1286..d127af64283e 100644 +--- a/fs/reiserfs/super.c ++++ b/fs/reiserfs/super.c +@@ -629,6 +629,7 @@ static void reiserfs_put_super(struct super_block *s) + reiserfs_write_unlock(s); + mutex_destroy(&REISERFS_SB(s)->lock); + destroy_workqueue(REISERFS_SB(s)->commit_wq); ++ kfree(REISERFS_SB(s)->s_jdev); + kfree(s->s_fs_info); + s->s_fs_info = NULL; + } +@@ -2240,6 +2241,7 @@ error_unlocked: + kfree(qf_names[j]); + } + #endif ++ kfree(sbi->s_jdev); + kfree(sbi); + + s->s_fs_info = NULL; +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index 735af8f15f95..1e12e6928bca 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -3055,8 +3055,6 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp) + for_each_subsys(ss, ssid) { + struct cgroup_subsys_state *css = cgroup_css(dsct, ss); + +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt)); +- + if (!(cgroup_ss_mask(dsct) & (1 << ss->id))) + continue; + +@@ -3066,6 +3064,8 @@ static int cgroup_apply_control_enable(struct cgroup *cgrp) + return PTR_ERR(css); + } + ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt)); ++ + if (css_visible(css)) { + ret = css_populate_dir(css); + if (ret) +@@ -3101,11 +3101,11 @@ static void cgroup_apply_control_disable(struct cgroup *cgrp) + for_each_subsys(ss, ssid) { + struct cgroup_subsys_state *css = cgroup_css(dsct, ss); + +- WARN_ON_ONCE(css && percpu_ref_is_dying(&css->refcnt)); +- + if (!css) + continue; + ++ WARN_ON_ONCE(percpu_ref_is_dying(&css->refcnt)); ++ + if (css->parent && + !(cgroup_ss_mask(dsct) & (1 << ss->id))) { + kill_css(css); +@@ -3392,7 +3392,8 @@ static ssize_t cgroup_type_write(struct kernfs_open_file *of, char *buf, + if (strcmp(strstrip(buf), "threaded")) + return -EINVAL; + +- cgrp = cgroup_kn_lock_live(of->kn, false); ++ /* drain dying csses before we re-apply (threaded) subtree control */ ++ cgrp = cgroup_kn_lock_live(of->kn, true); + if (!cgrp) + return -ENOENT; + +diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c +index e14a15ac250b..71ec3afe1681 100644 +--- a/lib/test_bitmap.c ++++ b/lib/test_bitmap.c +@@ -275,22 +275,23 @@ static void __init test_copy(void) + static void __init test_replace(void) + { + unsigned int nbits = 64; ++ unsigned int nlongs = DIV_ROUND_UP(nbits, BITS_PER_LONG); + DECLARE_BITMAP(bmap, 1024); + + bitmap_zero(bmap, 1024); +- bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits); ++ bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); + expect_eq_bitmap(bmap, exp3_0_1, nbits); + + bitmap_zero(bmap, 1024); +- bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits); ++ bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); + expect_eq_bitmap(bmap, exp3_1_0, nbits); + + bitmap_fill(bmap, 1024); +- bitmap_replace(bmap, &exp2[0], &exp2[1], exp2_to_exp3_mask, nbits); ++ bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); + expect_eq_bitmap(bmap, exp3_0_1, nbits); + + bitmap_fill(bmap, 1024); +- bitmap_replace(bmap, &exp2[1], &exp2[0], exp2_to_exp3_mask, nbits); ++ bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); + expect_eq_bitmap(bmap, exp3_1_0, nbits); + } + +diff --git a/mm/mempolicy.c b/mm/mempolicy.c +index b2920ae87a61..977c641f78cf 100644 +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2821,6 +2821,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) + char *flags = strchr(str, '='); + int err = 1, mode; + ++ if (flags) ++ *flags++ = '\0'; /* terminate mode string */ ++ + if (nodelist) { + /* NUL-terminate mode or flags string */ + *nodelist++ = '\0'; +@@ -2831,9 +2834,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol) + } else + nodes_clear(nodes); + +- if (flags) +- *flags++ = '\0'; /* terminate mode string */ +- + mode = match_string(policy_modes, MPOL_MAX, str); + if (mode < 0) + goto out; +diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c +index 5d0ed28c0d3a..c86598ff4283 100644 +--- a/net/bluetooth/hci_sock.c ++++ b/net/bluetooth/hci_sock.c +@@ -831,6 +831,8 @@ static int hci_sock_release(struct socket *sock) + if (!sk) + return 0; + ++ lock_sock(sk); ++ + switch (hci_pi(sk)->channel) { + case HCI_CHANNEL_MONITOR: + atomic_dec(&monitor_promisc); +@@ -878,6 +880,7 @@ static int hci_sock_release(struct socket *sock) + skb_queue_purge(&sk->sk_receive_queue); + skb_queue_purge(&sk->sk_write_queue); + ++ release_sock(sk); + sock_put(sk); + return 0; + } +diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c +index c36bafbcd77e..1b467381986f 100644 +--- a/security/tomoyo/common.c ++++ b/security/tomoyo/common.c +@@ -2322,9 +2322,9 @@ static const char * const tomoyo_memory_headers[TOMOYO_MAX_MEMORY_STAT] = { + [TOMOYO_MEMORY_QUERY] = "query message:", + }; + +-/* Timestamp counter for last updated. */ +-static unsigned int tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT]; + /* Counter for number of updates. */ ++static atomic_t tomoyo_stat_updated[TOMOYO_MAX_POLICY_STAT]; ++/* Timestamp counter for last updated. */ + static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; + + /** +@@ -2336,10 +2336,7 @@ static time64_t tomoyo_stat_modified[TOMOYO_MAX_POLICY_STAT]; + */ + void tomoyo_update_stat(const u8 index) + { +- /* +- * I don't use atomic operations because race condition is not fatal. +- */ +- tomoyo_stat_updated[index]++; ++ atomic_inc(&tomoyo_stat_updated[index]); + tomoyo_stat_modified[index] = ktime_get_real_seconds(); + } + +@@ -2360,7 +2357,7 @@ static void tomoyo_read_stat(struct tomoyo_io_buffer *head) + for (i = 0; i < TOMOYO_MAX_POLICY_STAT; i++) { + tomoyo_io_printf(head, "Policy %-30s %10u", + tomoyo_policy_headers[i], +- tomoyo_stat_updated[i]); ++ atomic_read(&tomoyo_stat_updated[i])); + if (tomoyo_stat_modified[i]) { + struct tomoyo_time stamp; + +diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h +index 980cb9266718..5e9e781905ed 100644 +--- a/tools/include/linux/string.h ++++ b/tools/include/linux/string.h +@@ -17,7 +17,15 @@ int strtobool(const char *s, bool *res); + * However uClibc headers also define __GLIBC__ hence the hack below + */ + #if defined(__GLIBC__) && !defined(__UCLIBC__) ++// pragma diagnostic was introduced in gcc 4.6 ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wredundant-decls" ++#endif + extern size_t strlcpy(char *dest, const char *src, size_t size); ++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) ++#pragma GCC diagnostic pop ++#endif + #endif + + char *str_error_r(int errnum, char *buf, size_t buflen); +diff --git a/tools/lib/string.c b/tools/lib/string.c +index f2ae1b87c719..f645343815de 100644 +--- a/tools/lib/string.c ++++ b/tools/lib/string.c +@@ -96,6 +96,10 @@ int strtobool(const char *s, bool *res) + * If libc has strlcpy() then that version will override this + * implementation: + */ ++#ifdef __clang__ ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Wignored-attributes" ++#endif + size_t __weak strlcpy(char *dest, const char *src, size_t size) + { + size_t ret = strlen(src); +@@ -107,6 +111,9 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size) + } + return ret; + } ++#ifdef __clang__ ++#pragma clang diagnostic pop ++#endif + + /** + * skip_spaces - Removes leading whitespace from @str. +diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c +index e69f44941aad..f2e9d2b1b913 100644 +--- a/tools/perf/builtin-c2c.c ++++ b/tools/perf/builtin-c2c.c +@@ -595,8 +595,8 @@ tot_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + { + struct c2c_hist_entry *c2c_left; + struct c2c_hist_entry *c2c_right; +- unsigned int tot_hitm_left; +- unsigned int tot_hitm_right; ++ uint64_t tot_hitm_left; ++ uint64_t tot_hitm_right; + + c2c_left = container_of(left, struct c2c_hist_entry, he); + c2c_right = container_of(right, struct c2c_hist_entry, he); +@@ -629,7 +629,8 @@ __f ## _cmp(struct perf_hpp_fmt *fmt __maybe_unused, \ + \ + c2c_left = container_of(left, struct c2c_hist_entry, he); \ + c2c_right = container_of(right, struct c2c_hist_entry, he); \ +- return c2c_left->stats.__f - c2c_right->stats.__f; \ ++ return (uint64_t) c2c_left->stats.__f - \ ++ (uint64_t) c2c_right->stats.__f; \ + } + + #define STAT_FN(__f) \ +@@ -682,7 +683,8 @@ ld_llcmiss_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + c2c_left = container_of(left, struct c2c_hist_entry, he); + c2c_right = container_of(right, struct c2c_hist_entry, he); + +- return llc_miss(&c2c_left->stats) - llc_miss(&c2c_right->stats); ++ return (uint64_t) llc_miss(&c2c_left->stats) - ++ (uint64_t) llc_miss(&c2c_right->stats); + } + + static uint64_t total_records(struct c2c_stats *stats) |