Merge 4.14.52 into android-4.14
authorGreg Kroah-Hartman <gregkh@google.com>
Tue, 26 Jun 2018 01:14:49 +0000 (09:14 +0800)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 26 Jun 2018 01:14:49 +0000 (09:14 +0800)
Changes in 4.14.52
bonding: re-evaluate force_primary when the primary slave name changes
cdc_ncm: avoid padding beyond end of skb
ipv6: allow PMTU exceptions to local routes
net: dsa: add error handling for pskb_trim_rcsum
net/sched: act_simple: fix parsing of TCA_DEF_DATA
tcp: verify the checksum of the first data segment in a new connection
socket: close race condition between sock_close() and sockfs_setattr()
udp: fix rx queue len reported by diag and proc interface
net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan
hv_netvsc: Fix a network regression after ifdown/ifup
tls: fix use-after-free in tls_push_record
NFSv4.1: Fix up replays of interrupted requests
ext4: fix hole length detection in ext4_ind_map_blocks()
ext4: update mtime in ext4_punch_hole even if no blocks are released
ext4: do not allow external inodes for inline data
ext4: bubble errors from ext4_find_inline_data_nolock() up to ext4_iget()
ext4: correctly handle a zero-length xattr with a non-zero e_value_offs
ext4: fix fencepost error in check for inode count overflow during resize
driver core: Don't ignore class_dir_create_and_add() failure.
Btrfs: fix clone vs chattr NODATASUM race
Btrfs: fix memory and mount leak in btrfs_ioctl_rm_dev_v2()
btrfs: return error value if create_io_em failed in cow_file_range
btrfs: scrub: Don't use inode pages for device replace
ALSA: hda/realtek - Enable mic-mute hotkey for several Lenovo AIOs
ALSA: hda/conexant - Add fixup for HP Z2 G4 workstation
ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
ALSA: hda: add dock and led support for HP EliteBook 830 G5
ALSA: hda: add dock and led support for HP ProBook 640 G4
x86/MCE: Fix stack out-of-bounds write in mce-inject.c: Flags_read()
smb3: fix various xid leaks
smb3: on reconnect set PreviousSessionId field
CIFS: 511c54a2f69195b28afb9dd119f03787b1625bb4 adds a check for session expiry
cifs: For SMB2 security informaion query, check for minimum sized security descriptor instead of sizeof FileAllInformation class
nbd: fix nbd device deletion
nbd: update size when connected
nbd: use bd_set_size when updating disk size
blk-mq: reinit q->tag_set_list entry only after grace period
bdi: Move cgroup bdi_writeback to a dedicated low concurrency workqueue
cpufreq: Fix new policy initialization during limits updates via sysfs
cpufreq: governors: Fix long idle detection logic in load calculation
libata: zpodd: small read overflow in eject_tray()
libata: Drop SanDisk SD7UB3Q*G1001 NOLPM quirk
w1: mxc_w1: Enable clock before calling clk_get_rate() on it
x86/intel_rdt: Enable CMT and MBM on new Skylake stepping
iwlwifi: fw: harden page loading code
orangefs: set i_size on new symlink
orangefs: report attributes_mask and attributes for statx
HID: intel_ish-hid: ipc: register more pm callbacks to support hibernation
HID: wacom: Correct logical maximum Y for 2nd-gen Intuos Pro large
vhost: fix info leak due to uninitialized memory
fs/binfmt_misc.c: do not allow offset overflow
mm, page_alloc: do not break __GFP_THISNODE by zonelist reset
Linux 4.14.52

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
57 files changed:
Makefile
arch/x86/kernel/cpu/intel_rdt.c
arch/x86/kernel/cpu/mcheck/mce-inject.c
block/blk-mq.c
drivers/ata/libata-core.c
drivers/ata/libata-zpodd.c
drivers/base/core.c
drivers/block/nbd.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_governor.c
drivers/hid/intel-ish-hid/ipc/pci-ish.c
drivers/hid/wacom_sys.c
drivers/net/bonding/bond_options.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/tap.c
drivers/net/tun.c
drivers/net/usb/cdc_ncm.c
drivers/net/virtio_net.c
drivers/net/wireless/intel/iwlwifi/fw/paging.c
drivers/vhost/vhost.c
drivers/w1/masters/mxc_w1.c
fs/binfmt_misc.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/scrub.c
fs/cifs/cifsacl.h
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c
fs/ext4/indirect.c
fs/ext4/inline.c
fs/ext4/inode.c
fs/ext4/resize.c
fs/ext4/xattr.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c
fs/orangefs/inode.c
fs/orangefs/namei.c
include/linux/virtio_net.h
include/net/transp_v6.h
include/net/udp.h
mm/backing-dev.c
mm/page_alloc.c
net/dsa/tag_trailer.c
net/ipv4/tcp_ipv4.c
net/ipv4/udp.c
net/ipv4/udp_diag.c
net/ipv6/datagram.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/packet/af_packet.c
net/sched/act_simple.c
net/socket.c
net/tls/tls_sw.c
sound/pci/hda/hda_controller.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c

index 1ea16cdbb25e8a77a2647fe22186c25d8f639a7c..bf5e7f76161a083c587952318994e2f627b46184 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 51
+SUBLEVEL = 52
 EXTRAVERSION =
 NAME = Petit Gorille
 
index 18dd8f22e353ab339aa32a0553a16ab5451363aa..665d0f6cd62f76af9ec04b0196ee9c69568c7f0d 100644 (file)
@@ -773,6 +773,8 @@ static __init void rdt_quirks(void)
        case INTEL_FAM6_SKYLAKE_X:
                if (boot_cpu_data.x86_stepping <= 4)
                        set_rdt_options("!cmt,!mbmtotal,!mbmlocal,!l3cat");
+               else
+                       set_rdt_options("!l3cat");
        }
 }
 
index 231ad23b24a98ee59b0b232f038592b405c9e66b..8fec687b3e44e1859196da16abad444d909f10a2 100644 (file)
@@ -48,7 +48,7 @@ static struct dentry *dfs_inj;
 
 static u8 n_banks;
 
-#define MAX_FLAG_OPT_SIZE      3
+#define MAX_FLAG_OPT_SIZE      4
 #define NBCFG                  0x44
 
 enum injection_type {
index 74c35513ada5e2aa5c4951ddeb59acc6a7742435..49979c095f31c4885c020d469a068738fa30fa15 100644 (file)
@@ -2252,7 +2252,6 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
 
        mutex_lock(&set->tag_list_lock);
        list_del_rcu(&q->tag_set_list);
-       INIT_LIST_HEAD(&q->tag_set_list);
        if (list_is_singular(&set->tag_list)) {
                /* just transitioned to unshared */
                set->flags &= ~BLK_MQ_F_TAG_SHARED;
@@ -2260,8 +2259,8 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
                blk_mq_update_tag_set_depth(set, false);
        }
        mutex_unlock(&set->tag_list_lock);
-
        synchronize_rcu();
+       INIT_LIST_HEAD(&q->tag_set_list);
 }
 
 static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
index 71008dbabe98ffef68b54047d9eafedc6b9e4774..cad2530a5b52b8940fd965a1382b22a9f1bd4a44 100644 (file)
@@ -4543,9 +4543,6 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
                                                ATA_HORKAGE_ZERO_AFTER_TRIM |
                                                ATA_HORKAGE_NOLPM, },
 
-       /* Sandisk devices which are known to not handle LPM well */
-       { "SanDisk SD7UB3Q*G1001",      NULL,   ATA_HORKAGE_NOLPM, },
-
        /* devices that don't properly handle queued TRIM commands */
        { "Micron_M500IT_*",            "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
                                                ATA_HORKAGE_ZERO_AFTER_TRIM, },
