Linux 4.17.6
Greg KH
maintainerI'm announcing the release of the 4.17.6 kernel.
All users of the 4.17 kernel series must upgrade.
The updated 4.17.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.17.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm/boot/dts/am3517.dtsi | 4 arch/arm/boot/dts/dra7.dtsi | 2 arch/arm/boot/dts/imx51-zii-rdu1.dts | 2 arch/s390/kernel/entry.S | 4 drivers/acpi/acpica/uterror.c | 6 - drivers/acpi/battery.c | 9 - drivers/block/drbd/drbd_worker.c | 2 drivers/dax/super.c | 48 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 46 +------- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 131 ++++++++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 6 + drivers/gpu/drm/drm_property.c | 6 - drivers/gpu/drm/udl/udl_fb.c | 5 drivers/gpu/drm/udl/udl_transfer.c | 11 + drivers/hid/hid-core.c | 5 drivers/hid/hid-debug.c | 8 + drivers/hid/i2c-hid/i2c-hid.c | 2 drivers/hid/usbhid/hiddev.c | 11 + drivers/i2c/i2c-core-smbus.c | 12 +- drivers/md/dm-table.c | 7 - drivers/md/dm.c | 3 drivers/mtd/chips/cfi_cmdset_0002.c | 30 +++-- drivers/pci/pci-acpi.c | 12 ++ drivers/scsi/aacraid/aachba.c | 15 +- drivers/scsi/sg.c | 42 +++++++ drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 drivers/target/target_core_pr.c | 15 +- drivers/vfio/vfio_iommu_type1.c | 16 +- fs/cifs/cifsglob.h | 1 fs/cifs/cifsproto.h | 1 fs/cifs/cifssmb.c | 10 + fs/cifs/connect.c | 8 + fs/cifs/smb1ops.c | 1 fs/cifs/smb2ops.c | 3 fs/cifs/smb2pdu.c | 25 ++-- fs/cifs/smb2transport.c | 1 fs/cifs/transport.c | 18 ++- fs/ext2/super.c | 3 fs/ext4/balloc.c | 21 ++- fs/ext4/ext4.h | 8 - fs/ext4/ext4_extents.h | 1 fs/ext4/extents.c | 6 + fs/ext4/ialloc.c | 14 ++ fs/ext4/inline.c | 39 ------ fs/ext4/inode.c | 7 - fs/ext4/mballoc.c | 6 - fs/ext4/super.c | 89 +++++++++++++-- fs/ext4/xattr.c | 40 +++---- fs/jbd2/transaction.c | 9 + fs/userfaultfd.c | 12 +- fs/xfs/xfs_ioctl.c | 3 fs/xfs/xfs_iops.c | 30 ++++- fs/xfs/xfs_super.c | 10 + include/linux/dax.h | 11 + include/linux/hid.h | 3 kernel/trace/trace_events_hist.c | 2 kernel/trace/trace_functions_graph.c | 5 mm/debug.c | 18 ++- mm/hugetlb.c | 1 mm/vmstat.c | 2 net/netfilter/nf_log.c | 9 + 62 files changed, 595 insertions(+), 286 deletions(-)
Adam Ford (1):
ARM: dts: omap3: Fix am3517 mdio and emac clock references
Arnd Bergmann (1):
tracing: Avoid string overflow
Benjamin Tissoires (1):
HID: core: allow concurrent registration of drivers
Cannon Matthews (1):
mm: hugetlb: yield when prepping struct pages
Changbin Du (1):
tracing: Fix missing return symbol in function_graph output
Christian Borntraeger (1):
s390: Correct register corruption in critical section cleanup
Dan Carpenter (1):
staging: comedi: quatech_daqp_cs: fix no-op loop daqp_ao_insn_write()
Daniel Rosenberg (1):
HID: debug: check length before copy_to_user()
Darrick J. Wong (1):
fs: allow per-device dax status checking for filesystems
Dave Jiang (1):
dax: change bdev_dax_supported() to support boolean returns
David Disseldorp (1):
scsi: target: Fix truncated PR-in ReadKeys response
Greg Kroah-Hartman (1):
Linux 4.17.6
Gustavo A. R. Silva (1):
HID: hiddev: fix potential Spectre v1
Jann Horn (2):
scsi: sg: mitigate read/write abuse
netfilter: nf_log: don't hold nf_log_mutex during user access
Janosch Frank (1):
userfaultfd: hugetlbfs: fix userfaultfd_huge_must_wait() pte access
Jason Andryuk (1):
HID: i2c-hid: Fix "incomplete report" noise
Jason Gunthorpe (1):
vfio: Use get_user_pages_longterm correctly
Jon Derrick (1):
ext4: check superblock mapped prior to committing
Jouke Witteveen (1):
ACPI / battery: Safe unregistering of hooks
Lars Ellenberg (1):
drbd: fix access after free
Lars Persson (1):
cifs: Fix use after free of a mid_q_entry
Lyude Paul (3):
drm/amdgpu: Make struct amdgpu_atif private to amdgpu_acpi.c drm/amdgpu: Add amdgpu_atpx_get_dhandle() drm/amdgpu: Dynamically probe for ATIF handle (v2)
Michel Dänzer (1):
drm: Use kvzalloc for allocating blob property memory
Mikulas Patocka (1):
drm/udl: fix display corruption of the last line
Nick Dyer (1):
ARM: dts: imx51-zii-rdu1: fix touchscreen pinctrl
Paulo Alcantara (2):
cifs: Fix memory leak in smb2_set_ea()
cifs: Fix infinite loop when using hard mount option
Pavel Tatashin (1):
mm: teach dump_page() to correctly output poisoned struct pages
Peter Rosin (1):
i2c: smbus: kill memory leak on emulated and failed DMA SMBus xfers
Rafael J. Wysocki (2):
PCI / ACPI / PM: Resume bridges w/o drivers on suspend-to-RAM
ACPICA: Drop leading newlines from error messages
Raghava Aditya Renukunta (1):
scsi: aacraid: Fix PD performance regression over incorrect qd being set
Roger Quadros (1):
ARM: dts: dra7: Disable metastability workaround for USB2
Ross Zwisler (2):
dax: check for QUEUE_FLAG_DAX in bdev_dax_supported()
dm: prevent DAX mounts if not supported
Sebastian Andrzej Siewior (1):
Revert mm/vmstat.c: fix vmstat_update() preemption BUG
Stefano Brivio (1):
cifs: Fix slab-out-of-bounds in send_set_info() on SMB2 ACE setting
Theodore Ts'o (13):
jbd2: don't mark block as modified if the handle is out of credits
ext4: add corruption check in ext4_xattr_set_entry()
ext4: always verify the magic number in xattr blocks
ext4: make sure bitmaps and the inode table don't overlap with bg descriptors
ext4: always check block group bounds in ext4_init_block_bitmap()
ext4: only look at the bg_flags field if it is valid
ext4: verify the depth of extent tree in ext4_find_extent()
ext4: include the illegal physical block in the bad map ext4_error msg
ext4: clear i_data in ext4_inode_info when removing inline data
ext4: never move the system.data xattr out of the inode body
ext4: avoid running out of journal credits when appending to an inline file
ext4: add more inode number paranoia checks
ext4: add more mount time checks of the superblock
Tokunori Ikegami (3):
mtd: cfi_cmdset_0002: Change definition naming to retry write operation
mtd: cfi_cmdset_0002: Change erase functions to retry for error
mtd: cfi_cmdset_0002: Change erase functions to check chip good only
Wenwen Wang (1):
i2c: core: smbus: fix a potential missing-check bug
Greg KH
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 17 -SUBLEVEL = 5 +SUBLEVEL = 6 EXTRAVERSION = NAME = Merciless Moray
arch/arm/boot/dts/am3517.dtsi +4 -0
@@ -39,6 +39,8 @@ ti,davinci-ctrl-ram-size = <0x2000>; ti,davinci-rmii-en = /bits/ 8 <1>; local-mac-address = [ 00 00 00 00 00 00 ]; + clocks = <&emac_ick>; + clock-names = "ick"; }; davinci_mdio: ethernet@5c030000 {
@@ -49,6 +51,8 @@ bus_freq = <1000000>; #address-cells = <1>; #size-cells = <0>; + clocks = <&emac_fck>; + clock-names = "fck"; }; uart4: serial@4809e000 {
arch/arm/boot/dts/dra7.dtsi +1 -1
@@ -1582,7 +1582,6 @@ dr_mode = "otg"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; - snps,dis_metastability_quirk; }; };
@@ -1610,6 +1609,7 @@ dr_mode = "otg"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; + snps,dis_metastability_quirk; }; };
arch/arm/boot/dts/imx51-zii-rdu1.dts +1 -1
@@ -768,7 +768,7 @@ pinctrl_ts: tsgrp { fsl,pins = < - MX51_PAD_CSI1_D8__GPIO3_12 0x85 + MX51_PAD_CSI1_D8__GPIO3_12 0x04 MX51_PAD_CSI1_D9__GPIO3_13 0x85 >; };
arch/s390/kernel/entry.S +2 -2
@@ -1265,7 +1265,7 @@ cleanup_critical: jl 0f clg %r9,BASED(.Lcleanup_table+104) # .Lload_fpu_regs_end jl .Lcleanup_load_fpu_regs -0: BR_EX %r14 +0: BR_EX %r14,%r11 .align 8 .Lcleanup_table:
@@ -1301,7 +1301,7 @@ cleanup_critical: ni __SIE_PROG0C+3(%r9),0xfe # no longer in SIE lctlg %c1,%c1,__LC_USER_ASCE # load primary asce larl %r9,sie_exit # skip forward to sie_exit - BR_EX %r14 + BR_EX %r14,%r11 #endif .Lcleanup_system_call:
drivers/acpi/acpica/uterror.c +3 -3
@@ -182,19 +182,19 @@ acpi_ut_prefixed_namespace_error(const char *module_name,switch (lookup_status) {case AE_ALREADY_EXISTS : -acpi_os_printf ("\n" ACPI_MSG_BIOS_ERROR ); +acpi_os_printf (ACPI_MSG_BIOS_ERROR ); message ="Failure creating" ;break ;case AE_NOT_FOUND : -acpi_os_printf ("\n" ACPI_MSG_BIOS_ERROR ); +acpi_os_printf (ACPI_MSG_BIOS_ERROR ); message ="Could not resolve" ;break ;default : -acpi_os_printf ("\n" ACPI_MSG_ERROR ); +acpi_os_printf (ACPI_MSG_ERROR ); message ="Failure resolving" ;break ; }
drivers/acpi/battery.c +5 -4
@@ -709,10 +709,11 @@ void battery_hook_register(struct acpi_battery_hook *hook)*/ pr_err ("extension failed to load: %s" , hook->name);__battery_hook_unregister (hook,0 ); -return ; + goto end; } }pr_info ("new extension: %s\n" , hook->name); +end:mutex_unlock (&hook_mutex); }EXPORT_SYMBOL_GPL (battery_hook_register);
@@ -724,7 +725,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register);*/ static void battery_hook_add_battery (struct acpi_battery *battery) { -struct acpi_battery_hook *hook_node; +struct acpi_battery_hook *hook_node, *tmp;mutex_lock (&hook_mutex);INIT_LIST_HEAD (&battery->list);
@@ -736,15 +737,15 @@ static void battery_hook_add_battery(struct acpi_battery *battery)* when a battery gets hotplugged or initialized * during the battery module initialization. */ -list_for_each_entry (hook_node, &battery_hook_list, list) { +list_for_each_entry_safe (hook_node, tmp, &battery_hook_list, list) {if (hook_node->add_battery (battery->bat)) {/* * The notification of the extensions has failed, to * prevent further errors we will unload the extension. */ -__battery_hook_unregister (hook_node,0 );pr_err ("error in extension, unloading: %s" , hook_node->name); +__battery_hook_unregister (hook_node,0 ); } }mutex_unlock (&hook_mutex);
drivers/block/drbd/drbd_worker.c +1 -1
@@ -282,8 +282,8 @@ void drbd_request_endio(struct bio *bio) what =COMPLETED_OK ; } -bio_put (req->private_bio); req->private_bio =ERR_PTR (blk_status_to_errno (bio->bi_status)); +bio_put (bio);/* not req_mod(), we need irqsave here! */ spin_lock_irqsave (&device->resource->req_lock, flags);
drivers/dax/super.c +28 -20
91 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -38
70 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +108 -23
236 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +6 -0
@@ -90,6 +90,12 @@ bool amdgpu_atpx_dgpu_req_power_for_displays(void) {return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays; } +#if defined(CONFIG_ACPI ) +void *amdgpu_atpx_get_dhandle (void ) { +return amdgpu_atpx_priv.dhandle; +} +#endif +/** * amdgpu_atpx_call - call an ATPX method *
drivers/gpu/drm/drm_property.c +3 -3
@@ -533,7 +533,7 @@ static void drm_property_free_blob(struct kref *kref)drm_mode_object_unregister (blob->dev, &blob->base); -kfree (blob); +kvfree (blob); }/**
@@ -560,7 +560,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,if (!length || length >ULONG_MAX -sizeof (struct drm_property_blob ))return ERR_PTR (-EINVAL ); - blob =kzalloc (sizeof (struct drm_property_blob )+length,GFP_KERNEL ); + blob =kvzalloc (sizeof (struct drm_property_blob )+length,GFP_KERNEL );if (!blob)return ERR_PTR (-ENOMEM );
@@ -577,7 +577,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, ret =__drm_mode_object_add (dev, &blob->base,DRM_MODE_OBJECT_BLOB , true, drm_property_free_blob);if (ret) { -kfree (blob); +kvfree (blob);return ERR_PTR (-EINVAL ); }
drivers/gpu/drm/udl/udl_fb.c +4 -1
@@ -137,7 +137,10 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,if (cmd > (char *) urb->transfer_buffer) {/* Send partial buffer remaining before exiting */ -int len = cmd - (char *) urb->transfer_buffer; +int len; +if (cmd < (char *) urb->transfer_buffer + urb->transfer_buffer_length) + *cmd++ =0xAF ; + len = cmd - (char *) urb->transfer_buffer; ret =udl_submit_urb (dev, urb, len); bytes_sent += len; }else
drivers/gpu/drm/udl/udl_transfer.c +7 -4
@@ -153,11 +153,11 @@ static void udl_compress_hline16( raw_pixels_count_byte = cmd++;/* we'll know this later */ raw_pixel_start = pixel; - cmd_pixel_end = pixel + (min (MAX_CMD_PIXELS +1 , -min ((int )(pixel_end - pixel) / bpp, - (int )(cmd_buffer_end - cmd) /2 ))) * bpp; + cmd_pixel_end = pixel +min3 (MAX_CMD_PIXELS +1UL , + (unsigned long )(pixel_end - pixel) / bpp, + (unsigned long )(cmd_buffer_end -1 - cmd) /2 ) * bpp; -prefetch_range ((void *) pixel, (cmd_pixel_end - pixel) * bpp); +prefetch_range ((void *) pixel, cmd_pixel_end - pixel); pixel_val16 =get_pixel_val16 (pixel, bpp);while (pixel < cmd_pixel_end) {
@@ -193,6 +193,9 @@ static void udl_compress_hline16(if (pixel > raw_pixel_start) {/* finalize last RAW span */ *raw_pixels_count_byte = ((pixel-raw_pixel_start) / bpp) &0xFF ; + }else { +/* undo unused byte */ + cmd--; } *cmd_pixels_count_byte = ((pixel - cmd_pixel_start) / bpp) &0xFF ;
drivers/hid/hid-core.c +4 -1
@@ -1942,6 +1942,8 @@ static int hid_device_probe(struct device *dev) } hdev->io_started = false; +clear_bit (ffs (HID_STAT_REPROBED ), &hdev->status); +if (!hdev->driver) { id =hid_match_device (hdev, hdrv);if (id ==NULL ) {
@@ -2205,7 +2207,8 @@ static int __hid_bus_reprobe_drivers(struct device *dev, void *data)struct hid_device *hdev =to_hid_device (dev);if (hdev->driver == hdrv && - !hdrv->match (hdev, hid_ignore_special_drivers)) + !hdrv->match (hdev, hid_ignore_special_drivers) && + !test_and_set_bit (ffs (HID_STAT_REPROBED ), &hdev->status))return device_reprobe (dev);return 0 ;
drivers/hid/hid-debug.c +7 -1
@@ -1154,6 +1154,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, goto out;if (list->tail > list->head) { len = list->tail - list->head; +if (len > count) + len = count;if (copy_to_user (buffer + ret, &list->hid_debug_buf[list->head], len)) { ret = -EFAULT ;
@@ -1163,6 +1165,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, list->head += len; }else { len =HID_DEBUG_BUFSIZE - list->head; +if (len > count) + len = count;if (copy_to_user (buffer, &list->hid_debug_buf[list->head], len)) { ret = -EFAULT ;
@@ -1170,7 +1174,9 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, } list->head =0 ; ret += len; - goto copy_rest; + count -= len; +if (count >0 ) + goto copy_rest; } }
drivers/hid/i2c-hid/i2c-hid.c +1 -1
@@ -486,7 +486,7 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)return ; } -if ((ret_size > size) || (ret_size <=2 )) { +if ((ret_size > size) || (ret_size <2 )) {dev_err (&ihid->client->dev,"%s: incomplete report (%d/%d)\n" , __func__, size, ret_size);return ;
drivers/hid/usbhid/hiddev.c +11 -0
@@ -36,6 +36,7 @@#include <linux/hiddev.h> #include <linux/compat.h> #include <linux/vmalloc.h> +#include <linux/nospec.h> #include "usbhid.h" #ifdef CONFIG_USB_DYNAMIC_MINORS
@@ -469,10 +470,14 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,if (uref->field_index >= report->maxfield) goto inval; + uref->field_index =array_index_nospec (uref->field_index, + report->maxfield); field = report->field[uref->field_index];if (uref->usage_index >= field->maxusage) goto inval; + uref->usage_index =array_index_nospec (uref->usage_index, + field->maxusage); uref->usage_code = field->usage[uref->usage_index].hid;
@@ -499,6 +504,8 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,if (uref->field_index >= report->maxfield) goto inval; + uref->field_index =array_index_nospec (uref->field_index, + report->maxfield); field = report->field[uref->field_index];
@@ -753,6 +760,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (finfo.field_index >= report->maxfield)break ; + finfo.field_index =array_index_nospec (finfo.field_index, + report->maxfield); field = report->field[finfo.field_index];memset (&finfo,0 ,sizeof (finfo));
@@ -797,6 +806,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (cinfo.index >= hid->maxcollection)break ; + cinfo.index =array_index_nospec (cinfo.index, + hid->maxcollection); cinfo.type = hid->collection[cinfo.index].type; cinfo.usage = hid->collection[cinfo.index].usage;
drivers/i2c/i2c-core-smbus.c +9 -3
@@ -465,13 +465,18 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, status =i2c_transfer (adapter, msg, num);if (status <0 ) -return status; + goto cleanup; +if (status != num) { + status = -EIO ; + goto cleanup; + } + status =0 ;/* Check PEC if last message is a read */ if (i && (msg[num-1 ].flags &I2C_M_RD )) { status =i2c_smbus_check_pec (partial_pec, &msg[num-1 ]);if (status <0 ) -return status; + goto cleanup; }if (read_write ==I2C_SMBUS_READ )
@@ -497,12 +502,13 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,break ; } +cleanup:if (msg[0 ].flags &I2C_M_DMA_SAFE )kfree (msg[0 ].buf);if (msg[1 ].flags &I2C_M_DMA_SAFE )kfree (msg[1 ].buf); -return 0 ; +return status; }/**
drivers/md/dm-table.c +4 -3
@@ -885,9 +885,7 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);static int device_supports_dax (struct dm_target *ti,struct dm_dev *dev,sector_t start,sector_t len,void *data) { -struct request_queue *q =bdev_get_queue (dev->bdev); - -return q &&blk_queue_dax (q); +return bdev_dax_supported (dev->bdev,PAGE_SIZE ); }static bool dm_table_supports_dax (struct dm_table *t)
@@ -1907,6 +1905,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,if (dm_table_supports_dax (t))blk_queue_flag_set (QUEUE_FLAG_DAX , q); +else +blk_queue_flag_clear (QUEUE_FLAG_DAX , q); +if (dm_table_supports_dax_write_cache (t))dax_write_cache (t->md->dax_dev, true);
drivers/md/dm.c +1 -2
@@ -1056,8 +1056,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,if (len <1 ) goto out; nr_pages =min (len, nr_pages); -if (ti->type->direct_access) - ret = ti->type->direct_access (ti, pgoff, nr_pages, kaddr, pfn); + ret = ti->type->direct_access (ti, pgoff, nr_pages, kaddr, pfn); out:dm_put_live_table (md, srcu_idx);
drivers/mtd/chips/cfi_cmdset_0002.c +21 -9
@@ -42,7 +42,7 @@#define AMD_BOOTLOC_BUG #define FORCE_WORD_WRITE 0 -#define MAX_WORD_RETRIES 3 +#define MAX_RETRIES 3#define SST49LF004B 0x0060#define SST49LF040B 0x0050
@@ -1647,7 +1647,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,map_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_WORD_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) goto retry; ret = -EIO ;
@@ -2106,7 +2106,7 @@ static int do_panic_write_oneword(struct map_info *map, struct flchip *chip,map_write (map,CMD (0xF0 ), chip->start);/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_WORD_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) goto retry; ret = -EIO ;
@@ -2241,6 +2241,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)unsigned long int adr;DECLARE_WAITQUEUE (wait, current);int ret =0 ; +int retry_cnt =0 ; adr = cfi->addr_unlock1;
@@ -2258,6 +2259,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)ENABLE_VPP (map);xip_disable (map, chip, adr); + retry:cfi_send_gen_cmd (0xAA , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x55 , cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x80 , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );
@@ -2294,12 +2296,13 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) chip->erase_suspended =0 ; } -if (chip_ready (map, adr)) +if (chip_good (map, adr,map_word_ff (map)))break ;if (time_after (jiffies, timeo)) {printk (KERN_WARNING "MTD %s(): software timeout\n" , __func__ ); + ret = -EIO ;break ; }
@@ -2307,12 +2310,15 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)UDELAY (map, chip, adr,1000000 /HZ ); }/* Did we succeed? */ -if (!chip_good (map, adr,map_word_ff (map))) { +if (ret) {/* reset on all failures. */ map_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ - ret = -EIO ; +if (++retry_cnt <=MAX_RETRIES ) { + ret =0 ; + goto retry; + } } chip->state =FL_READY ;
@@ -2331,6 +2337,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,unsigned long timeo = jiffies +HZ ;DECLARE_WAITQUEUE (wait, current);int ret =0 ; +int retry_cnt =0 ; adr += chip->start;
@@ -2348,6 +2355,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,ENABLE_VPP (map);xip_disable (map, chip, adr); + retry:cfi_send_gen_cmd (0xAA , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x55 , cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x80 , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );
@@ -2384,7 +2392,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, chip->erase_suspended =0 ; } -if (chip_ready (map, adr)) { +if (chip_good (map, adr,map_word_ff (map))) {xip_enable (map, chip, adr);break ; }
@@ -2393,6 +2401,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,xip_enable (map, chip, adr);printk (KERN_WARNING "MTD %s(): software timeout\n" , __func__ ); + ret = -EIO ;break ; }
@@ -2400,12 +2409,15 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,UDELAY (map, chip, adr,1000000 /HZ ); }/* Did we succeed? */ -if (!chip_good (map, adr,map_word_ff (map))) { +if (ret) {/* reset on all failures. */ map_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ - ret = -EIO ; +if (++retry_cnt <=MAX_RETRIES ) { + ret =0 ; + goto retry; + } } chip->state =FL_READY ;
drivers/pci/pci-acpi.c +12 -0
@@ -598,6 +598,18 @@ static bool acpi_pci_need_resume(struct pci_dev *dev) {struct acpi_device *adev =ACPI_COMPANION (&dev->dev); +/* +* In some cases (eg. Samsung 305V4A) leaving a bridge in suspend over +* system-wide suspend/resume confuses the platform firmware, so avoid +* doing that, unless the bridge has a driver that should take care of +* the PM handling. According to Section 16.1.6 of ACPI 6.2, endpoint +* devices are expected to be in D3 before invoking the S3 entry path +* from the firmware, so they should not be affected by this issue. +*/ +if (pci_is_bridge (dev) && !dev->driver && +acpi_target_system_state () !=ACPI_STATE_S0 ) +return true; +if (!adev || !acpi_device_power_manageable (adev))return false;
drivers/scsi/aacraid/aachba.c +7 -8
@@ -1974,7 +1974,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev)u32 lun_count, nexus;u32 i, bus, target;u8 expose_flag, attribs; -u8 devtype; lun_count =aac_get_safw_phys_lun_count (dev);
@@ -1992,23 +1991,23 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev)continue ;if (expose_flag !=0 ) { - devtype =AAC_DEVTYPE_RAID_MEMBER ; - goto update_devtype; + dev->hba_map[bus][target].devtype = +AAC_DEVTYPE_RAID_MEMBER ; +continue ; }if (nexus !=0 && (attribs &8 )) { - devtype =AAC_DEVTYPE_NATIVE_RAW ; + dev->hba_map[bus][target].devtype = +AAC_DEVTYPE_NATIVE_RAW ; dev->hba_map[bus][target].rmw_nexus = nexus; }else - devtype =AAC_DEVTYPE_ARC_RAW ; + dev->hba_map[bus][target].devtype = +AAC_DEVTYPE_ARC_RAW ; dev->hba_map[bus][target].scan_counter = dev->scan_counter;aac_set_safw_target_qd (dev, bus, target); - -update_devtype: - dev->hba_map[bus][target].devtype = devtype; } }
drivers/scsi/sg.c +40 -2
67 lines not on this page · raw message
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -1
@@ -642,7 +642,7 @@ static int daqp_ao_insn_write(struct comedi_device *dev,/* Make sure D/A update mode is direct update */ outb (0 , dev->iobase +DAQP_AUX_REG ); -for (i =0 ; i > insn->n; i++) { +for (i =0 ; i < insn->n; i++) {unsigned int val = data[i];int ret;
drivers/target/target_core_pr.c +10 -5
@@ -3727,11 +3727,16 @@ core_scsi3_pri_read_keys(struct se_cmd *cmd)* Check for overflow of 8byte PRI READ_KEYS payload and * next reservation key list descriptor. */ -if ((add_len +8 ) > (cmd->data_length -8 )) -break ; - -put_unaligned_be64 (pr_reg->pr_res_key, &buf[off]); - off +=8 ; +if (off +8 <= cmd->data_length) { +put_unaligned_be64 (pr_reg->pr_res_key, &buf[off]); + off +=8 ; + } +/* +* SPC5r17: 6.16.2 READ KEYS service action +* The ADDITIONAL LENGTH field indicates the number of bytes in +* the Reservation key list. The contents of the ADDITIONAL +* LENGTH field are not altered based on the allocation length +*/ add_len +=8 ; }spin_unlock (&dev->t10_pr.registration_lock);
drivers/vfio/vfio_iommu_type1.c +7 -9
@@ -346,18 +346,16 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr,struct page *page[1 ];struct vm_area_struct *vma;struct vm_area_struct *vmas[1 ]; +unsigned int flags =0 ;int ret; +if (prot &IOMMU_WRITE ) + flags |=FOLL_WRITE ; + +down_read (&mm->mmap_sem);if (mm == current->mm) { - ret =get_user_pages_longterm (vaddr,1 , !!(prot &IOMMU_WRITE ), - page, vmas); + ret =get_user_pages_longterm (vaddr,1 , flags, page, vmas); }else { -unsigned int flags =0 ; - -if (prot &IOMMU_WRITE ) - flags |=FOLL_WRITE ; - -down_read (&mm->mmap_sem); ret =get_user_pages_remote (NULL , mm, vaddr,1 , flags, page, vmas,NULL );/*
@@ -371,8 +369,8 @@ static int vaddr_get_pfn(struct mm_struct *mm, unsigned long vaddr, ret = -EOPNOTSUPP ;put_page (page[0 ]); } -up_read (&mm->mmap_sem); } +up_read (&mm->mmap_sem);if (ret ==1 ) { *pfn =page_to_pfn (page[0 ]);
fs/cifs/cifsglob.h +1 -0
@@ -1362,6 +1362,7 @@ typedef int (mid_handle_t)(struct TCP_Server_Info *server,/* one of these for every pending CIFS request to the server */ struct mid_q_entry {struct list_head qhead;/* mids waiting on reply from this server */ +struct kref refcount;struct TCP_Server_Info *server;/* server corresponding to this mid */ __u64 mid;/* multiplex id */ __u32 pid;/* process id */
fs/cifs/cifsproto.h +1 -0
@@ -76,6 +76,7 @@ extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server);extern void DeleteMidQEntry (struct mid_q_entry *midEntry);extern void cifs_delete_mid (struct mid_q_entry *mid); +extern void cifs_mid_q_entry_release (struct mid_q_entry *midEntry);extern void cifs_wake_up_task (struct mid_q_entry *mid);extern int cifs_handle_standard (struct TCP_Server_Info *server,struct mid_q_entry *mid);
fs/cifs/cifssmb.c +8 -2
@@ -151,8 +151,14 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* greater than cifs socket timeout which is 7 seconds */ while (server->tcpStatus == CifsNeedReconnect) { -wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect),10 *HZ ); + rc =wait_event_interruptible_timeout (server->response_q, + (server->tcpStatus != CifsNeedReconnect), +10 *HZ ); +if (rc <0 ) { +cifs_dbg (FYI ,"%s: aborting reconnect due to a received" +" signal by the process\n" , __func__); +return -ERESTARTSYS ; + }/* are we still trying to reconnect? */ if (server->tcpStatus != CifsNeedReconnect)
fs/cifs/connect.c +7 -1
@@ -906,6 +906,7 @@ cifs_demultiplex_thread(void *p)continue ; server->total_read += length; + mid_entry =NULL ;if (server->ops->is_transform_hdr && server->ops->receive_transform && server->ops->is_transform_hdr (buf)) {
@@ -920,8 +921,11 @@ cifs_demultiplex_thread(void *p) length = mid_entry->receive (server, mid_entry); } -if (length <0 ) +if (length <0 ) { +if (mid_entry) +cifs_mid_q_entry_release (mid_entry);continue ; + }if (server->large_buf) buf = server->bigbuf;
@@ -938,6 +942,8 @@ cifs_demultiplex_thread(void *p)if (!mid_entry->multiRsp || mid_entry->multiEnd) mid_entry->callback (mid_entry); + +cifs_mid_q_entry_release (mid_entry); }else if (server->ops->is_oplock_break && server->ops->is_oplock_break (buf, server)) {cifs_dbg (FYI ,"Received oplock break\n" );
fs/cifs/smb1ops.c +1 -0
@@ -107,6 +107,7 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer)if (compare_mid (mid->mid, buf) && mid->mid_state ==MID_REQUEST_SUBMITTED &&le16_to_cpu (mid->command) == buf->Command) { +kref_get (&mid->refcount);spin_unlock (&GlobalMid_Lock);return mid; }
fs/cifs/smb2ops.c +3 -0
@@ -203,6 +203,7 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf)if ((mid->mid == wire_mid) && (mid->mid_state ==MID_REQUEST_SUBMITTED ) && (mid->command == shdr->Command)) { +kref_get (&mid->refcount);spin_unlock (&GlobalMid_Lock);return mid; }
@@ -654,6 +655,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, rc =SMB2_set_ea (xid, tcon, fid.persistent_fid, fid.volatile_fid, ea, len); +kfree (ea); +SMB2_close (xid, tcon, fid.persistent_fid, fid.volatile_fid);return rc;
fs/cifs/smb2pdu.c +17 -8
@@ -154,7 +154,7 @@ smb2_hdr_assemble(struct smb2_sync_hdr *shdr, __le16 smb2_cmd,static int smb2_reconnect (__le16 smb2_command,struct cifs_tcon *tcon) { -int rc =0 ; +int rc;struct nls_table *nls_codepage;struct cifs_ses *ses;struct TCP_Server_Info *server;
@@ -165,10 +165,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)* for those three - in the calling routine. */ if (tcon ==NULL ) -return rc; +return 0 ;if (smb2_command ==SMB2_TREE_CONNECT ) -return rc; +return 0 ;if (tcon->tidStatus == CifsExiting) {/*
@@ -211,8 +211,14 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)return -EAGAIN ; } -wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect),10 *HZ ); + rc =wait_event_interruptible_timeout (server->response_q, + (server->tcpStatus != CifsNeedReconnect), +10 *HZ ); +if (rc <0 ) { +cifs_dbg (FYI ,"%s: aborting reconnect due to a received" +" signal by the process\n" , __func__); +return -ERESTARTSYS ; + }/* are we still trying to reconnect? */ if (server->tcpStatus != CifsNeedReconnect)
@@ -230,7 +236,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon) }if (!tcon->ses->need_reconnect && !tcon->need_reconnect) -return rc; +return 0 ; nls_codepage =load_nls_default ();
@@ -339,7 +345,10 @@ smb2_plain_req_init(__le16 smb2_command, struct cifs_tcon *tcon,return rc;/* BB eventually switch this to SMB2 specific small buf size */ - *request_buf =cifs_small_buf_get (); +if (smb2_command ==SMB2_SET_INFO ) + *request_buf =cifs_buf_get (); +else + *request_buf =cifs_small_buf_get ();if (*request_buf ==NULL ) {/* BB should we add a retry in here if not a writepage? */ return -ENOMEM ;
@@ -3363,7 +3372,7 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon, rc =smb2_send_recv (xid, ses, iov, num, &resp_buftype, flags, &rsp_iov); -cifs_small_buf_release (req); +cifs_buf_release (req); rsp = (struct smb2_set_info_rsp *)rsp_iov.iov_base;if (rc !=0 )
fs/cifs/smb2transport.c +1 -0
@@ -548,6 +548,7 @@ smb2_mid_entry_alloc(const struct smb2_sync_hdr *shdr, temp =mempool_alloc (cifs_mid_poolp,GFP_NOFS );memset (temp,0 ,sizeof (struct mid_q_entry )); +kref_init (&temp->refcount); temp->mid =le64_to_cpu (shdr->MessageId); temp->pid = current->pid; temp->command = shdr->Command;/* Always LE */
fs/cifs/transport.c +17 -1
@@ -61,6 +61,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) temp =mempool_alloc (cifs_mid_poolp,GFP_NOFS );memset (temp,0 ,sizeof (struct mid_q_entry )); +kref_init (&temp->refcount); temp->mid =get_mid (smb_buffer); temp->pid = current->pid; temp->command =cpu_to_le16 (smb_buffer->Command);
@@ -82,6 +83,21 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)return temp; } +static void _cifs_mid_q_entry_release (struct kref *refcount) +{ + struct mid_q_entry *mid = container_of(refcount, struct mid_q_entry, + refcount); + +mempool_free (mid, cifs_mid_poolp); +} + +void cifs_mid_q_entry_release (struct mid_q_entry *midEntry) +{ +spin_lock (&GlobalMid_Lock); +kref_put (&midEntry->refcount, _cifs_mid_q_entry_release); +spin_unlock (&GlobalMid_Lock); +} +void DeleteMidQEntry (struct mid_q_entry *midEntry) {
@@ -110,7 +126,7 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) } }#endif -mempool_free (midEntry, cifs_mid_poolp); +cifs_mid_q_entry_release (midEntry); }void
fs/ext2/super.c +1 -2
@@ -961,8 +961,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) blocksize =BLOCK_SIZE <<le32_to_cpu (sbi->s_es->s_log_block_size);if (sbi->s_mount_opt &EXT2_MOUNT_DAX ) { - err =bdev_dax_supported (sb, blocksize); -if (err) { +if (!bdev_dax_supported (sb->s_bdev, blocksize)) {ext2_msg (sb,KERN_ERR ,"DAX unsupported by block device. Turning off DAX." ); sbi->s_mount_opt &= ~EXT2_MOUNT_DAX ;
fs/ext4/balloc.c +13 -8
@@ -184,7 +184,6 @@ static int ext4_init_block_bitmap(struct super_block *sb,unsigned int bit, bit_max;struct ext4_sb_info *sbi =EXT4_SB (sb);ext4_fsblk_t start, tmp; -int flex_bg =0 ;struct ext4_group_info *grp;J_ASSERT_BH (bh,buffer_locked (bh));
@@ -217,22 +216,19 @@ static int ext4_init_block_bitmap(struct super_block *sb, start =ext4_group_first_block_no (sb, block_group); -if (ext4_has_feature_flex_bg (sb)) - flex_bg =1 ; -/* Set bits for block and inode bitmaps, and inode table */ tmp =ext4_block_bitmap (sb, gdp); -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); tmp =ext4_inode_bitmap (sb, gdp); -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); tmp =ext4_inode_table (sb, gdp);for (; tmp <ext4_inode_table (sb, gdp) + sbi->s_itb_per_group; tmp++) { -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); }
@@ -455,7 +451,16 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) goto verify; }ext4_lock_group (sb, block_group); -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { +if (block_group ==0 ) { +ext4_unlock_group (sb, block_group); +unlock_buffer (bh); +ext4_error (sb,"Block bitmap for bg 0 marked " +"uninitialized" ); + err = -EFSCORRUPTED ; + goto out; + } err =ext4_init_block_bitmap (sb, bh, block_group, desc);set_bitmap_uptodate (bh);set_buffer_uptodate (bh);
fs/ext4/ext4.h +0 -8
@@ -1501,11 +1501,6 @@ static inline struct ext4_inode_info *EXT4_I(struct inode *inode)static inline int ext4_valid_inum (struct super_block *sb,unsigned long ino) {return ino ==EXT4_ROOT_INO || - ino ==EXT4_USR_QUOTA_INO || - ino ==EXT4_GRP_QUOTA_INO || - ino ==EXT4_BOOT_LOADER_INO || - ino ==EXT4_JOURNAL_INO || - ino ==EXT4_RESIZE_INO || (ino >=EXT4_FIRST_INO (sb) && ino <=le32_to_cpu (EXT4_SB (sb)->s_es->s_inodes_count)); }
@@ -3005,9 +3000,6 @@ extern int ext4_inline_data_fiemap(struct inode *inode,struct iomap ;extern int ext4_inline_data_iomap (struct inode *inode,struct iomap *iomap); -extern int ext4_try_to_evict_inline_data (handle_t *handle, -struct inode *inode, -int needed);extern int ext4_inline_data_truncate (struct inode *inode,int *has_inline);extern int ext4_convert_inline_data (struct inode *inode);
fs/ext4/ext4_extents.h +1 -0
@@ -91,6 +91,7 @@ struct ext4_extent_header { };#define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) +#define EXT4_MAX_EXTENT_DEPTH 5#define EXT4_EXTENT_TAIL_OFFSET (hdr) \ (sizeof(struct ext4_extent_header) + \
fs/ext4/extents.c +6 -0
@@ -869,6 +869,12 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block, eh =ext_inode_hdr (inode); depth =ext_depth (inode); +if (depth <0 || depth >EXT4_MAX_EXTENT_DEPTH ) { +EXT4_ERROR_INODE (inode,"inode has invalid extent depth: %d" , + depth); + ret = -EFSCORRUPTED ; + goto err; + }if (path) {ext4_ext_drop_refs (path);
fs/ext4/ialloc.c +12 -2
@@ -155,7 +155,16 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) }ext4_lock_group (sb, block_group); -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_INODE_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_INODE_UNINIT ))) { +if (block_group ==0 ) { +ext4_unlock_group (sb, block_group); +unlock_buffer (bh); +ext4_error (sb,"Inode bitmap for bg 0 marked " +"uninitialized" ); + err = -EFSCORRUPTED ; + goto out; + }memset (bh->b_data,0 , (EXT4_INODES_PER_GROUP (sb) +7 ) /8 );ext4_mark_bitmap_end (EXT4_INODES_PER_GROUP (sb), sb->s_blocksize *8 , bh->b_data);
@@ -1000,7 +1009,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,/* recheck and clear flag under lock if we still need to */ ext4_lock_group (sb, group); -if (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT );ext4_free_group_clusters_set (sb, gdp,ext4_free_clusters_after_init (sb, group, gdp));
fs/ext4/inline.c +2 -37
@@ -437,6 +437,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,memset ((void *)ext4_raw_inode (&is.iloc)->i_block,0 ,EXT4_MIN_INLINE_DATA_SIZE ); +memset (ei->i_data,0 ,EXT4_MIN_INLINE_DATA_SIZE );if (ext4_has_feature_extents (inode->i_sb)) { if (S_ISDIR(inode->i_mode) ||
@@ -886,11 +887,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, flags |=AOP_FLAG_NOFS ;if (ret == -ENOSPC ) { +ext4_journal_stop (handle); ret =ext4_da_convert_inline_data_to_extent (mapping, inode, flags, fsdata); -ext4_journal_stop (handle);if (ret == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries)) goto retry_journal;
@@ -1890,42 +1891,6 @@ int ext4_inline_data_fiemap(struct inode *inode,return (error <0 ? error :0 ); } -/* -* Called during xattr set, and if we can sparse space 'needed', -* just create the extent tree evict the data to the outer block. -* -* We use jbd2 instead of page cache to move data to the 1st block -* so that the whole transaction can be committed as a whole and -* the data isn't lost because of the delayed page cache write. -*/ -int ext4_try_to_evict_inline_data (handle_t *handle, -struct inode *inode, -int needed) -{ -int error; -struct ext4_xattr_entry *entry; -struct ext4_inode *raw_inode; -struct ext4_iloc iloc; - - error =ext4_get_inode_loc (inode, &iloc); -if (error) -return error; - - raw_inode =ext4_raw_inode (&iloc); - entry = (struct ext4_xattr_entry *)((void *)raw_inode + -EXT4_I (inode)->i_inline_off); -if (EXT4_XATTR_LEN (entry->e_name_len) + -EXT4_XATTR_SIZE (le32_to_cpu (entry->e_value_size)) < needed) { - error = -ENOSPC ; - goto out; - } - - error =ext4_convert_inline_data_nolock (handle, inode, &iloc); -out: -brelse (iloc.bh); -return error; -} -int ext4_inline_data_truncate (struct inode *inode,int *has_inline) {handle_t *handle;
fs/ext4/inode.c +4 -3
@@ -402,9 +402,9 @@ static int __check_block_validity(struct inode *inode, const char *func,if (!ext4_data_block_valid (EXT4_SB (inode->i_sb), map->m_pblk, map->m_len)) {ext4_error_inode (inode, func, line, map->m_pblk, -"lblock %lu mapped to illegal pblock " +"lblock %lu mapped to illegal pblock %llu " "(length %d)" , (unsigned long ) map->m_lblk, - map->m_len); + map->m_pblk, map->m_len);return -EFSCORRUPTED ; }return 0 ;
@@ -4506,7 +4506,8 @@ static int __ext4_get_inode_loc(struct inode *inode,int inodes_per_block, inode_offset; iloc->bh =NULL ; -if (!ext4_valid_inum (sb, inode->i_ino)) +if (inode->i_ino <EXT4_ROOT_INO || + inode->i_ino >le32_to_cpu (EXT4_SB (sb)->s_es->s_inodes_count))return -EFSCORRUPTED ; iloc->block_group = (inode->i_ino -1 ) /EXT4_INODES_PER_GROUP (sb);
fs/ext4/mballoc.c +4 -2
@@ -2444,7 +2444,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,* initialize bb_free to be able to skip * empty groups without initialization */ -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { meta_group_info[i]->bb_free =ext4_free_clusters_after_init (sb, group, desc); }else {
@@ -3011,7 +3012,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,#endif ext4_set_bits (bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len); -if (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT ); ext4_free_group_clusters_set(sb, gdp, ext4_free_clusters_after_init(sb,
fs/ext4/super.c +75 -14
173 lines not on this page · raw message
fs/ext4/xattr.c +18 -22
@@ -230,12 +230,12 @@ __ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh, {int error = -EFSCORRUPTED ; -if (buffer_verified (bh)) -return 0 ; -if (BHDR (bh)->h_magic !=cpu_to_le32 (EXT4_XATTR_MAGIC ) ||BHDR (bh)->h_blocks !=cpu_to_le32 (1 )) goto errout; +if (buffer_verified (bh)) +return 0 ; + error = -EFSBADCRC ;if (!ext4_xattr_block_csum_verify (inode, bh)) goto errout;
@@ -1560,7 +1560,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i, handle_t *handle, struct inode *inode, bool is_block) { - struct ext4_xattr_entry *last; + struct ext4_xattr_entry *last, *next;struct ext4_xattr_entry *here = s->here;size_t min_offs = s->end - s->base, name_len =strlen (i->name);int in_inode = i->in_inode;
@@ -1595,7 +1595,13 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,/* Compute min_offs and last. */ last = s->first; -for (; !IS_LAST_ENTRY (last); last =EXT4_XATTR_NEXT (last)) { +for (; !IS_LAST_ENTRY (last); last = next) { + next =EXT4_XATTR_NEXT (last); +if ((void *)next >= s->end) { +EXT4_ERROR_INODE (inode,"corrupted xattr entries" ); + ret = -EFSCORRUPTED ; + goto out; + }if (!last->e_value_inum && last->e_value_size) {size_t offs =le16_to_cpu (last->e_value_offs);if (offs < min_offs)
@@ -2206,23 +2212,8 @@ int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,if (EXT4_I (inode)->i_extra_isize ==0 )return -ENOSPC ; error =ext4_xattr_set_entry (i, s, handle, inode, false/* is_block */ ); -if (error) { -if (error == -ENOSPC && -ext4_has_inline_data (inode)) { - error =ext4_try_to_evict_inline_data (handle, inode, -EXT4_XATTR_LEN (strlen (i->name) + -EXT4_XATTR_SIZE (i->value_len))); -if (error) -return error; - error =ext4_xattr_ibody_find (inode, i, is); -if (error) -return error; - error =ext4_xattr_set_entry (i, s, handle, inode, - false/* is_block */ ); - } -if (error) -return error; - } +if (error) +return error; header =IHDR (inode,ext4_raw_inode (&is->iloc));if (!IS_LAST_ENTRY (s->first)) { header->h_magic =cpu_to_le32 (EXT4_XATTR_MAGIC );
@@ -2651,6 +2642,11 @@ static int ext4_xattr_make_inode_space(handle_t *handle, struct inode *inode, last =IFIRST (header);/* Find the entry best suited to be pushed into EA block */ for (; !IS_LAST_ENTRY (last); last =EXT4_XATTR_NEXT (last)) { +/* never move system.data out of the inode */ +if ((last->e_name_len ==4 ) && + (last->e_name_index ==EXT4_XATTR_INDEX_SYSTEM ) && + !memcmp (last->e_name,"data" ,4 )) +continue ; total_size =EXT4_XATTR_LEN (last->e_name_len);if (!last->e_value_inum) total_size += EXT4_XATTR_SIZE(
fs/jbd2/transaction.c +8 -1
@@ -1363,6 +1363,13 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)if (jh->b_transaction == transaction && jh->b_jlist != BJ_Metadata) {jbd_lock_bh_state (bh); +if (jh->b_transaction == transaction && + jh->b_jlist != BJ_Metadata) +pr_err ("JBD2: assertion failure: h_type=%u " +"h_line_no=%u block_no=%llu jlist=%u\n" , + handle->h_type, handle->h_line_no, + (unsigned long long ) bh->b_blocknr, + jh->b_jlist);J_ASSERT_JH (jh, jh->b_transaction != transaction || jh->b_jlist == BJ_Metadata);jbd_unlock_bh_state (bh);
@@ -1382,11 +1389,11 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)* of the transaction. This needs to be done * once a transaction -bzzz */ - jh->b_modified =1 ;if (handle->h_buffer_credits <=0 ) { ret = -ENOSPC ; goto out_unlock_bh; } + jh->b_modified =1 ; handle->h_buffer_credits--; }
fs/userfaultfd.c +7 -5
@@ -220,24 +220,26 @@ static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx, unsigned long reason) {struct mm_struct *mm = ctx->mm; -pte_t *pte; +pte_t *ptep, pte;bool ret = true;VM_BUG_ON (!rwsem_is_locked (&mm->mmap_sem)); - pte =huge_pte_offset (mm, address,vma_mmu_pagesize (vma)); -if (!pte) + ptep =huge_pte_offset (mm, address,vma_mmu_pagesize (vma)); + +if (!ptep) goto out; ret = false; + pte =huge_ptep_get (ptep);/* * Lockless access: we're in a wait_event so it's ok if it * changes under us. */ -if (huge_pte_none (*pte)) +if (huge_pte_none (pte)) ret = true; -if (!huge_pte_write (*pte) && (reason &VM_UFFD_WP )) +if (!huge_pte_write (pte) && (reason &VM_UFFD_WP )) ret = true; out:return ret;
fs/xfs/xfs_ioctl.c +2 -1
@@ -1103,7 +1103,8 @@ xfs_ioctl_setattr_dax_invalidate(if (fa->fsx_xflags &FS_XFLAG_DAX ) {if (!(S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode)))return -EINVAL ; -if (bdev_dax_supported (sb, sb->s_blocksize) <0 ) +if (!bdev_dax_supported (xfs_find_bdev_for_inode (VFS_I (ip)), + sb->s_blocksize))return -EINVAL ; }
fs/xfs/xfs_iops.c +25 -5
@@ -1195,6 +1195,30 @@ static const struct inode_operations xfs_inline_symlink_inode_operations = { .update_time = xfs_vn_update_time, }; +/* Figure out if this file actually supports DAX. */ +static bool +xfs_inode_supports_dax ( +struct xfs_inode *ip) +{ +struct xfs_mount *mp = ip->i_mount; + +/* Only supported on non-reflinked files. */ +if (!S_ISREG (VFS_I (ip)->i_mode) ||xfs_is_reflink_inode (ip)) +return false; + +/* DAX mount option or DAX iflag must be set. */ +if (!(mp->m_flags &XFS_MOUNT_DAX ) && + !(ip->i_d.di_flags2 &XFS_DIFLAG2_DAX )) +return false; + +/* Block size must match page size */ +if (mp->m_sb.sb_blocksize !=PAGE_SIZE ) +return false; + +/* Device has to support DAX too. */ +return xfs_find_daxdev_for_inode (VFS_I (ip)) !=NULL ; +} + STATIC void xfs_diflags_to_iflags( struct inode *inode,
@@ -1213,11 +1237,7 @@ xfs_diflags_to_iflags( inode->i_flags |=S_SYNC ;if (flags &XFS_DIFLAG_NOATIME ) inode->i_flags |=S_NOATIME ; -if (S_ISREG (inode->i_mode) && - ip->i_mount->m_sb.sb_blocksize ==PAGE_SIZE && - !xfs_is_reflink_inode (ip) && - (ip->i_mount->m_flags &XFS_MOUNT_DAX || - ip->i_d.di_flags2 &XFS_DIFLAG2_DAX )) +if (xfs_inode_supports_dax (ip)) inode->i_flags |=S_DAX ; }
fs/xfs/xfs_super.c +8 -2
@@ -1690,11 +1690,17 @@ xfs_fs_fill_super( sb->s_flags |=SB_I_VERSION ;if (mp->m_flags &XFS_MOUNT_DAX ) { +bool rtdev_is_dax = false, datadev_is_dax; +xfs_warn (mp,"DAX enabled. Warning: EXPERIMENTAL, use at your own risk" ); - error =bdev_dax_supported (sb, sb->s_blocksize); -if (error) { + datadev_is_dax =bdev_dax_supported (mp->m_ddev_targp->bt_bdev, + sb->s_blocksize); +if (mp->m_rtdev_targp) + rtdev_is_dax =bdev_dax_supported ( + mp->m_rtdev_targp->bt_bdev, sb->s_blocksize); +if (!rtdev_is_dax && !datadev_is_dax) {xfs_alert (mp,"DAX unsupported by block device. Turning off DAX." ); mp->m_flags &= ~XFS_MOUNT_DAX ;
include/linux/dax.h +6 -5
@@ -64,10 +64,10 @@ static inline bool dax_write_cache_enabled(struct dax_device *dax_dev)struct writeback_control ;int bdev_dax_pgoff (struct block_device *,sector_t ,size_t ,pgoff_t *pgoff);#if IS_ENABLED (CONFIG_FS_DAX ) -int __bdev_dax_supported (struct super_block *sb,int blocksize); -static inline int bdev_dax_supported (struct super_block *sb,int blocksize) +bool __bdev_dax_supported (struct block_device *bdev,int blocksize); +static inline bool bdev_dax_supported (struct block_device *bdev,int blocksize) { -return __bdev_dax_supported (sb, blocksize); +return __bdev_dax_supported (bdev, blocksize); }static inline struct dax_device *fs_dax_get_by_host (const char *host)
@@ -84,9 +84,10 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);int dax_writeback_mapping_range (struct address_space *mapping,struct block_device *bdev,struct writeback_control *wbc);#else -static inline int bdev_dax_supported (struct super_block *sb,int blocksize) +static inline bool bdev_dax_supported (struct block_device *bdev, +int blocksize) { -return -EOPNOTSUPP ; +return false; }static inline struct dax_device *fs_dax_get_by_host (const char *host)
include/linux/hid.h +2 -1
@@ -502,6 +502,7 @@ struct hid_output_fifo {#define HID_STAT_ADDED BIT(0)#define HID_STAT_PARSED BIT(1) +#define HID_STAT_REPROBED BIT(3)struct hid_input {struct list_head list;
@@ -568,7 +569,7 @@ struct hid_device { /* device report descriptor */bool battery_avoid_query;#endif -unsigned int status;/* see STAT flags above */ +unsigned long status;/* see STAT flags above */ unsigned claimed;/* Claimed by hidinput, hiddev? */ unsigned quirks;/* Various quirks the device can pull on us */ bool io_started;/* If IO has started */
kernel/trace/trace_events_hist.c +1 -1
@@ -393,7 +393,7 @@ static void hist_err_event(char *str, char *system, char *event, char *var)else if (system)snprintf (err,MAX_FILTER_STR_VAL ,"%s.%s" , system, event);else -strncpy (err, var,MAX_FILTER_STR_VAL ); +strscpy (err, var,MAX_FILTER_STR_VAL );hist_err (str, err); }
kernel/trace/trace_functions_graph.c +4 -1
@@ -831,6 +831,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,struct ftrace_graph_ret *graph_ret;struct ftrace_graph_ent *call;unsigned long long duration; +int cpu = iter->cpu;int i; graph_ret = &ret_entry->ret;
@@ -839,7 +840,6 @@ print_graph_entry_leaf(struct trace_iterator *iter,if (data) {struct fgraph_cpu_data *cpu_data; -int cpu = iter->cpu; cpu_data =per_cpu_ptr (data->cpu_data, cpu);
@@ -869,6 +869,9 @@ print_graph_entry_leaf(struct trace_iterator *iter,trace_seq_printf (s,"%ps();\n" , (void *)call->func); +print_graph_irq (iter, graph_ret->func,TRACE_GRAPH_RET , + cpu, iter->ent->pid, flags); +return trace_handle_return (s); }
mm/debug.c +16 -2
@@ -43,12 +43,25 @@ const struct trace_print_flags vmaflag_names[] = {void __dump_page (struct page *page,const char *reason) { +bool page_poisoned =PagePoisoned (page); +int mapcount; + +/* +* If struct page is poisoned don't access Page*() functions as that +* leads to recursive loop. Page*() check for poisoned pages, and calls +* dump_page() when detected. +*/ +if (page_poisoned) { +pr_emerg ("page:%px is uninitialized and poisoned" , page); + goto hex_only; + } +/* * Avoid VM_BUG_ON() in page_mapcount(). * page->_mapcount space in struct page is used by sl[aou]b pages to * encode own info. */ -int mapcount =PageSlab (page) ?0 :page_mapcount (page); + mapcount =PageSlab (page) ?0 :page_mapcount (page); pr_emerg("page:%px count:%d mapcount:%d mapping:%px index:%#lx", page, page_ref_count(page), mapcount,
@@ -60,6 +73,7 @@ void __dump_page(struct page *page, const char *reason)pr_emerg ("flags: %#lx(%pGp)\n" , page->flags, &page->flags); +hex_only:print_hex_dump (KERN_ALERT ,"raw: " ,DUMP_PREFIX_NONE ,32 ,sizeof (unsigned long ), page,sizeof (struct page ), false);
@@ -68,7 +82,7 @@ void __dump_page(struct page *page, const char *reason)pr_alert ("page dumped because: %s\n" , reason);#ifdef CONFIG_MEMCG -if (page->mem_cgroup) +if (!page_poisoned && page->mem_cgroup)pr_alert ("page->mem_cgroup:%px\n" , page->mem_cgroup);#endif }
mm/hugetlb.c +1 -0
@@ -2163,6 +2163,7 @@ static void __init gather_bootmem_prealloc(void)*/ if (hstate_is_gigantic (h))adjust_managed_page_count (page,1 << h->order); +cond_resched (); } }
mm/vmstat.c +0 -2
@@ -1844,11 +1844,9 @@ static void vmstat_update(struct work_struct *w)* to occur in the future. Keep on running the * update worker thread. */ -preempt_disable ();queue_delayed_work_on (smp_processor_id (), mm_percpu_wq,this_cpu_ptr (&vmstat_work),round_jiffies_relative (sysctl_stat_interval)); -preempt_enable (); } }
net/netfilter/nf_log.c +6 -3
@@ -457,14 +457,17 @@ static int nf_log_proc_dostring(struct ctl_table *table, int write,rcu_assign_pointer (net->nf.nf_loggers[tindex], logger);mutex_unlock (&nf_log_mutex); }else { +struct ctl_table tmp = *table; + + tmp.data = buf;mutex_lock (&nf_log_mutex); logger =nft_log_dereference (net->nf.nf_loggers[tindex]);if (!logger) - table->data ="NONE" ; +strlcpy (buf,"NONE" ,sizeof (buf));else - table->data = logger->name; - r =proc_dostring (table, write, buffer, lenp, ppos); +strlcpy (buf, logger->name,sizeof (buf));mutex_unlock (&nf_log_mutex); + r =proc_dostring (&tmp, write, buffer, lenp, ppos); }return r;