index de4ddd0e8550a66dac6856099180bc59dc622d05..b3ed8f9953a862ea3ae67ef065ca5469330a44e0 100644 (file)
@@ -35,7 +35,7 @@ struct zpodd {
 static int eject_tray(struct ata_device *dev)
 {
        struct ata_taskfile tf;
-       static const char cdb[] = {  GPCMD_START_STOP_UNIT,
+       static const char cdb[ATAPI_CDB_LEN] = {  GPCMD_START_STOP_UNIT,
                0, 0, 0,
                0x02,     /* LoEj */
                0, 0, 0, 0, 0, 0, 0,
index c8501cdb95f49b22404990b1a40248d913962d84..a359934ffd85f11151ee4ade79789688c8157888 100644 (file)
@@ -1461,7 +1461,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
 
        dir = kzalloc(sizeof(*dir), GFP_KERNEL);
        if (!dir)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        dir->class = class;
        kobject_init(&dir->kobj, &class_dir_ktype);
@@ -1471,7 +1471,7 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
        retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name);
        if (retval < 0) {
                kobject_put(&dir->kobj);
-               return NULL;
+               return ERR_PTR(retval);
        }
        return &dir->kobj;
 }
@@ -1778,6 +1778,10 @@ int device_add(struct device *dev)
 
        parent = get_device(dev->parent);
        kobj = get_device_parent(dev, parent);
+       if (IS_ERR(kobj)) {
+               error = PTR_ERR(kobj);
+               goto parent_error;
+       }
        if (kobj)
                dev->kobj.parent = kobj;
 
@@ -1876,6 +1880,7 @@ done:
        kobject_del(&dev->kobj);
  Error:
        cleanup_glue_dir(dev, glue_dir);
+parent_error:
        put_device(parent);
 name_error:
        kfree(dev->p);
@@ -2695,6 +2700,11 @@ int device_move(struct device *dev, struct device *new_parent,
        device_pm_lock();
        new_parent = get_device(new_parent);
        new_parent_kobj = get_device_parent(dev, new_parent);
+       if (IS_ERR(new_parent_kobj)) {
+               error = PTR_ERR(new_parent_kobj);
+               put_device(new_parent);
+               goto out;
+       }
 
        pr_debug("device: '%s': %s: moving to '%s'\n", dev_name(dev),
                 __func__, new_parent ? dev_name(new_parent) : "<NULL>");
index 86258b00a1d4d1960a67fb021babc668884a72a7..6fb64e73bc9678e079a77823b5e4a3e31dba8dca 100644 (file)
@@ -173,9 +173,12 @@ static const struct device_attribute pid_attr = {
 static void nbd_dev_remove(struct nbd_device *nbd)
 {
        struct gendisk *disk = nbd->disk;
+       struct request_queue *q;
+
        if (disk) {
+               q = disk->queue;
                del_gendisk(disk);
-               blk_cleanup_queue(disk->queue);
+               blk_cleanup_queue(q);
                blk_mq_free_tag_set(&nbd->tag_set);
                disk->private_data = NULL;
                put_disk(disk);
@@ -231,9 +234,18 @@ static void nbd_size_clear(struct nbd_device *nbd)
 static void nbd_size_update(struct nbd_device *nbd)
 {
        struct nbd_config *config = nbd->config;
+       struct block_device *bdev = bdget_disk(nbd->disk, 0);
+
        blk_queue_logical_block_size(nbd->disk->queue, config->blksize);
        blk_queue_physical_block_size(nbd->disk->queue, config->blksize);
        set_capacity(nbd->disk, config->bytesize >> 9);
+       if (bdev) {
+               if (bdev->bd_disk)
+                       bd_set_size(bdev, config->bytesize);
+               else
+                       bdev->bd_invalidated = 1;
+               bdput(bdev);
+       }
        kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
 }
 
@@ -243,6 +255,8 @@ static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize,
        struct nbd_config *config = nbd->config;
        config->blksize = blocksize;
        config->bytesize = blocksize * nr_blocks;
+       if (nbd->task_recv != NULL)
+               nbd_size_update(nbd);
 }
 
 static void nbd_complete_rq(struct request *req)
@@ -1109,7 +1123,6 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b
        if (ret)
                return ret;
 
-       bd_set_size(bdev, config->bytesize);
        if (max_part)
                bdev->bd_invalidated = 1;
        mutex_unlock(&nbd->config_lock);
index fa4aa017028119464e95ba1a9732ba8b5ffd8154..8dfd102a4b192c9f7825cfea0e5f6a32781a1c13 100644 (file)
@@ -695,6 +695,8 @@ static ssize_t store_##file_name                                    \
        struct cpufreq_policy new_policy;                               \
                                                                        \
        memcpy(&new_policy, policy, sizeof(*policy));                   \
+       new_policy.min = policy->user_policy.min;                       \
+       new_policy.max = policy->user_policy.max;                       \
                                                                        \
        ret = sscanf(buf, "%u", &new_policy.object);                    \
        if (ret != 1)                                                   \
index ca38229b045ab288a2f250dddaf1b174e8c0572f..43e14bb512c8da4cd2c0f8a73e37a1fe1205a170 100644 (file)
@@ -165,7 +165,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
                         * calls, so the previous load value can be used then.
                         */
                        load = j_cdbs->prev_load;
-               } else if (unlikely(time_elapsed > 2 * sampling_rate &&
+               } else if (unlikely((int)idle_time > 2 * sampling_rate &&
                                    j_cdbs->prev_load)) {
                        /*
                         * If the CPU had gone completely idle and a task has
@@ -185,10 +185,8 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
                         * clear prev_load to guarantee that the load will be
                         * computed again next time.
                         *
-                        * Detecting this situation is easy: the governor's
-                        * utilization update handler would not have run during
-                        * CPU-idle periods.  Hence, an unusually large
-                        * 'time_elapsed' (as compared to the sampling rate)
+                        * Detecting this situation is easy: an unusually large
+                        * 'idle_time' (as compared to the sampling rate)
                         * indicates this scenario.
                         */
                        load = j_cdbs->prev_load;
@@ -217,8 +215,8 @@ unsigned int dbs_update(struct cpufreq_policy *policy)
                        j_cdbs->prev_load = load;
                }
 
-               if (time_elapsed > 2 * sampling_rate) {
-                       unsigned int periods = time_elapsed / sampling_rate;
+               if (unlikely((int)idle_time > 2 * sampling_rate)) {
+                       unsigned int periods = idle_time / sampling_rate;
 
                        if (periods < idle_periods)
                                idle_periods = periods;
index 20d824f74f99e6fd6809e68f9811dda8ec14fddf..90d7be08fea0019e8b0cb9d327fa5233c3759e01 100644 (file)
@@ -204,8 +204,7 @@ static void ish_remove(struct pci_dev *pdev)
        kfree(ishtp_dev);
 }
 
-#ifdef CONFIG_PM
-static struct device *ish_resume_device;
+static struct device __maybe_unused *ish_resume_device;
 
 /* 50ms to get resume response */
 #define WAIT_FOR_RESUME_ACK_MS         50
@@ -219,7 +218,7 @@ static struct device *ish_resume_device;
  * in that case a simple resume message is enough, others we need
  * a reset sequence.
  */
-static void ish_resume_handler(struct work_struct *work)
+static void __maybe_unused ish_resume_handler(struct work_struct *work)
 {
        struct pci_dev *pdev = to_pci_dev(ish_resume_device);
        struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -261,7 +260,7 @@ static void ish_resume_handler(struct work_struct *work)
  *
  * Return: 0 to the pm core
  */
-static int ish_suspend(struct device *device)
+static int __maybe_unused ish_suspend(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
        struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -287,7 +286,7 @@ static int ish_suspend(struct device *device)
        return 0;
 }
 
-static DECLARE_WORK(resume_work, ish_resume_handler);
+static __maybe_unused DECLARE_WORK(resume_work, ish_resume_handler);
 /**
  * ish_resume() - ISH resume callback
  * @device:    device pointer
@@ -296,7 +295,7 @@ static DECLARE_WORK(resume_work, ish_resume_handler);
  *
  * Return: 0 to the pm core
  */
-static int ish_resume(struct device *device)
+static int __maybe_unused ish_resume(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
        struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -310,21 +309,14 @@ static int ish_resume(struct device *device)
        return 0;
 }
 
-static const struct dev_pm_ops ish_pm_ops = {
-       .suspend = ish_suspend,
-       .resume = ish_resume,
-};
-#define ISHTP_ISH_PM_OPS       (&ish_pm_ops)
-#else
-#define ISHTP_ISH_PM_OPS       NULL
-#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(ish_pm_ops, ish_suspend, ish_resume);
 
 static struct pci_driver ish_driver = {
        .name = KBUILD_MODNAME,
        .id_table = ish_pci_tbl,
        .probe = ish_probe,
        .remove = ish_remove,
-       .driver.pm = ISHTP_ISH_PM_OPS,
+       .driver.pm = &ish_pm_ops,
 };
 
 module_pci_driver(ish_driver);
index 69afd7968d9cd493b6126797d34411b22abbf563..18d5b99d13f1b94711396c7c88980c745d50bf1f 100644 (file)
@@ -284,6 +284,14 @@ static void wacom_usage_mapping(struct hid_device *hdev,
                }
        }
 
+       /* 2nd-generation Intuos Pro Large has incorrect Y maximum */
+       if (hdev->vendor == USB_VENDOR_ID_WACOM &&
+           hdev->product == 0x0358 &&
+           WACOM_PEN_FIELD(field) &&
+           wacom_equivalent_usage(usage->hid) == HID_GD_Y) {
+               field->logical_maximum = 43200;
+       }
+
        switch (usage->hid) {
        case HID_GD_X:
                features->x_max = field->logical_maximum;
index 5931aa2fe9974c1d20934be9d9ade6451af0cfcc..61084ba69a99f2ce2b1992d22608539c5675eba4 100644 (file)
@@ -1142,6 +1142,7 @@ static int bond_option_primary_set(struct bonding *bond,
                                   slave->dev->name);
                        rcu_assign_pointer(bond->primary_slave, slave);
                        strcpy(bond->params.primary, slave->dev->name);
+                       bond->force_primary = true;
                        bond_select_active_slave(bond);
                        goto out;
                }
index 3a7241c8713cf15530856c3509e42e82b9024741..6890478a085167379d4f2bf2a8ac38a83982dd1a 100644 (file)
@@ -123,8 +123,10 @@ static int netvsc_open(struct net_device *net)
        }
 
        rdev = nvdev->extension;
-       if (!rdev->link_state)
+       if (!rdev->link_state) {
                netif_carrier_on(net);
+               netif_tx_wake_all_queues(net);
+       }
 
        if (vf_netdev) {
                /* Setting synthetic device up transparently sets
index bfd4ded0a53fb015226d0b03ceb9e5dda9f904e5..773a3fea8f0eb50d29e231b5fa95b49e15549f96 100644 (file)
@@ -777,13 +777,16 @@ static ssize_t tap_put_user(struct tap_queue *q,
        int total;
 
        if (q->flags & IFF_VNET_HDR) {
+               int vlan_hlen = skb_vlan_tag_present(skb) ? VLAN_HLEN : 0;
                struct virtio_net_hdr vnet_hdr;
+
                vnet_hdr_len = READ_ONCE(q->vnet_hdr_sz);
                if (iov_iter_count(iter) < vnet_hdr_len)
                        return -EINVAL;
 
                if (virtio_net_hdr_from_skb(skb, &vnet_hdr,
-                                           tap_is_little_endian(q), true))
+                                           tap_is_little_endian(q), true,
+                                           vlan_hlen))
                        BUG();
 
                if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
index af49f68aa8c5b84c55583f5db560ef7118f6dfd3..8f8701682bd50f9adb9b9e08114a2f23a50e3b95 100644 (file)
@@ -1648,7 +1648,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
                        return -EINVAL;
 
                if (virtio_net_hdr_from_skb(skb, &gso,
-                                           tun_is_little_endian(tun), true)) {
+                                           tun_is_little_endian(tun), true,
+                                           vlan_hlen)) {
                        struct skb_shared_info *sinfo = skb_shinfo(skb);
                        pr_err("unexpected GSO type: "
                               "0x%x, gso_size %d, hdr_len %d\n",
index 9e1b74590682e1b44242374f34fd628bdd5b1fbb..f5316ab68a0a89e749a7cc2d4d0a3ff5d03b5349 100644 (file)
@@ -1124,7 +1124,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
         * accordingly. Otherwise, we should check here.
         */
        if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
-               delayed_ndp_size = ctx->max_ndp_size;
+               delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);
        else
                delayed_ndp_size = 0;
 
@@ -1285,7 +1285,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
        /* If requested, put NDP at end of frame. */
        if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
                nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data;
-               cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size);
+               cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_curr_size - ctx->max_ndp_size);
                nth16->wNdpIndex = cpu_to_le16(skb_out->len);
                skb_put_data(skb_out, ctx->delayed_ndp16, ctx->max_ndp_size);
 
index 9e93e7a5df7eee0c6442dcc8f7e1e6b7a0fb0d7d..910c46b4776999e9f43251801c0cc65a70d186b2 100644 (file)
@@ -1237,7 +1237,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
                hdr = skb_vnet_hdr(skb);
 
        if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
-                                   virtio_is_little_endian(vi->vdev), false))
+                                   virtio_is_little_endian(vi->vdev), false,
+                                   0))
                BUG();
 
        if (vi->mergeable_rx_bufs)
index 1610722b8099dc54f8ecbb8552e0db47a8c1a87f..747eef82cefd9673c093e921f5b269f1a5f83273 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
+ * Copyright(c) 2018        Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,6 +31,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
+ * Copyright(c) 2018        Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -174,7 +176,7 @@ static int iwl_alloc_fw_paging_mem(struct iwl_fw_runtime *fwrt,
 static int iwl_fill_paging_mem(struct iwl_fw_runtime *fwrt,
                               const struct fw_img *image)
 {
-       int sec_idx, idx;
+       int sec_idx, idx, ret;
        u32 offset = 0;
 
        /*
@@ -201,17 +203,23 @@ static int iwl_fill_paging_mem(struct iwl_fw_runtime *fwrt,
         */
        if (sec_idx >= image->num_sec - 1) {
                IWL_ERR(fwrt, "Paging: Missing CSS and/or paging sections\n");
-               iwl_free_fw_paging(fwrt);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err;
        }
 
        /* copy the CSS block to the dram */
        IWL_DEBUG_FW(fwrt, "Paging: load paging CSS to FW, sec = %d\n",
                     sec_idx);
 
+       if (image->sec[sec_idx].len > fwrt->fw_paging_db[0].fw_paging_size) {
+               IWL_ERR(fwrt, "CSS block is larger than paging size\n");
+               ret = -EINVAL;
+               goto err;
+       }
+
        memcpy(page_address(fwrt->fw_paging_db[0].fw_paging_block),
               image->sec[sec_idx].data,
-              fwrt->fw_paging_db[0].fw_paging_size);
+              image->sec[sec_idx].len);
        dma_sync_single_for_device(fwrt->trans->dev,
                                   fwrt->fw_paging_db[0].fw_paging_phys,
                                   fwrt->fw_paging_db[0].fw_paging_size,
@@ -232,6 +240,14 @@ static int iwl_fill_paging_mem(struct iwl_fw_runtime *fwrt,
        for (idx = 1; idx < fwrt->num_of_paging_blk; idx++) {
                struct iwl_fw_paging *block = &fwrt->fw_paging_db[idx];
 
+               if (block->fw_paging_size > image->sec[sec_idx].len - offset) {
+                       IWL_ERR(fwrt,
+                               "Paging: paging size is larger than remaining data in block %d\n",
+                               idx);
+                       ret = -EINVAL;
+                       goto err;
+               }
+
                memcpy(page_address(block->fw_paging_block),
                       image->sec[sec_idx].data + offset,
                       block->fw_paging_size);
@@ -242,19 +258,32 @@ static int iwl_fill_paging_mem(struct iwl_fw_runtime *fwrt,
 
                IWL_DEBUG_FW(fwrt,
                             "Paging: copied %d paging bytes to block %d\n",
-                            fwrt->fw_paging_db[idx].fw_paging_size,
-                            idx);
+                            block->fw_paging_size, idx);
+
+               offset += block->fw_paging_size;
 
-               offset += fwrt->fw_paging_db[idx].fw_paging_size;
+               if (offset > image->sec[sec_idx].len) {
+                       IWL_ERR(fwrt,
+                               "Paging: offset goes over section size\n");
+                       ret = -EINVAL;
+                       goto err;
+               }
        }
 
        /* copy the last paging block */
        if (fwrt->num_of_pages_in_last_blk > 0) {
                struct iwl_fw_paging *block = &fwrt->fw_paging_db[idx];
 
+               if (image->sec[sec_idx].len - offset > block->fw_paging_size) {
+                       IWL_ERR(fwrt,
+                               "Paging: last block is larger than paging size\n");
+                       ret = -EINVAL;
+                       goto err;
+               }
+
                memcpy(page_address(block->fw_paging_block),
                       image->sec[sec_idx].data + offset,
-                      FW_PAGING_SIZE * fwrt->num_of_pages_in_last_blk);
+                      image->sec[sec_idx].len - offset);
                dma_sync_single_for_device(fwrt->trans->dev,
                                           block->fw_paging_phys,
                                           block->fw_paging_size,
@@ -266,6 +295,10 @@ static int iwl_fill_paging_mem(struct iwl_fw_runtime *fwrt,
        }
 
        return 0;
+
+err:
+       iwl_free_fw_paging(fwrt);
+       return ret;
 }
 
 static int iwl_save_fw_paging(struct iwl_fw_runtime *fwrt,
index 50e48afd88ff67f1dd644223f53da53aa226cfc0..244e5256c526f876b3afd2c41cdd333e7183dd4a 100644 (file)
@@ -2382,6 +2382,9 @@ struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type)
        struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL);
        if (!node)
                return NULL;
+
+       /* Make sure all padding within the structure is initialized. */
+       memset(&node->msg, 0, sizeof node->msg);
        node->vq = vq;
        node->msg.type = type;
        return node;
index 74f2e6e6202a98eba4882f1f9b62ea0705e6451b..8851d441e5fd16df4eb25784c3b16cf418a18681 100644 (file)
@@ -112,6 +112,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
        if (IS_ERR(mdev->clk))
                return PTR_ERR(mdev->clk);
 
+       err = clk_prepare_enable(mdev->clk);
+       if (err)
+               return err;
+
        clkrate = clk_get_rate(mdev->clk);
        if (clkrate < 10000000)
                dev_warn(&pdev->dev,
@@ -125,12 +129,10 @@ static int mxc_w1_probe(struct platform_device *pdev)
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        mdev->regs = devm_ioremap_resource(&pdev->dev, res);
-       if (IS_ERR(mdev->regs))
-               return PTR_ERR(mdev->regs);
-
-       err = clk_prepare_enable(mdev->clk);
-       if (err)
-               return err;
+       if (IS_ERR(mdev->regs)) {
+               err = PTR_ERR(mdev->regs);
+               goto out_disable_clk;
+       }
 
        /* Software reset 1-Wire module */
        writeb(MXC_W1_RESET_RST, mdev->regs + MXC_W1_RESET);
@@ -146,8 +148,12 @@ static int mxc_w1_probe(struct platform_device *pdev)
 
        err = w1_add_master_device(&mdev->bus_master);
        if (err)
-               clk_disable_unprepare(mdev->clk);
+               goto out_disable_clk;
 
+       return 0;
+
+out_disable_clk:
+       clk_disable_unprepare(mdev->clk);
        return err;
 }
 
index a7c5a9861bef5a73b8f7377dfa9e045427b915c7..8311e8ed76de37542d35dffc90c039452572f50e 100644 (file)
@@ -387,8 +387,13 @@ static Node *create_entry(const char __user *buffer, size_t count)
                s = strchr(p, del);
                if (!s)
                        goto einval;
-               *s++ = '\0';
-               e->offset = simple_strtoul(p, &p, 10);
+               *s = '\0';
+               if (p != s) {
+                       int r = kstrtoint(p, 10, &e->offset);
+                       if (r != 0 || e->offset < 0)
+                               goto einval;
+               }
+               p = s;
                if (*p++)
                        goto einval;
                pr_debug("register: offset: %#x\n", e->offset);
@@ -428,7 +433,8 @@ static Node *create_entry(const char __user *buffer, size_t count)
                if (e->mask &&
                    string_unescape_inplace(e->mask, UNESCAPE_HEX) != e->size)
                        goto einval;
-               if (e->size + e->offset > BINPRM_BUF_SIZE)
+               if (e->size > BINPRM_BUF_SIZE ||
+                   BINPRM_BUF_SIZE - e->size < e->offset)
                        goto einval;
                pr_debug("register: magic/mask length: %i\n", e->size);
                if (USE_DEBUG) {
index 8ecbac3b862ed6b4d1f94b969202601a7cba2a5a..3a07900971c3b3e2a75780c660627ba8c94c028f 100644 (file)
@@ -1027,8 +1027,10 @@ static noinline int cow_file_range(struct inode *inode,
                                  ram_size, /* ram_bytes */
                                  BTRFS_COMPRESS_NONE, /* compress_type */
                                  BTRFS_ORDERED_REGULAR /* type */);
-               if (IS_ERR(em))
+               if (IS_ERR(em)) {
+                       ret = PTR_ERR(em);
                        goto out_reserve;
+               }
                free_extent_map(em);
 
                ret = btrfs_add_ordered_extent(inode, start, ins.objectid,
index 2763f3184ac5b0ac1950f996ec83318cd8449b2a..7303ba108112215da25b906bf8145bd7a9bea087 100644 (file)
@@ -2682,8 +2682,10 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
        }
 
        /* Check for compatibility reject unknown flags */
-       if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED)
-               return -EOPNOTSUPP;
+       if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED) {
+               ret = -EOPNOTSUPP;
+               goto out;
+       }
 
        if (test_and_set_bit(BTRFS_FS_EXCL_OP, &fs_info->flags)) {
                ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
@@ -3861,11 +3863,6 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
            src->i_sb != inode->i_sb)
                return -EXDEV;
 
-       /* don't make the dst file partly checksummed */
-       if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) !=
-           (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM))
-               return -EINVAL;
-
        if (S_ISDIR(src->i_mode) || S_ISDIR(inode->i_mode))
                return -EISDIR;
 
@@ -3875,6 +3872,13 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
                inode_lock(src);
        }
 
+       /* don't make the dst file partly checksummed */
+       if ((BTRFS_I(src)->flags & BTRFS_INODE_NODATASUM) !=
+           (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) {
+               ret = -EINVAL;
+               goto out_unlock;
+       }
+
        /* determine range to clone */
        ret = -EINVAL;
        if (off + len > src->i_size || off + len < off)
index 24613b4e224c94bbeba76982c181b1971ca17554..936d58ca2b4914a7215920832d88fa5d151f00ec 100644 (file)
@@ -2775,7 +2775,7 @@ static int scrub_extent(struct scrub_ctx *sctx, u64 logical, u64 len,
                        have_csum = scrub_find_csum(sctx, logical, csum);
                        if (have_csum == 0)
                                ++sctx->stat.no_csum;
-                       if (sctx->is_dev_replace && !have_csum) {
+                       if (0 && sctx->is_dev_replace && !have_csum) {
                                ret = copy_nocow_pages(sctx, logical, l,
                                                       mirror_num,
                                                      physical_for_dev_replace);
index 4f3884835267162a55224921f20fd70a7ef2dd5d..dd95a6fa24bf41f177e3f78a78a46acc58b8813a 100644 (file)
@@ -98,4 +98,18 @@ struct cifs_ace {
        struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
 } __attribute__((packed));
 
+/*
+ * Minimum security identifier can be one for system defined Users
+ * and Groups such as NULL SID and World or Built-in accounts such
+ * as Administrator and Guest and consists of
+ * Revision + Num (Sub)Auths + Authority + Domain (one Subauthority)
+ */
+#define MIN_SID_LEN  (1 + 1 + 6 + 4) /* in bytes */
+
+/*
+ * Minimum security descriptor can be one without any SACL and DACL and can
+ * consist of revision, type, and two sids of minimum size for owner and group
+ */
+#define MIN_SEC_DESC_LEN  (sizeof(struct cifs_ntsd) + (2 * MIN_SID_LEN))
+
 #endif /* _CIFSACL_H */
index 839327f75e3d576277d537e54658dea65aa7209e..36bc9a7eb8ea5fbb93d43512e5e54bc836c209ab 100644 (file)
@@ -1256,10 +1256,11 @@ smb2_is_session_expired(char *buf)
 {
        struct smb2_sync_hdr *shdr = get_sync_hdr(buf);
 
-       if (shdr->Status != STATUS_NETWORK_SESSION_EXPIRED)
+       if (shdr->Status != STATUS_NETWORK_SESSION_EXPIRED &&
+           shdr->Status != STATUS_USER_SESSION_DELETED)
                return false;
 
-       cifs_dbg(FYI, "Session expired\n");
+       cifs_dbg(FYI, "Session expired or deleted\n");
        return true;
 }
 
@@ -1571,8 +1572,11 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
                oparms.create_options = 0;
 
        utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
-       if (!utf16_path)
-               return ERR_PTR(-ENOMEM);
+       if (!utf16_path) {
+               rc = -ENOMEM;
+               free_xid(xid);
+               return ERR_PTR(rc);
+       }
 
        oparms.tcon = tcon;
        oparms.desired_access = READ_CONTROL;
@@ -1630,8 +1634,11 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
                access_flags = WRITE_DAC;
 
        utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
-       if (!utf16_path)
-               return -ENOMEM;
+       if (!utf16_path) {
+               rc = -ENOMEM;
+               free_xid(xid);
+               return rc;
+       }
 
        oparms.tcon = tcon;
        oparms.desired_access = access_flags;
@@ -1691,15 +1698,21 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
 
        /* if file not oplocked can't be sure whether asking to extend size */
        if (!CIFS_CACHE_READ(cifsi))
-               if (keep_size == false)
-                       return -EOPNOTSUPP;
+               if (keep_size == false) {
+                       rc = -EOPNOTSUPP;
+                       free_xid(xid);
+                       return rc;
+               }
 
        /*
         * Must check if file sparse since fallocate -z (zero range) assumes
         * non-sparse allocation
         */
-       if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE))
-               return -EOPNOTSUPP;
+       if (!(cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)) {
+               rc = -EOPNOTSUPP;
+               free_xid(xid);
+               return rc;
+       }
 
        /*
         * need to make sure we are not asked to extend the file since the SMB3
@@ -1708,8 +1721,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
         * which for a non sparse file would zero the newly extended range
         */
        if (keep_size == false)
-               if (i_size_read(inode) < offset + len)
-                       return -EOPNOTSUPP;
+               if (i_size_read(inode) < offset + len) {
+                       rc = -EOPNOTSUPP;
+                       free_xid(xid);
+                       return rc;
+               }
 
        cifs_dbg(FYI, "offset %lld len %lld", offset, len);
 
@@ -1743,8 +1759,11 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
 
        /* Need to make file sparse, if not already, before freeing range. */
        /* Consider adding equivalent for compressed since it could also work */
-       if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse))
-               return -EOPNOTSUPP;
+       if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) {
+               rc = -EOPNOTSUPP;
+               free_xid(xid);
+               return rc;
+       }
 
        cifs_dbg(FYI, "offset %lld len %lld", offset, len);
 
@@ -1776,8 +1795,10 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 
        /* if file not oplocked can't be sure whether asking to extend size */
        if (!CIFS_CACHE_READ(cifsi))
-               if (keep_size == false)
-                       return -EOPNOTSUPP;
+               if (keep_size == false) {
+                       free_xid(xid);
+                       return rc;
+               }
 
        /*
         * Files are non-sparse by default so falloc may be a no-op
@@ -1786,14 +1807,16 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
         */
        if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) {
                if (keep_size == true)
-                       return 0;
+                       rc = 0;
                /* check if extending file */
                else if (i_size_read(inode) >= off + len)
                        /* not extending file and already not sparse */
-                       return 0;
+                       rc = 0;
                /* BB: in future add else clause to extend file */
                else
-                       return -EOPNOTSUPP;
+                       rc = -EOPNOTSUPP;
+               free_xid(xid);
+               return rc;
        }
 
        if ((keep_size == true) || (i_size_read(inode) >= off + len)) {
@@ -1805,8 +1828,11 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
                 * ie potentially making a few extra pages at the beginning
                 * or end of the file non-sparse via set_sparse is harmless.
                 */
-               if ((off > 8192) || (off + len + 8192 < i_size_read(inode)))
-                       return -EOPNOTSUPP;
+               if ((off > 8192) || (off + len + 8192 < i_size_read(inode))) {
+                       rc = -EOPNOTSUPP;
+                       free_xid(xid);
+                       return rc;
+               }
 
                rc = smb2_set_sparse(xid, tcon, cfile, inode, false);
        }
index 49779d952cd55cde658fe5cbb49c2fb38ae0bb7b..5247b40e57f671dfd37c1c28a3ca2a4fb58b3b7a 100644 (file)
@@ -1182,6 +1182,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
        sess_data->ses = ses;
        sess_data->buf0_type = CIFS_NO_BUFFER;
        sess_data->nls_cp = (struct nls_table *) nls_cp;
+       sess_data->previous_session = ses->Suid;
 
        while (sess_data->func)
                sess_data->func(sess_data);
@@ -2278,8 +2279,7 @@ SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
 
        return query_info(xid, tcon, persistent_fid, volatile_fid,
                          0, SMB2_O_INFO_SECURITY, additional_info,
-                         SMB2_MAX_BUFFER_SIZE,
-                         sizeof(struct smb2_file_all_info), data, plen);
+                         SMB2_MAX_BUFFER_SIZE, MIN_SEC_DESC_LEN, data, plen);
 }
 
 int
index c32802c956d5ebac9f264b95ec3f77c78137e4ca..bf7fa1507e811221523a785cee1ed41159d7a0ca 100644 (file)
@@ -561,10 +561,16 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
                unsigned epb = inode->i_sb->s_blocksize / sizeof(u32);
                int i;
 
-               /* Count number blocks in a subtree under 'partial' */
-               count = 1;
-               for (i = 0; partial + i != chain + depth - 1; i++)
-                       count *= epb;
+               /*
+                * Count number blocks in a subtree under 'partial'. At each
+                * level we count number of complete empty subtrees beyond
+                * current offset and then descend into the subtree only
+                * partially beyond current offset.
+                */
+               count = 0;
+               for (i = partial - chain + 1; i < depth; i++)
+                       count = count * epb + (epb - offsets[i] - 1);
+               count++;
                /* Fill in size of a hole we found */
                map->m_pblk = 0;
                map->m_len = min_t(unsigned int, map->m_len, count);
index 4e63507f5ce101caa6d488c37ca14653e1c50511..54e4ad43d7c22ca733ea29fe228b76024f855d7e 100644 (file)
@@ -151,6 +151,12 @@ int ext4_find_inline_data_nolock(struct inode *inode)
                goto out;
 
        if (!is.s.not_found) {
+               if (is.s.here->e_value_inum) {
+                       EXT4_ERROR_INODE(inode, "inline data xattr refers "
+                                        "to an external xattr inode");
+                       error = -EFSCORRUPTED;
+                       goto out;
+               }
                EXT4_I(inode)->i_inline_off = (u16)((void *)is.s.here -
                                        (void *)ext4_raw_inode(&is.iloc));
                EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE +
index 4f26c7a04a63c7da3b24710232d762249956a296..7080fc7ea6b6be000928a80ab452ee419d3b4472 100644 (file)
@@ -4301,28 +4301,28 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
                EXT4_BLOCK_SIZE_BITS(sb);
        stop_block = (offset + length) >> EXT4_BLOCK_SIZE_BITS(sb);
 
-       /* If there are no blocks to remove, return now */
-       if (first_block >= stop_block)
-               goto out_stop;
+       /* If there are blocks to remove, do it */
+       if (stop_block > first_block) {
 
-       down_write(&EXT4_I(inode)->i_data_sem);
-       ext4_discard_preallocations(inode);
+               down_write(&EXT4_I(inode)->i_data_sem);
+               ext4_discard_preallocations(inode);
 
-       ret = ext4_es_remove_extent(inode, first_block,
-                                   stop_block - first_block);
-       if (ret) {
-               up_write(&EXT4_I(inode)->i_data_sem);
-               goto out_stop;
-       }
+               ret = ext4_es_remove_extent(inode, first_block,
+                                           stop_block - first_block);
+               if (ret) {
+                       up_write(&EXT4_I(inode)->i_data_sem);
+                       goto out_stop;
+               }
 
-       if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
-               ret = ext4_ext_remove_space(inode, first_block,
-                                           stop_block - 1);
-       else
-               ret = ext4_ind_remove_space(handle, inode, first_block,
-                                           stop_block);
+               if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
+                       ret = ext4_ext_remove_space(inode, first_block,
+                                                   stop_block - 1);
+               else
+                       ret = ext4_ind_remove_space(handle, inode, first_block,
+                                                   stop_block);
 
-       up_write(&EXT4_I(inode)->i_data_sem);
+               up_write(&EXT4_I(inode)->i_data_sem);
+       }
        if (IS_SYNC(inode))
                ext4_handle_sync(handle);
 
@@ -4692,19 +4692,21 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
        }
 }
 
-static inline void ext4_iget_extra_inode(struct inode *inode,
+static inline int ext4_iget_extra_inode(struct inode *inode,
                                         struct ext4_inode *raw_inode,
                                         struct ext4_inode_info *ei)
 {
        __le32 *magic = (void *)raw_inode +
                        EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize;
+
        if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize + sizeof(__le32) <=
            EXT4_INODE_SIZE(inode->i_sb) &&
            *magic == cpu_to_le32(EXT4_XATTR_MAGIC)) {
                ext4_set_inode_state(inode, EXT4_STATE_XATTR);
-               ext4_find_inline_data_nolock(inode);
+               return ext4_find_inline_data_nolock(inode);
        } else
                EXT4_I(inode)->i_inline_off = 0;
+       return 0;
 }
 
 int ext4_get_projid(struct inode *inode, kprojid_t *projid)
@@ -4884,7 +4886,9 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
                        ei->i_extra_isize = sizeof(struct ext4_inode) -
                                            EXT4_GOOD_OLD_INODE_SIZE;
                } else {
-                       ext4_iget_extra_inode(inode, raw_inode, ei);
+                       ret = ext4_iget_extra_inode(inode, raw_inode, ei);
+                       if (ret)
+                               goto bad_inode;
                }
        }
 
index 1dac59c247920a0fad6b3d2cc06d5a9f72fc15fd..823c0b82dfeb006ea546caeaa38e7435a1baca3b 100644 (file)
@@ -1905,7 +1905,7 @@ retry:
                return 0;
 
        n_group = ext4_get_group_number(sb, n_blocks_count - 1);
-       if (n_group > (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) {
+       if (n_group >= (0xFFFFFFFFUL / EXT4_INODES_PER_GROUP(sb))) {
                ext4_warning(sb, "resize would cause inodes_count overflow");
                return -EINVAL;
        }
index 1718354e6322e524f58a83d3d317fc4876973fb0..ed1cf24a78319fd00cbb364b4d283c3bea5fd5f5 100644 (file)
@@ -1687,7 +1687,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
 
        /* No failures allowed past this point. */
 
-       if (!s->not_found && here->e_value_offs) {
+       if (!s->not_found && here->e_value_size && here->e_value_offs) {
                /* Remove the old value. */
                void *first_val = s->base + min_offs;
                size_t offs = le16_to_cpu(here->e_value_offs);
index dcfcf7fd7438f9a3248d110d149de8f7e652cf07..a73144b3cb8c8aaeeaddc9b12713620d22380843 100644 (file)
@@ -465,7 +465,7 @@ extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid);
 extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);
 extern void nfs_release_seqid(struct nfs_seqid *seqid);
 extern void nfs_free_seqid(struct nfs_seqid *seqid);
-extern int nfs4_setup_sequence(const struct nfs_client *client,
+extern int nfs4_setup_sequence(struct nfs_client *client,
                                struct nfs4_sequence_args *args,
                                struct nfs4_sequence_res *res,
                                struct rpc_task *task);
index ae8f43d270d6dc6a0ce76bce9f51ebb3208d7e46..8ff98bbe479bca7dc5e5219e3be4891b0e71cae4 100644 (file)
@@ -96,6 +96,10 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
                            struct nfs_open_context *ctx, struct nfs4_label *ilabel,
                            struct nfs4_label *olabel);
 #ifdef CONFIG_NFS_V4_1
+static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
+               struct rpc_cred *cred,
+               struct nfs4_slot *slot,
+               bool is_privileged);
 static int nfs41_test_stateid(struct nfs_server *, nfs4_stateid *,
                struct rpc_cred *);
 static int nfs41_free_stateid(struct nfs_server *, const nfs4_stateid *,
@@ -641,13 +645,14 @@ static int nfs40_sequence_done(struct rpc_task *task,
 
 #if defined(CONFIG_NFS_V4_1)
 
-static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
+static void nfs41_release_slot(struct nfs4_slot *slot)
 {
        struct nfs4_session *session;
        struct nfs4_slot_table *tbl;
-       struct nfs4_slot *slot = res->sr_slot;
        bool send_new_highest_used_slotid = false;
 
+       if (!slot)
+               return;
        tbl = slot->table;
        session = tbl->session;
 
@@ -673,13 +678,18 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
                send_new_highest_used_slotid = false;
 out_unlock:
        spin_unlock(&tbl->slot_tbl_lock);
-       res->sr_slot = NULL;
        if (send_new_highest_used_slotid)
                nfs41_notify_server(session->clp);
        if (waitqueue_active(&tbl->slot_waitq))
                wake_up_all(&tbl->slot_waitq);
 }
 
+static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
+{
+       nfs41_release_slot(res->sr_slot);
+       res->sr_slot = NULL;
+}
+
 static int nfs41_sequence_process(struct rpc_task *task,
                struct nfs4_sequence_res *res)
 {
@@ -707,13 +717,6 @@ static int nfs41_sequence_process(struct rpc_task *task,
        /* Check the SEQUENCE operation status */
        switch (res->sr_status) {
        case 0:
-               /* If previous op on slot was interrupted and we reused
-                * the seq# and got a reply from the cache, then retry
-                */
-               if (task->tk_status == -EREMOTEIO && interrupted) {
-                       ++slot->seq_nr;
-                       goto retry_nowait;
-               }
                /* Update the slot's sequence and clientid lease timer */
                slot->seq_done = 1;
                clp = session->clp;
@@ -747,16 +750,16 @@ static int nfs41_sequence_process(struct rpc_task *task,
                 * The slot id we used was probably retired. Try again
                 * using a different slot id.
                 */
+               if (slot->seq_nr < slot->table->target_highest_slotid)
+                       goto session_recover;
                goto retry_nowait;
        case -NFS4ERR_SEQ_MISORDERED:
                /*
                 * Was the last operation on this sequence interrupted?
                 * If so, retry after bumping the sequence number.
                 */
-               if (interrupted) {
-                       ++slot->seq_nr;
-                       goto retry_nowait;
-               }
+               if (interrupted)
+                       goto retry_new_seq;
                /*
                 * Could this slot have been previously retired?
                 * If so, then the server may be expecting seq_nr = 1!
@@ -765,10 +768,11 @@ static int nfs41_sequence_process(struct rpc_task *task,
                        slot->seq_nr = 1;
                        goto retry_nowait;
                }
-               break;
+               goto session_recover;
        case -NFS4ERR_SEQ_FALSE_RETRY:
-               ++slot->seq_nr;
-               goto retry_nowait;
+               if (interrupted)
+                       goto retry_new_seq;
+               goto session_recover;
        default:
                /* Just update the slot sequence no. */
                slot->seq_done = 1;
@@ -778,6 +782,11 @@ out:
        dprintk("%s: Error %d free the slot \n", __func__, res->sr_status);
 out_noaction:
        return ret;
+session_recover:
+       nfs4_schedule_session_recovery(session, res->sr_status);
+       goto retry_nowait;
+retry_new_seq:
+       ++slot->seq_nr;
 retry_nowait:
        if (rpc_restart_call_prepare(task)) {
                nfs41_sequence_free_slot(res);
@@ -854,6 +863,17 @@ static const struct rpc_call_ops nfs41_call_sync_ops = {
        .rpc_call_done = nfs41_call_sync_done,
 };
 
+static void
+nfs4_sequence_process_interrupted(struct nfs_client *client,
+               struct nfs4_slot *slot, struct rpc_cred *cred)
+{
+       struct rpc_task *task;
+
+       task = _nfs41_proc_sequence(client, cred, slot, true);
+       if (!IS_ERR(task))
+               rpc_put_task_async(task);
+}
+
 #else  /* !CONFIG_NFS_V4_1 */
 
 static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res)
@@ -874,9 +894,34 @@ int nfs4_sequence_done(struct rpc_task *task,
 }
 EXPORT_SYMBOL_GPL(nfs4_sequence_done);
 
+static void
+nfs4_sequence_process_interrupted(struct nfs_client *client,
+               struct nfs4_slot *slot, struct rpc_cred *cred)
+{
+       WARN_ON_ONCE(1);
+       slot->interrupted = 0;
+}
+
 #endif /* !CONFIG_NFS_V4_1 */
 
-int nfs4_setup_sequence(const struct nfs_client *client,
+static
+void nfs4_sequence_attach_slot(struct nfs4_sequence_args *args,
+               struct nfs4_sequence_res *res,
+               struct nfs4_slot *slot)
+{
+       if (!slot)
+               return;
+       slot->privileged = args->sa_privileged ? 1 : 0;
+       args->sa_slot = slot;
+
+       res->sr_slot = slot;
+       res->sr_timestamp = jiffies;
+       res->sr_status_flags = 0;
+       res->sr_status = 1;
+
+}
+
+int nfs4_setup_sequence(struct nfs_client *client,
                        struct nfs4_sequence_args *args,
                        struct nfs4_sequence_res *res,
                        struct rpc_task *task)
@@ -894,29 +939,28 @@ int nfs4_setup_sequence(const struct nfs_client *client,
                task->tk_timeout = 0;
        }
 
-       spin_lock(&tbl->slot_tbl_lock);
-       /* The state manager will wait until the slot table is empty */
-       if (nfs4_slot_tbl_draining(tbl) && !args->sa_privileged)
-               goto out_sleep;
+       for (;;) {
+               spin_lock(&tbl->slot_tbl_lock);
+               /* The state manager will wait until the slot table is empty */
+               if (nfs4_slot_tbl_draining(tbl) && !args->sa_privileged)
+                       goto out_sleep;
+
+               slot = nfs4_alloc_slot(tbl);
+               if (IS_ERR(slot)) {
+                       /* Try again in 1/4 second */
+                       if (slot == ERR_PTR(-ENOMEM))
+                               task->tk_timeout = HZ >> 2;
+                       goto out_sleep;
+               }
+               spin_unlock(&tbl->slot_tbl_lock);
 
-       slot = nfs4_alloc_slot(tbl);
-       if (IS_ERR(slot)) {
-               /* Try again in 1/4 second */
-               if (slot == ERR_PTR(-ENOMEM))
-                       task->tk_timeout = HZ >> 2;
-               goto out_sleep;
+               if (likely(!slot->interrupted))
+                       break;
+               nfs4_sequence_process_interrupted(client,
+                               slot, task->tk_msg.rpc_cred);
        }
-       spin_unlock(&tbl->slot_tbl_lock);
-
-       slot->privileged = args->sa_privileged ? 1 : 0;
-       args->sa_slot = slot;
 
-       res->sr_slot = slot;
-       if (session) {
-               res->sr_timestamp = jiffies;
-               res->sr_status_flags = 0;
-               res->sr_status = 1;
-       }
+       nfs4_sequence_attach_slot(args, res, slot);
 
        trace_nfs4_setup_sequence(session, args);
 out_start:
@@ -8151,6 +8195,7 @@ static const struct rpc_call_ops nfs41_sequence_ops = {
 
 static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
                struct rpc_cred *cred,
+               struct nfs4_slot *slot,
                bool is_privileged)
 {
        struct nfs4_sequence_data *calldata;
@@ -8164,15 +8209,18 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
                .callback_ops = &nfs41_sequence_ops,
                .flags = RPC_TASK_ASYNC | RPC_TASK_TIMEOUT,
        };
+       struct rpc_task *ret;
 
+       ret = ERR_PTR(-EIO);
        if (!atomic_inc_not_zero(&clp->cl_count))
-               return ERR_PTR(-EIO);
+               goto out_err;
+
+       ret = ERR_PTR(-ENOMEM);
        calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
-       if (calldata == NULL) {
-               nfs_put_client(clp);
-               return ERR_PTR(-ENOMEM);
-       }
+       if (calldata == NULL)
+               goto out_put_clp;
        nfs4_init_sequence(&calldata->args, &calldata->res, 0);
+       nfs4_sequence_attach_slot(&calldata->args, &calldata->res, slot);
        if (is_privileged)
                nfs4_set_sequence_privileged(&calldata->args);
        msg.rpc_argp = &calldata->args;
@@ -8180,7 +8228,15 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
        calldata->clp = clp;
        task_setup_data.callback_data = calldata;
 
-       return rpc_run_task(&task_setup_data);
+       ret = rpc_run_task(&task_setup_data);
+       if (IS_ERR(ret))
+               goto out_err;
+       return ret;
+out_put_clp:
+       nfs_put_client(clp);
+out_err:
+       nfs41_release_slot(slot);
+       return ret;
 }
 
 static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cred, unsigned renew_flags)
@@ -8190,7 +8246,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr
 
        if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0)
                return -EAGAIN;
-       task = _nfs41_proc_sequence(clp, cred, false);
+       task = _nfs41_proc_sequence(clp, cred, NULL, false);
        if (IS_ERR(task))
                ret = PTR_ERR(task);
        else
@@ -8204,7 +8260,7 @@ static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred)
        struct rpc_task *task;
        int ret;
 
-       task = _nfs41_proc_sequence(clp, cred, true);
+       task = _nfs41_proc_sequence(clp, cred, NULL, true);
        if (IS_ERR(task)) {
                ret = PTR_ERR(task);
                goto out;
index 28825a5b6d098f5fbfad1741e0476f7601f41a56..902b72dac41a611397ce04d39d2ab96f5c733602 100644 (file)
@@ -269,6 +269,13 @@ int orangefs_getattr(const struct path *path, struct kstat *stat,
                else
                        stat->result_mask = STATX_BASIC_STATS &
                            ~STATX_SIZE;
+
+               stat->attributes_mask = STATX_ATTR_IMMUTABLE |
+                   STATX_ATTR_APPEND;
+               if (inode->i_flags & S_IMMUTABLE)
+                       stat->attributes |= STATX_ATTR_IMMUTABLE;
+               if (inode->i_flags & S_APPEND)
+                       stat->attributes |= STATX_ATTR_APPEND;
        }
        return ret;
 }
index f8f3c73d266476eab2298a15a807d2829398b0ff..05b3abbdbc4bf9eee2c6c1738132ad6508015d4e 100644 (file)
@@ -314,6 +314,13 @@ static int orangefs_symlink(struct inode *dir,
                ret = PTR_ERR(inode);
                goto out;
        }
+       /*
+        * This is necessary because orangefs_inode_getattr will not
+        * re-read symlink size as it is impossible for it to change.
+        * Invalidating the cache does not help.  orangefs_new_inode
+        * does not set the correct size (it does not know symname).
+        */
+       inode->i_size = strlen(symname);
 
        gossip_debug(GOSSIP_NAME_DEBUG,
                     "Assigned symlink inode new number of %pU\n",
index f144216febc642fd70512df9dddefe1a7f119478..9397628a196714dc2177552465fe91fd18b9627d 100644 (file)
@@ -58,7 +58,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
 static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
                                          struct virtio_net_hdr *hdr,
                                          bool little_endian,
-                                         bool has_data_valid)
+                                         bool has_data_valid,
+                                         int vlan_hlen)
 {
        memset(hdr, 0, sizeof(*hdr));   /* no info leak */
 
@@ -83,12 +84,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb,
 
        if (skb->ip_summed == CHECKSUM_PARTIAL) {
                hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM;
-               if (skb_vlan_tag_present(skb))
-                       hdr->csum_start = __cpu_to_virtio16(little_endian,
-                               skb_checksum_start_offset(skb) + VLAN_HLEN);
-               else
-                       hdr->csum_start = __cpu_to_virtio16(little_endian,
-                               skb_checksum_start_offset(skb));
+               hdr->csum_start = __cpu_to_virtio16(little_endian,
+                       skb_checksum_start_offset(skb) + vlan_hlen);
                hdr->csum_offset = __cpu_to_virtio16(little_endian,
                                skb->csum_offset);
        } else if (has_data_valid &&
index c4f5caaf37786d54596ab63aac497b7e06066af8..f6a3543e52477d0b3ec6c883fff554c4e924e0d6 100644 (file)
@@ -45,8 +45,15 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg,
                          struct flowi6 *fl6, struct ipcm6_cookie *ipc6,
                          struct sockcm_cookie *sockc);
 
-void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
-                            __u16 srcp, __u16 destp, int bucket);
+void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
+                              __u16 srcp, __u16 destp, int rqueue, int bucket);
+static inline void
+ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, __u16 srcp,
+                       __u16 destp, int bucket)
+{
+       __ip6_dgram_sock_seq_show(seq, sp, srcp, destp, sk_rmem_alloc_get(sp),
+                                 bucket);
+}
 
 #define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
 
index 6c759c8594e25c7f9f79dc6bf76325c39e705f94..18391015233ef26daf3651b11f112ec1a63bf790 100644 (file)
@@ -244,6 +244,11 @@ static inline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb,
        return htons((((u64) hash * (max - min)) >> 32) + min);
 }
 
+static inline int udp_rqueue_get(struct sock *sk)
+{
+       return sk_rmem_alloc_get(sk) - READ_ONCE(udp_sk(sk)->forward_deficit);
+}
+
 /* net/ipv4/udp.c */
 void udp_destruct_sock(struct sock *sk);
 void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len);
index dee049a0ec5b126a373cbb6f8f29707b526518cd..6774e0369ebecf79484aa2f1b55fabb7b89ab042 100644 (file)
@@ -409,6 +409,7 @@ static void wb_exit(struct bdi_writeback *wb)
  * protected.
  */
 static DEFINE_SPINLOCK(cgwb_lock);
+static struct workqueue_struct *cgwb_release_wq;
 
 /**
  * wb_congested_get_create - get or create a wb_congested
@@ -519,7 +520,7 @@ static void cgwb_release(struct percpu_ref *refcnt)
 {
        struct bdi_writeback *wb = container_of(refcnt, struct bdi_writeback,
                                                refcnt);
-       schedule_work(&wb->release_work);
+       queue_work(cgwb_release_wq, &wb->release_work);
 }
 
 static void cgwb_kill(struct bdi_writeback *wb)
@@ -783,6 +784,21 @@ static void cgwb_bdi_register(struct backing_dev_info *bdi)
        spin_unlock_irq(&cgwb_lock);
 }
 
+static int __init cgwb_init(void)
+{
+       /*
+        * There can be many concurrent release work items overwhelming
+        * system_wq.  Put them in a separate wq and limit concurrency.
+        * There's no point in executing many of these in parallel.
+        */
+       cgwb_release_wq = alloc_workqueue("cgwb_release", 0, 1);
+       if (!cgwb_release_wq)
+               return -ENOMEM;
+
+       return 0;
+}
+subsys_initcall(cgwb_init);
+
 #else  /* CONFIG_CGROUP_WRITEBACK */
 
 static int cgwb_bdi_init(struct backing_dev_info *bdi)
index 406caa6538092dd36856837d13ea9633f190857a..8c7ae1c868e89e8a70ce7a6516a35b0dcd4f708b 100644 (file)
@@ -3993,7 +3993,6 @@ retry:
         * orientated.
         */
        if (!(alloc_flags & ALLOC_CPUSET) || reserve_flags) {
-               ac->zonelist = node_zonelist(numa_node_id(), gfp_mask);
                ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
                                        ac->high_zoneidx, ac->nodemask);
        }
index fcc9aa72877d685986b1ec52df13bc5a650fbcad..374d586b4a2c2e0592357c3566448c67278b9a9e 100644 (file)
@@ -79,7 +79,8 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
        if (unlikely(ds->cpu_port_mask & BIT(source_port)))
                return NULL;
 
-       pskb_trim_rcsum(skb, skb->len - 4);
+       if (pskb_trim_rcsum(skb, skb->len - 4))
+               return NULL;
 
        skb->dev = ds->ports[source_port].netdev;
 
index cab4b935e4743e0a3bc7233c924f3c6b2a61ab11..a95ccdceb79799b22339201d047bb4925d7d106d 100644 (file)
@@ -1675,6 +1675,10 @@ process:
                        reqsk_put(req);
                        goto discard_it;
                }
+               if (tcp_checksum_complete(skb)) {
+                       reqsk_put(req);
+                       goto csum_error;
+               }
                if (unlikely(sk->sk_state != TCP_LISTEN)) {
                        inet_csk_reqsk_queue_drop_and_put(sk, req);
                        goto lookup;
index b0ad62bd38f70fc2c4721801cdb4dc26621c52e4..5752bf7593dc4ddaf527c6b783a82440783dfc1e 100644 (file)
@@ -2720,7 +2720,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
                " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d",
                bucket, src, srcp, dest, destp, sp->sk_state,
                sk_wmem_alloc_get(sp),
-               sk_rmem_alloc_get(sp),
+               udp_rqueue_get(sp),
                0, 0L, 0,
                from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)),
                0, sock_i_ino(sp),
index d0390d844ac840e4db3da1f9257e14ded78ba333..d9ad986c7b2c9e073616c63d6d5ab376d2b72d5f 100644 (file)
@@ -163,7 +163,7 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
 static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
                void *info)
 {
-       r->idiag_rqueue = sk_rmem_alloc_get(sk);
+       r->idiag_rqueue = udp_rqueue_get(sk);
        r->idiag_wqueue = sk_wmem_alloc_get(sk);
 }
 
index 287112da3c060b1e8b5e5f3002a04a3eb7485935..453dc3726199019e1c5d561ecfbcdec06d0a2c38 100644 (file)
@@ -1026,8 +1026,8 @@ exit_f:
 }
 EXPORT_SYMBOL_GPL(ip6_datagram_send_ctl);
 
-void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
-                            __u16 srcp, __u16 destp, int bucket)
+void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
+                              __u16 srcp, __u16 destp, int rqueue, int bucket)
 {
        const struct in6_addr *dest, *src;
 
@@ -1043,7 +1043,7 @@ void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
                   dest->s6_addr32[2], dest->s6_addr32[3], destp,
                   sp->sk_state,
                   sk_wmem_alloc_get(sp),
-                  sk_rmem_alloc_get(sp),
+                  rqueue,
                   0, 0L, 0,
                   from_kuid_munged(seq_user_ns(seq), sock_i_uid(sp)),
                   0,
index 235d61e842722b2fe8e68aa3c47e117f33e6ea69..49aca95c8a020a93d73fb863b78252f5bffaa898 100644 (file)
@@ -1476,9 +1476,6 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
        const struct in6_addr *daddr, *saddr;
        struct rt6_info *rt6 = (struct rt6_info *)dst;
 
-       if (rt6->rt6i_flags & RTF_LOCAL)
-               return;
-
        if (dst_metric_locked(dst, RTAX_MTU))
                return;
 
index 237cc6187c5a477c7699d993b4386c5a7bca238c..35e8aef9ceedd1919cf7dbfdd9e7b04531c8b4d0 100644 (file)
@@ -1453,6 +1453,10 @@ process:
                        reqsk_put(req);
                        goto discard_it;
                }
+               if (tcp_checksum_complete(skb)) {
+                       reqsk_put(req);
+                       goto csum_error;
+               }
                if (unlikely(sk->sk_state != TCP_LISTEN)) {
                        inet_csk_reqsk_queue_drop_and_put(sk, req);
                        goto lookup;
index 0146dcdc5c40f31571a1e875cda2f441c58f9505..330d5ea8451b53c0b5b049f47c473e041f9ad24a 100644 (file)
@@ -1503,7 +1503,8 @@ int udp6_seq_show(struct seq_file *seq, void *v)
                struct inet_sock *inet = inet_sk(v);
                __u16 srcp = ntohs(inet->inet_sport);
                __u16 destp = ntohs(inet->inet_dport);
-               ip6_dgram_sock_seq_show(seq, v, srcp, destp, bucket);
+               __ip6_dgram_sock_seq_show(seq, v, srcp, destp,
+                                         udp_rqueue_get(v), bucket);
        }
        return 0;
 }
index 7806e166669a836e18145fb69587a595e1dcd60b..4fe2e34522d6c1512d3235aa7ab8199fc5f8138f 100644 (file)
@@ -2046,7 +2046,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb,
                return -EINVAL;
        *len -= sizeof(vnet_hdr);
 
-       if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le(), true))
+       if (virtio_net_hdr_from_skb(skb, &vnet_hdr, vio_le(), true, 0))
                return -EINVAL;
 
        return memcpy_to_msg(msg, (void *)&vnet_hdr, sizeof(vnet_hdr));
@@ -2313,7 +2313,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
        if (do_vnet) {
                if (virtio_net_hdr_from_skb(skb, h.raw + macoff -
                                            sizeof(struct virtio_net_hdr),
-                                           vio_le(), true)) {
+                                           vio_le(), true, 0)) {
                        spin_lock(&sk->sk_receive_queue.lock);
                        goto drop_n_account;
                }
index b5f80e675783b3cb3fcd02a67dd04e199b39ee85..f3ed63aa41110f2a029829a16c5da2aeccc106cc 100644 (file)
@@ -53,22 +53,22 @@ static void tcf_simp_release(struct tc_action *a, int bind)
        kfree(d->tcfd_defdata);
 }
 
-static int alloc_defdata(struct tcf_defact *d, char *defdata)
+static int alloc_defdata(struct tcf_defact *d, const struct nlattr *defdata)
 {
        d->tcfd_defdata = kzalloc(SIMP_MAX_DATA, GFP_KERNEL);
        if (unlikely(!d->tcfd_defdata))
                return -ENOMEM;
-       strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
+       nla_strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
        return 0;
 }
 
-static void reset_policy(struct tcf_defact *d, char *defdata,
+static void reset_policy(struct tcf_defact *d, const struct nlattr *defdata,
                         struct tc_defact *p)
 {
        spin_lock_bh(&d->tcf_lock);
        d->tcf_action = p->action;
        memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
-       strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
+       nla_strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
        spin_unlock_bh(&d->tcf_lock);
 }
 
@@ -87,7 +87,6 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
        struct tcf_defact *d;
        bool exists = false;
        int ret = 0, err;
-       char *defdata;
 
        if (nla == NULL)
                return -EINVAL;
@@ -110,8 +109,6 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
                return -EINVAL;
        }
 
-       defdata = nla_data(tb[TCA_DEF_DATA]);
-
        if (!exists) {
                ret = tcf_idr_create(tn, parm->index, est, a,
                                     &act_simp_ops, bind, false);
@@ -119,7 +116,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
                        return ret;
 
                d = to_defact(*a);
-               ret = alloc_defdata(d, defdata);
+               ret = alloc_defdata(d, tb[TCA_DEF_DATA]);
                if (ret < 0) {
                        tcf_idr_release(*a, bind);
                        return ret;
@@ -133,7 +130,7 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla,
                if (!ovr)
                        return -EEXIST;
 
-               reset_policy(d, defdata, parm);
+               reset_policy(d, tb[TCA_DEF_DATA], parm);
        }
 
        if (ret == ACT_P_CREATED)
index 43d2f17f5eeaceb4f1c5ea6b977db56f57200245..8b2bef6cfe4205ad3f72743014d665ffcb9ba989 100644 (file)
@@ -538,7 +538,10 @@ static int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
        if (!err && (iattr->ia_valid & ATTR_UID)) {
                struct socket *sock = SOCKET_I(d_inode(dentry));
 
-               sock->sk->sk_uid = iattr->ia_uid;
+               if (sock->sk)
+                       sock->sk->sk_uid = iattr->ia_uid;
+               else
+                       err = -ENOENT;
        }
 
        return err;
@@ -588,12 +591,16 @@ EXPORT_SYMBOL(sock_alloc);
  *     an inode not a file.
  */
 
-void sock_release(struct socket *sock)
+static void __sock_release(struct socket *sock, struct inode *inode)
 {
        if (sock->ops) {
                struct module *owner = sock->ops->owner;
 
+               if (inode)
+                       inode_lock(inode);
                sock->ops->release(sock);
+               if (inode)
+                       inode_unlock(inode);
                sock->ops = NULL;
                module_put(owner);
        }
@@ -608,6 +615,11 @@ void sock_release(struct socket *sock)
        }
        sock->file = NULL;
 }
+
+void sock_release(struct socket *sock)
+{
+       __sock_release(sock, NULL);
+}
 EXPORT_SYMBOL(sock_release);
 
 void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags)
@@ -1122,7 +1134,7 @@ static int sock_mmap(struct file *file, struct vm_area_struct *vma)
 
 static int sock_close(struct inode *inode, struct file *filp)
 {
-       sock_release(SOCKET_I(inode));
+       __sock_release(SOCKET_I(inode), inode);
        return 0;
 }
 
index 83f886d7c1f8b8b67b3d7097822875b609e8a42b..3c86614462f6d31c3c54caa7809fc82f92834e5f 100644 (file)
@@ -211,18 +211,12 @@ static void tls_free_both_sg(struct sock *sk)
 }
 
 static int tls_do_encryption(struct tls_context *tls_ctx,
-                            struct tls_sw_context *ctx, size_t data_len,
-                            gfp_t flags)
+                            struct tls_sw_context *ctx,
+                            struct aead_request *aead_req,
+                            size_t data_len)
 {
-       unsigned int req_size = sizeof(struct aead_request) +
-               crypto_aead_reqsize(ctx->aead_send);
-       struct aead_request *aead_req;
        int rc;
 
-       aead_req = kzalloc(req_size, flags);
-       if (!aead_req)
-               return -ENOMEM;
-
        ctx->sg_encrypted_data[0].offset += tls_ctx->prepend_size;
        ctx->sg_encrypted_data[0].length -= tls_ctx->prepend_size;
 
@@ -235,7 +229,6 @@ static int tls_do_encryption(struct tls_context *tls_ctx,
        ctx->sg_encrypted_data[0].offset -= tls_ctx->prepend_size;
        ctx->sg_encrypted_data[0].length += tls_ctx->prepend_size;
 
-       kfree(aead_req);
        return rc;
 }
 
@@ -244,8 +237,14 @@ static int tls_push_record(struct sock *sk, int flags,
 {
        struct tls_context *tls_ctx = tls_get_ctx(sk);
        struct tls_sw_context *ctx = tls_sw_ctx(tls_ctx);
+       struct aead_request *req;
        int rc;
 
+       req = kzalloc(sizeof(struct aead_request) +
+                     crypto_aead_reqsize(ctx->aead_send), sk->sk_allocation);
+       if (!req)
+               return -ENOMEM;
+
        sg_mark_end(ctx->sg_plaintext_data + ctx->sg_plaintext_num_elem - 1);
        sg_mark_end(ctx->sg_encrypted_data + ctx->sg_encrypted_num_elem - 1);
 
@@ -261,15 +260,14 @@ static int tls_push_record(struct sock *sk, int flags,
        tls_ctx->pending_open_record_frags = 0;
        set_bit(TLS_PENDING_CLOSED_RECORD, &tls_ctx->flags);
 
-       rc = tls_do_encryption(tls_ctx, ctx, ctx->sg_plaintext_size,
-                              sk->sk_allocation);
+       rc = tls_do_encryption(tls_ctx, ctx, req, ctx->sg_plaintext_size);
        if (rc < 0) {
                /* If we are called from write_space and
                 * we fail, we need to set this SOCK_NOSPACE
                 * to trigger another write_space in the future.
                 */
                set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
-               return rc;
+               goto out_req;
        }
 
        free_sg(sk, ctx->sg_plaintext_data, &ctx->sg_plaintext_num_elem,
@@ -284,6 +282,8 @@ static int tls_push_record(struct sock *sk, int flags,
                tls_err_abort(sk);
 
        tls_advance_record_sn(sk, tls_ctx);
+out_req:
+       kfree(req);
        return rc;
 }
 
index d1eb14842340e63dc20d0ad8a187cc131c3570a1..a12e594d4e3b3a23d78cc0b75531b845c7b6e331 100644 (file)
@@ -748,8 +748,10 @@ int snd_hda_attach_pcm_stream(struct hda_bus *_bus, struct hda_codec *codec,
                return err;
        strlcpy(pcm->name, cpcm->name, sizeof(pcm->name));
        apcm = kzalloc(sizeof(*apcm), GFP_KERNEL);
-       if (apcm == NULL)
+       if (apcm == NULL) {
+               snd_device_free(chip->card, pcm);
                return -ENOMEM;
+       }
        apcm->chip = chip;
        apcm->pcm = pcm;
        apcm->codec = codec;
index 5b4dbcec6de8dab957f045786d4808b4edfd573f..ba9a7e552183392b1d07d535a91bdd9206cea65d 100644 (file)
@@ -959,12 +959,15 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
        SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
        SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK),
        SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK),
+       SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK),
+       SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK),
        SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
        SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
        SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
        SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
        SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
        SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
        SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
index 6ae061183efffc105af43a6dcb7dd4a84486960f..2a8aa2bc5c302aecef0cebbc8855aee81cbdc8b1 100644 (file)
@@ -6439,7 +6439,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
        SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
        SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
-       SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
        SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
        SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
        SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
@@ -6610,6 +6609,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x12, 0x90a60140},
                {0x14, 0x90170110},
                {0x21, 0x02211020}),
+       SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
+               {0x12, 0x90a60140},
+               {0x14, 0x90170110},
+               {0x19, 0x02a11030},
+               {0x21, 0x02211020}),
        SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
                {0x12, 0x90a60140},
                {0x14, 0x90170150},