Linux 3.18.111
Greg KH
maintainerI'm announcing the release of the 3.18.111 kernel.
All users of the 3.18 kernel series must upgrade.
The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.18.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
------------
Documentation/device-mapper/thin-provisioning.txt | 8 Makefile | 2 arch/alpha/include/asm/xchg.h | 30 ++- arch/arm/boot/dts/socfpga.dtsi | 2 arch/arm/mach-omap1/clock.c | 6 arch/arm/mach-omap2/pm.c | 4 arch/arm/plat-omap/dmtimer.c | 7 arch/m68k/coldfire/device.c | 12 + arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 2 arch/mips/kernel/ptrace.c | 22 +- arch/mips/kernel/ptrace32.c | 4 arch/mips/kvm/mips.c | 2 arch/mips/txx9/rbtx4939/setup.c | 4 arch/powerpc/include/asm/irq_work.h | 1 arch/powerpc/perf/core-book3s.c | 25 ++ arch/powerpc/sysdev/mpic.c | 2 arch/sh/kernel/entry-common.S | 2 arch/sparc/include/asm/atomic_64.h | 6 arch/x86/kernel/smpboot.c | 1 arch/x86/kvm/vmx.c | 20 +- arch/x86/kvm/x86.c | 7 arch/x86/power/hibernate_32.c | 2 arch/x86/power/hibernate_64.c | 2 drivers/acpi/acpi_pad.c | 3 drivers/acpi/acpica/evevent.c | 9 drivers/acpi/acpica/nseval.c | 8 drivers/acpi/processor_perflib.c | 2 drivers/ata/libata-core.c | 4 drivers/block/paride/pcd.c | 2 drivers/cdrom/cdrom.c | 3 drivers/cdrom/gdrom.c | 3 drivers/clk/samsung/clk-exynos3250.c | 4 drivers/clk/samsung/clk-exynos5250.c | 8 drivers/clk/samsung/clk-exynos5260.c | 2 drivers/clk/samsung/clk-s3c2410.c | 16 - drivers/clocksource/fsl_ftm_timer.c | 2 drivers/dma/pl330.c | 6 drivers/firewire/ohci.c | 8 drivers/firmware/dmi_scan.c | 22 -- drivers/gpu/drm/exynos/regs-fimc.h | 2 drivers/hid/hid-roccat-kovaplus.c | 2 drivers/hwmon/nct6775.c | 10 - drivers/hwmon/pmbus/adm1275.c | 4 drivers/hwmon/pmbus/max8688.c | 2 drivers/i2c/busses/i2c-mv64xxx.c | 8 drivers/ide/ide-cd.c | 2 drivers/infiniband/hw/mlx5/qp.c | 5 drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 drivers/irqchip/irq-gic-v3.c | 2 drivers/md/bcache/alloc.c | 4 drivers/md/bcache/bcache.h | 2 drivers/md/bcache/btree.c | 9 drivers/md/bcache/request.c | 2 drivers/md/bcache/super.c | 23 +- drivers/md/bcache/sysfs.c | 11 - drivers/md/bcache/writeback.c | 27 ++ drivers/md/raid1.c | 11 + drivers/md/raid10.c | 6 drivers/media/dvb-core/dmxdev.c | 2 drivers/media/pci/cx23885/cx23885-cards.c | 4 drivers/media/pci/cx23885/cx23885-core.c | 10 + drivers/media/pci/cx25821/cx25821-core.c | 7 drivers/media/platform/s3c-camif/camif-capture.c | 7 drivers/media/usb/em28xx/em28xx.h | 2 drivers/message/fusion/mptctl.c | 2 drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 drivers/net/ethernet/intel/e1000e/mac.c | 2 drivers/net/ethernet/intel/e1000e/netdev.c | 4 drivers/net/ethernet/marvell/mvneta.c | 1 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 drivers/net/phy/dp83640.c | 18 + drivers/net/usb/qmi_wwan.c | 4 drivers/net/usb/r8152.c | 2 drivers/net/usb/smsc75xx.c | 7 drivers/net/virtio_net.c | 2 drivers/net/wireless/ath/ath10k/mac.c | 10 + drivers/parisc/lba_pci.c | 20 +- drivers/pci/pci-driver.c | 17 + drivers/pci/quirks.c | 5 drivers/regulator/of_regulator.c | 1 drivers/rtc/rtc-tx4939.c | 6 drivers/s390/cio/device_fsm.c | 7 drivers/s390/cio/io_sch.h | 1 drivers/scsi/aacraid/commsup.c | 4 drivers/scsi/aacraid/linit.c | 5 drivers/scsi/arm/fas216.c | 2 drivers/scsi/bnx2fc/bnx2fc_io.c | 1 drivers/scsi/lpfc/lpfc_attr.c | 5 drivers/scsi/lpfc/lpfc_hbadisc.c | 5 drivers/scsi/lpfc/lpfc_sli.c | 2 drivers/scsi/qla2xxx/qla_isr.c | 6 drivers/scsi/qla4xxx/ql4_def.h | 2 drivers/scsi/qla4xxx/ql4_os.c | 46 ++++ drivers/scsi/sd.c | 3 drivers/scsi/sr.c | 21 +- drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 drivers/scsi/ufs/ufshcd.c | 2 drivers/staging/rtl8192u/r8192U_core.c | 2 drivers/tty/serial/arc_uart.c | 5 drivers/tty/serial/fsl_lpuart.c | 4 drivers/tty/serial/imx.c | 6 drivers/tty/serial/samsung.c | 4 drivers/tty/serial/xilinx_uartps.c | 2 drivers/usb/dwc2/core.h | 2 drivers/usb/dwc3/core.h | 2 drivers/usb/gadget/composite.c | 40 +--- drivers/usb/gadget/function/f_fs.c | 2 drivers/usb/gadget/function/f_uac2.c | 2 drivers/usb/gadget/udc/fsl_udc_core.c | 4 drivers/usb/gadget/udc/goku_udc.h | 2 drivers/usb/host/ohci-hcd.c | 3 drivers/usb/host/xhci-mem.c | 2 drivers/usb/musb/musb_core.c | 2 drivers/video/fbdev/sbuslib.c | 4 drivers/watchdog/f71808e_wdt.c | 3 drivers/watchdog/sp5100_tco.h | 2 drivers/xen/events/events_base.c | 4 drivers/xen/grant-table.c | 4 drivers/xen/swiotlb-xen.c | 2 drivers/xen/xen-acpi-processor.c | 6 drivers/xen/xenbus/xenbus_probe.c | 5 drivers/zorro/zorro.c | 12 + fs/affs/namei.c | 10 - fs/aio.c | 4 fs/btrfs/ctree.c | 12 - fs/btrfs/disk-io.c | 2 fs/btrfs/extent-tree.c | 1 fs/btrfs/inode.c | 16 - fs/btrfs/send.c | 3 fs/btrfs/tests/qgroup-tests.c | 2 fs/btrfs/tree-log.c | 12 - fs/cifs/cifssmb.c | 4 fs/dcache.c | 22 ++ fs/ecryptfs/inode.c | 3 fs/ext2/namei.c | 6 fs/ext4/namei.c | 6 fs/f2fs/namei.c | 12 - fs/jffs2/dir.c | 12 - fs/jffs2/fs.c | 1 fs/jfs/namei.c | 12 - fs/nfs/nfs4sysctl.c | 2 fs/nilfs2/namei.c | 6 fs/ocfs2/acl.c | 6 fs/ocfs2/super.c | 5 fs/ocfs2/xattr.c | 2 fs/proc/base.c | 29 ++ fs/proc/proc_sysctl.c | 3 fs/reiserfs/namei.c | 12 - fs/udf/namei.c | 6 fs/udf/super.c | 5 fs/ufs/namei.c | 6 fs/xfs/xfs_discard.c | 14 - include/asm-generic/pgtable.h | 15 + include/linux/dcache.h | 1 include/linux/suspend.h | 2 include/linux/usb/composite.h | 3 include/net/llc_conn.h | 2 include/net/mac80211.h | 2 include/net/regulatory.h | 2 include/trace/events/timer.h | 20 +- include/uapi/linux/if_ether.h | 1 kernel/audit.c | 2 kernel/debug/kdb/kdb_main.c | 27 ++ kernel/events/core.c | 3 kernel/power/power.h | 3 kernel/relay.c | 2 kernel/sched/rt.c | 2 kernel/signal.c | 4 mm/ksm.c | 28 ++ mm/mempolicy.c | 36 +++ mm/swapfile.c | 4 mm/vmscan.c | 22 +- net/batman-adv/distributed-arp-table.c | 2 net/batman-adv/fragmentation.c | 3 net/batman-adv/gateway_client.c | 3 net/batman-adv/multicast.c | 4 net/batman-adv/soft-interface.c | 8 net/bridge/netfilter/ebtables.c | 33 ++- net/core/skbuff.c | 9 net/ipv4/ip_vti.c | 2 net/ipv4/tcp_illinois.c | 2 net/ipv6/sit.c | 7 net/llc/llc_c_ac.c | 15 - net/llc/llc_conn.c | 32 ++- net/netlabel/netlabel_unlabeled.c | 10 + net/nfc/llcp_commands.c | 4 net/nfc/netlink.c | 3 scripts/kconfig/expr.c | 2 scripts/kconfig/menu.c | 1 scripts/kconfig/zconf.y | 33 ++- security/integrity/ima/ima_crypto.c | 2 security/integrity/ima/ima_main.c | 13 + sound/core/vmaster.c | 5 sound/soc/au1x/ac97c.c | 6 tools/lib/traceevent/parse-filter.c | 10 - tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc | 46 ++++ tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc | 97 ++++++++++ tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc | 43 ++++ tools/testing/selftests/memfd/config | 1 tools/thermal/tmon/sysfs.c | 12 - tools/thermal/tmon/tmon.c | 1 201 files changed, 1218 insertions(+), 395 deletions(-)
Al Viro (3):
affs_lookup(): close a race with affs_remove_link()
aio: fix io_destroy(2) vs. lookup_ioctx() race do d_instantiate/unlock_new_inode combinations safely
Alex Estrin (1):
IB/ipoib: Fix for potential no-carrier state
Alex Williamson (1):
PCI: Add function 1 DMA alias quirk for Marvell 9128
Alexey Dobriyan (1):
proc: fix /proc/*/map_files lookup
Anders Roxell (1):
selftests: memfd: add config fragment for fuse
Andrea Parri (2):
locking/xchg/alpha: Add unconditional memory barrier to cmpxchg() locking/xchg/alpha: Fix xchg() and cmpxchg() memory ordering bugs
Andrzej Hajda (4):
clk: samsung: s3c2410: Fix PLL rates
clk: samsung: exynos5260: Fix PLL rates
clk: samsung: exynos5250: Fix PLL rates
clk: samsung: exynos3250: Fix PLL rates
Anna-Maria Gleixner (1):
tracing/hrtimer: Fix tracing bugs by taking all clock bases and modes into account
Arnd Bergmann (4):
scsi: fas216: fix sense buffer initialization x86/power: Fix swsusp_arch_resume prototype
cifs: silence compiler warnings showing up with gcc-8.0.0
media: s3c-camif: fix out-of-bounds array access
Arvind Yadav (1):
xen: xenbus: use put_device() instead of kfree()
Bart Van Assche (1):
scsi: qla2xxx: Avoid triggering undefined behavior in qla2x00_mbx_completion()
Benjamin Poirier (1):
e1000e: Fix check_for_link return value with autoneg off
Brad Love (3):
media: cx23885: Override 888 ImpactVCBe crystal frequency
media: cx23885: Set subdev host data to clk_freq pointer
media: em28xx: USB bulk packet size fix
Carlos Maiolino (1):
Force log to disk before reading the AGF during a fstrim
Chad Dupuis (1):
scsi: bnx2fc: Fix check in SCSI completion handler for timed out request
Chen Yu (1):
ACPI: processor_perflib: Do not send _PPC change notification if not ready
Chris Dickens (1):
usb: gadget: composite: fix incorrect handling of OS desc requests
Christophe JAILLET (1):
regulator: of: Add a missing 'of_node_put()' in an error handling path of 'of_regulator_match()'
Claudio Imbrenda (1):
mm/ksm: fix interaction with THP
Colin Ian King (5):
KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable" clocksource/drivers/fsl_ftm_timer: Fix error return checking
staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
rtc: tx4939: avoid unintended sign extension on a 24 bit shift
media: cx25821: prevent out-of-bounds read on array card
Coly Li (2):
bcache: properly set task state in bch_writeback_thread()
bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
Cong Wang (1):
llc: properly handle dev_queue_xmit() return value
Dan Carpenter (5):
ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
scsi: sym53c8xx_2: iterator underflow in sym_getsync()
scsi: mptfusion: Add bounds check in mptctl_hp_targetinfo() xen/acpi: off by one in read_acpi_id()
Danilo Krummrich (1):
fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
Dave Carroll (1):
scsi: aacraid: Insure command thread is not recursively stopped
David Rientjes (1):
kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
David S. Miller (1):
sparc64: Make atomic_xchg() an inline function rather than a macro.
Davidlohr Bueso (1):
sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
Eric Dumazet (2):
smsc75xx: fix smsc75xx_set_features()
r8152: fix tx packets accounting
Erik Schmauss (1):
ACPICA: Events: add a return on failure from acpi_hw_register_read
Esben Haabendal (1):
dp83640: Ensure against premature access to PHY registers after reset
Felix Fietkau (1):
mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple of 4
Filipe Manana (2):
Btrfs: send, fix issuing write op when processing hole in no data mode
Btrfs: fix copy_items() return value when logging an inode
Florian Westphal (2):
netfilter: ebtables: convert BUG_ONs to WARN_ONs
netfilter: ebtables: fix erroneous reject of last rule
Frank Asseg (1):
tools/thermal: tmon: fix for segfault
Fredrik Noring (1):
USB: OHCI: Fix NULL dereference in HCDs using HCD_LOCAL_MEM
Geert Uytterhoeven (6):
ARM: OMAP1: clock: Fix debugfs_create_*() usage
serial: xuartps: Fix out-of-bounds access through DT alias
serial: samsung: Fix out-of-bounds access through serial port index
serial: imx: Fix out-of-bounds access through serial port index
serial: fsl_lpuart: Fix out-of-bounds access through DT alias
serial: arc_uart: Fix out-of-bounds access through DT alias
Giuseppe Lippolis (1):
net-usb: add qmi_wwan if on lte modem wistron neweb d18q1
Greg Kroah-Hartman (1):
Linux 3.18.111
Greg Ungerer (1):
m68k: set dma and coherent masks for platform FEC ethernets
Gregory CLEMENT (1):
i2c: mv64xxx: Apply errata delay only in standard mode
Grigor Tovmasyan (1):
usb: dwc2: Fix interval type issue
Guenter Roeck (4):
watchdog: sp5100_tco: Fix watchdog disable bit
hwmon: (nct6775) Fix writing pwmX_mode
hwmon: (pmbus/max8688) Accept negative page register values
hwmon: (pmbus/adm1275) Accept negative page register values
Hector Martin (1):
firewire-ohci: work around oversized DMA reads on JMicron controllers
Helge Deller (1):
parisc/pci: Switch LBA PCI bus from Hard Fail to Soft Fail mode
Huang Ying (1):
mm: fix races between address_space dereference and free in page_evicatable
Igor Pylypiv (1):
watchdog: f71808e_wdt: Fix magic close handling
Jake Daryll Obina (1):
jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
James Smart (3):
scsi: lpfc: Fix issue_lip if link is disabled
scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing
scsi: lpfc: Fix frequency of Release WQE CQEs
Jan Chochol (1):
nfs: Do not convert nfs_idmap_cache_timeout to jiffies
Jan Kara (1):
udf: Provide saner default for invalid uid / gid
Jay Vosburgh (1):
virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
Jean Delvare (1):
firmware: dmi_scan: Fix handling of empty DMI strings
Jeff Mahoney (1):
btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
Jens Axboe (1):
sr: get/drop reference to device in revalidate and check_events
Jeremy Cline (1):
scsi: sd: Keep disk read-only when re-reading partition
Joe Jin (1):
xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
Joey Pabalinas (1):
net/tcp/illinois: replace broken algorithm reference link
Johannes Berg (1):
regulatory: add NUL to request alpha2
John Keeping (1):
usb: gadget: f_uac2: fix bFirstInterface in composite gadget
Karthikeyan Periyasamy (1):
ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
Kees Cook (1):
NFC: llcp: Limit size of SDP URI
Kirill A. Shutemov (1):
asm-generic: provide generic_pmdp_establish()
Lars-Peter Clausen (1):
usb: gadget: ffs: Let setup() return USB_GADGET_DELAYED_STATUS
Lenny Szubowicz (1):
ACPI: acpi_pad: Fix memory leak in power saving threads
Leon Romanovsky (2):
RDMA/mlx5: Avoid memory leak in case of XRCD dealloc failure net/mlx5: Protect from command bit overflow
Linus Lüssing (2):
batman-adv: fix multicast-via-unicast transmission with AP isolation
batman-adv: fix packet loss for broadcasted DHCP packets to a server
Liu Bo (2):
Btrfs: bail out on error during replay_dir_deletes
Btrfs: fix NULL pointer dereference in log_dir_items
Maciej W. Rozycki (2):
MIPS: ptrace: Expose FIR register through FP regset
MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
Madhavan Srinivasan (1):
powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
Manish Rangankar (1):
scsi: qla4xxx: skip error recovery in case of register disconnect.
Mark Salter (1):
irqchip/gic-v3: Change pr_debug message to pr_devel
Masami Hiramatsu (3):
selftests: ftrace: Add probe event argument syntax testcase
selftests: ftrace: Add a testcase for string type with kprobe_event
selftests: ftrace: Add a testcase for probepoint
Mathias Kresin (1):
MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
Mathias Nyman (1):
xhci: zero usb device slot_id member when disabling and freeing a xhci slot
Mathieu Malaterre (1):
powerpc: Add missing prototype for arch_irq_work_raise()
Matt Redfearn (1):
MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
Matthias Schiffer (3):
batman-adv: fix packet checksum in receive path
batman-adv: invalidate checksum on fragment reassembly
batman-adv: fix header size check in batadv_dbg_arp()
Maurizio Lombardi (1):
cdrom: do not call check_disk_change() inside cdrom_open()
Mauro Carvalho Chehab (1):
media: dmxdev: fix error code for invalid ioctls
Meelis Roos (1):
scsi: aacraid: fix shutdown crash when init fails
Mel Gorman (1):
mm: pin address_space before dereferencing it while isolating an LRU page
Merlijn Wajer (1):
usb: musb: call pm_runtime_{get,put}_sync before reading vbus registers
Michael Ellerman (2):
powerpc/mpic: Check if cpu_possible() in mpic_physmask() powerpc/perf: Fix kernel address leak via sampling registers
Michael Schmitz (1):
zorro: Set up z->dev.dma_mask for the DMA API
Nikolay Borisov (2):
btrfs: Fix out of bounds access in btrfs_search_slot
btrfs: Fix possible softlock on single core machines
Paolo Bonzini (1):
kvm: x86: fix KVM_XEN_HVM_CONFIG ioctl
Pawel Dembicki (1):
net: qmi_wwan: add BroadMobi BM806U 2020:2033
Peter Malone (1):
fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
Peter Zijlstra (1):
perf/core: Fix perf_output_read_group()
Petr Vorel (1):
ima: Fallback to the builtin hash algorithm
Philipp Puschmann (1):
arm: dts: socfpga: fix GIC PPI warning
Pierre-Yves Kerbrat (1):
e1000e: allocate ring descriptors with dma_zalloc_coherent
Qi Hou (1):
dmaengine: pl330: fix a race condition in case of threaded irqs
Qu Wenruo (1):
btrfs: tests/qgroup: Fix wrong tree backref level
Rafael J. Wysocki (1):
PCI: Restore config space on runtime resume despite being unbound
Randy Dunlap (1):
kdb: make "mdr" command repeat
Rich Felker (1):
sh: fix debug trap failure to process signals before return to user
Richard Guy Briggs (1):
audit: return on memory error to avoid null pointer dereference
Richard Haines (1):
netlabel: If PF_INET6, check sk_buff ip header version
Roger Pau Monne (1):
xen/pirq: fix error path cleanup when binding MSIs
Ross Lagerwall (1):
xen/grant-table: Use put_page instead of free_page
Samuel Neves (1):
x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations
Sean Christopherson (1):
KVM: VMX: raise internal error for exception during invalid protected mode state
Sebastian Ott (2):
s390/cio: fix return code after missing interrupt s390/cio: clear timer when terminating driver I/O
Seunghun Han (1):
ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
Stefan Agner (1):
usb: gadget: fsl_udc_core: fix ep valid checks
Stefano Brivio (2):
vti4: Don't count header length twice on tunnel setup
vti4: Don't override MTU passed on link creation via IFLA_MTU
Steven Rostedt (VMware) (1):
tools lib traceevent: Fix get_field_str() for dynamic strings
Sujit Reddy Thumma (1):
scsi: ufs: Enable quirk to ignore sending WRITE_SAME command
Takashi Iwai (1):
ALSA: vmaster: Propagate slave error
Tang Junhui (4):
bcache: fix for allocator and register thread race
bcache: fix for data collapse after re-attaching an attached device
bcache: return attach error when no cache set exist
bcache: fix kcrashes with fio in RAID5 backend dev
Tejun Heo (1):
libata: Blacklist some Sandisk SSDs for NCQ
Thinh Nguyen (1):
usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields
Thomas Vincent-Cross (1):
PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
Tom Abraham (1):
swap: divide-by-zero when zero length swap file on ssd
Tony Lindgren (2):
ARM: OMAP3: Fix prm wake interrupt for resume
ARM: OMAP: Fix dmtimer init for omap1
Toshiaki Makita (2):
net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off
net: Fix untag for vlan packets without ethernet header
Ulf Magnusson (3):
kconfig: Don't leak main menus during parsing
kconfig: Fix automatic menu creation mem leak
kconfig: Fix expr_free() E_NOT leak
Wolfram Sang (2):
drm/exynos: fix comparison to bitshift when dealing with a mask
usb: gadget: udc: change comparison to bitshift when dealing with a mask
Xin Long (1):
sit: fix IFLA_MTU ignored on NEWLINK
Yelena Krivosheev (1):
net: mvneta: fix enable of all initialized RXQs
Yisheng Xie (3):
mm/mempolicy: fix the check of nodemask from user mm/mempolicy: add nodes_empty check in SYSC_migrate_pages mm/mempolicy.c: avoid use uninitialized preferred_node
Yufen Yu (2):
md raid10: fix NULL deference in handle_write_completed() md/raid1: fix NULL pointer dereference
mulhern (1):
dm thin: fix documentation relative to low water mark threshold
piaojun (2):
ocfs2: return -EROFS to mount.ocfs2 if inode block is invalid ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute
zhongjiang (1):
kernel/signal.c: avoid undefined behaviour in kill_something_info
Greg KH
maintainerDocumentation/device-mapper/thin-provisioning.txt +5 -3
@@ -112,9 +112,11 @@ $low_water_mark is expressed in blocks of size $data_block_size. If free space on the data device drops below this level then a dm event will be triggered which a userspace daemon should catch allowing it to extend the pool device. Only one such event will be sent. -Resuming a device with a new table itself triggers an event so the -userspace daemon can use this to detect a situation where a new table -already exceeds the threshold. + +No special event is triggered if a just resumed device's free space is below +the low water mark. However, resuming a device always triggers an +event; a userspace daemon should verify that free space exceeds the low +water mark when handling this event. A low water mark for the metadata device is maintained in the kernel and will trigger a dm event if free space on the metadata device drops below
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 18 -SUBLEVEL = 110 +SUBLEVEL = 111 EXTRAVERSION = NAME = Diseased Newt
arch/alpha/include/asm/xchg.h +22 -8
@@ -11,6 +11,10 @@* Atomic exchange. * Since it can be used to implement critical sections * it must clobber "memory" (also for interrupts in UP). +* +* The leading and the trailing memory barriers guarantee that these +* operations are fully ordered. +* */ static inline unsigned long
@@ -18,6 +22,7 @@ ____xchg(_u8, volatile char *m, unsigned long val) {unsigned long ret, tmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %4,7,%3\n" " insbl %1,%4,%1\n"
@@ -42,6 +47,7 @@ ____xchg(_u16, volatile short *m, unsigned long val) {unsigned long ret, tmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %4,7,%3\n" " inswl %1,%4,%1\n"
@@ -66,6 +72,7 @@ ____xchg(_u32, volatile int *m, unsigned long val) {unsigned long dummy; +smp_mb (); __asm__ __volatile__("1: ldl_l %0,%4\n" " bis $31,%3,%1\n"
@@ -86,6 +93,7 @@ ____xchg(_u64, volatile long *m, unsigned long val) {unsigned long dummy; +smp_mb (); __asm__ __volatile__("1: ldq_l %0,%4\n" " bis $31,%3,%1\n"
@@ -127,10 +135,12 @@ ____xchg(, volatile void *ptr, unsigned long x, int size)* store NEW in MEM. Return the initial value in MEM. Success is * indicated by comparing RETURN with OLD. * -* The memory barrier should be placed in SMP only when we actually -* make the change. If we don't change anything (so if the returned -* prev is equal to old) then we aren't acquiring anything new and -* we don't need any memory barrier as far I can tell. +* The leading and the trailing memory barriers guarantee that these +* operations are fully ordered. +* +* The trailing memory barrier is placed in SMP unconditionally, in +* order to guarantee that dependency ordering is preserved when a +* dependency is headed by an unsuccessful operation. */ static inline unsigned long
@@ -138,6 +148,7 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new) {unsigned long prev, tmp, cmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %5,7,%4\n" " insbl %1,%5,%1\n"
@@ -149,8 +160,8 @@ ____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new)" or %1,%2,%2\n" " stq_c %2,0(%4)\n" " beq %2,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -165,6 +176,7 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new) {unsigned long prev, tmp, cmp, addr64; +smp_mb (); __asm__ __volatile__(" andnot %5,7,%4\n" " inswl %1,%5,%1\n"
@@ -176,8 +188,8 @@ ____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new)" or %1,%2,%2\n" " stq_c %2,0(%4)\n" " beq %2,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -192,6 +204,7 @@ ____cmpxchg(_u32, volatile int *m, int old, int new) {unsigned long prev, cmp; +smp_mb (); __asm__ __volatile__("1: ldl_l %0,%5\n" " cmpeq %0,%3,%1\n"
@@ -199,8 +212,8 @@ ____cmpxchg(_u32, volatile int *m, int old, int new)" mov %4,%1\n" " stl_c %1,%2\n" " beq %1,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
@@ -215,6 +228,7 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new) {unsigned long prev, cmp; +smp_mb (); __asm__ __volatile__("1: ldq_l %0,%5\n" " cmpeq %0,%3,%1\n"
@@ -222,8 +236,8 @@ ____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new)" mov %4,%1\n" " stq_c %1,%2\n" " beq %1,3f\n" - __ASM__MB"2:\n" + __ASM__MB".subsection 2\n" "3: br 1b\n" ".previous"
arch/arm/boot/dts/socfpga.dtsi +1 -1
@@ -643,7 +643,7 @@ timer@fffec600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xfffec600 0x100>; - interrupts = <1 13 0xf04>; + interrupts = <1 13 0xf01>; clocks = <&mpu_periph_clk>; };
arch/arm/mach-omap1/clock.c +3 -3
@@ -1031,17 +1031,17 @@ static int clk_debugfs_register_one(struct clk *c)return -ENOMEM ; c->dent = d; - d =debugfs_create_u8 ("usecount" ,S_IRUGO , c->dent, (u8 *)&c->usecount); + d =debugfs_create_u8 ("usecount" ,S_IRUGO , c->dent, &c->usecount);if (!d) { err = -ENOMEM ; goto err_out; } - d =debugfs_create_u32 ("rate" ,S_IRUGO , c->dent, (u32 *)&c->rate); + d =debugfs_create_ulong ("rate" ,S_IRUGO , c->dent, &c->rate);if (!d) { err = -ENOMEM ; goto err_out; } - d =debugfs_create_x32 ("flags" ,S_IRUGO , c->dent, (u32 *)&c->flags); + d =debugfs_create_x8 ("flags" ,S_IRUGO , c->dent, &c->flags);if (!d) { err = -ENOMEM ; goto err_out;
arch/arm/mach-omap2/pm.c +2 -2
@@ -231,7 +231,7 @@ static void omap_pm_end(void)cpu_idle_poll_ctrl (false); } -static void omap_pm_finish (void ) +static void omap_pm_wake (void ) {if (cpu_is_omap34xx ())omap_prcm_irq_complete ();
@@ -241,7 +241,7 @@ static const struct platform_suspend_ops omap_pm_ops = { .begin = omap_pm_begin, .end = omap_pm_end, .enter = omap_pm_enter, - .finish = omap_pm_finish, + .wake = omap_pm_wake, .valid = suspend_valid_only_mem, };
arch/arm/plat-omap/dmtimer.c +2 -5
@@ -853,11 +853,8 @@ static int omap_dm_timer_probe(struct platform_device *pdev) timer->irq = irq->start; timer->pdev = pdev; -/* Skip pm_runtime_enable for OMAP1 */ -if (!(timer->capability &OMAP_TIMER_NEEDS_RESET )) { -pm_runtime_enable (dev); -pm_runtime_irq_safe (dev); - } +pm_runtime_enable (dev); +pm_runtime_irq_safe (dev);if (!timer->reserved) {pm_runtime_get_sync (dev);
arch/m68k/coldfire/device.c +10 -2
@@ -135,7 +135,11 @@ static struct platform_device mcf_fec0 = { .id = 0, .num_resources = ARRAY_SIZE(mcf_fec0_resources), .resource = mcf_fec0_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec0.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#ifdef MCFFEC_BASE1
@@ -167,7 +171,11 @@ static struct platform_device mcf_fec1 = { .id = 1, .num_resources = ARRAY_SIZE(mcf_fec1_resources), .resource = mcf_fec1_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec1.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#endif /* MCFFEC_BASE1 */ #endif /* CONFIG_FEC */
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +1 -1
@@ -167,7 +167,7 @@#define AR71XX_AHB_DIV_MASK 0x7#define AR724X_PLL_REG_CPU_CONFIG 0x00 -#define AR724X_PLL_REG_PCIE_CONFIG 0x18 +#define AR724X_PLL_REG_PCIE_CONFIG 0x10#define AR724X_PLL_DIV_SHIFT 0#define AR724X_PLL_DIV_MASK 0x3ff
arch/mips/kernel/ptrace.c +18 -4
@@ -444,7 +444,7 @@ static int fpr_get_msa(struct task_struct *target,/* * Copy the floating-point context to the supplied NT_PRFPREG buffer. * Choose the appropriate helper for general registers, and then copy -* the FCSR register separately. +* the FCSR and FIR registers separately. */ static int fpr_get(struct task_struct *target, const struct user_regset *regset,
@@ -452,6 +452,7 @@ static int fpr_get(struct task_struct *target, void *kbuf, void __user *ubuf) {const int fcr31_pos =NUM_FPU_REGS *sizeof (elf_fpreg_t); +const int fir_pos = fcr31_pos +sizeof (u32);int err;if (sizeof (target->thread.fpu.fpr[0 ]) ==sizeof (elf_fpreg_t))
@@ -464,6 +465,12 @@ static int fpr_get(struct task_struct *target, err =user_regset_copyout (&pos, &count, &kbuf, &ubuf, &target->thread.fpu.fcr31, fcr31_pos, fcr31_pos +sizeof (u32)); +if (err) +return err; + + err =user_regset_copyout (&pos, &count, &kbuf, &ubuf, + &boot_cpu_data.fpu_id, + fir_pos, fir_pos +sizeof (u32));return err; }
@@ -512,7 +519,8 @@ static int fpr_set_msa(struct task_struct *target,/* * Copy the supplied NT_PRFPREG buffer to the floating-point context. * Choose the appropriate helper for general registers, and then copy -* the FCSR register separately. +* the FCSR register separately. Ignore the incoming FIR register +* contents though, as the register is read-only. * * We optimize for the case where `count % sizeof(elf_fpreg_t) == 0', * which is supposed to have been guaranteed by the kernel before
@@ -526,6 +534,7 @@ static int fpr_set(struct task_struct *target, const void *kbuf, const void __user *ubuf) { const int fcr31_pos = NUM_FPU_REGS * sizeof(elf_fpreg_t); +const int fir_pos = fcr31_pos +sizeof (u32);u32 fcr31;int err;
@@ -551,6 +560,11 @@ static int fpr_set(struct task_struct *target, target->thread.fpu.fcr31 = fcr31 & ~FPU_CSR_ALL_X ; } +if (count >0 ) + err =user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf, + fir_pos, + fir_pos +sizeof (u32)); +return err; }
@@ -688,7 +702,7 @@ long arch_ptrace(struct task_struct *child, long request, fregs =get_fpu_regs (child);#ifdef CONFIG_32BIT -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
@@ -782,7 +796,7 @@ long arch_ptrace(struct task_struct *child, long request, child->thread.fpu.fcr31 =0 ; }#ifdef CONFIG_32BIT -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
arch/mips/kernel/ptrace32.c +2 -2
@@ -97,7 +97,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,break ; } fregs =get_fpu_regs (child); -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
@@ -203,7 +203,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, sizeof(child->thread.fpu)); child->thread.fpu.fcr31 =0 ; } -if (test_thread_flag (TIF_32BIT_FPREGS )) { +if (test_tsk_thread_flag (child,TIF_32BIT_FPREGS )) {/* * The odd registers are actually the high * order bits of the values stored in the even
arch/mips/kvm/mips.c +1 -1
@@ -39,7 +39,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { { "cache", VCPU_STAT(cache_exits), KVM_STAT_VCPU }, { "signal", VCPU_STAT(signal_exits), KVM_STAT_VCPU }, { "interrupt", VCPU_STAT(int_exits), KVM_STAT_VCPU }, - { "cop_unsuable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU }, + { "cop_unusable", VCPU_STAT(cop_unusable_exits), KVM_STAT_VCPU }, { "tlbmod", VCPU_STAT(tlbmod_exits), KVM_STAT_VCPU }, { "tlbmiss_ld", VCPU_STAT(tlbmiss_ld_exits), KVM_STAT_VCPU }, { "tlbmiss_st", VCPU_STAT(tlbmiss_st_exits), KVM_STAT_VCPU },
arch/mips/txx9/rbtx4939/setup.c +2 -2
@@ -186,7 +186,7 @@ static void __init rbtx4939_update_ioc_pen(void)#define RBTX4939_MAX_7SEGLEDS 8 -#if IS_ENABLED(CONFIG_LEDS_CLASS) +#if IS_BUILTIN(CONFIG_LEDS_CLASS) static u8 led_val[RBTX4939_MAX_7SEGLEDS]; struct rbtx4939_led_data { struct led_classdev cdev;
@@ -262,7 +262,7 @@ static inline void rbtx4939_led_setup(void)static void __rbtx4939_7segled_putc (unsigned int pos,unsigned char val) { -#if IS_ENABLED (CONFIG_LEDS_CLASS ) +#if IS_BUILTIN (CONFIG_LEDS_CLASS )unsigned long flags;local_irq_save (flags);/* bit7: reserved for LED class */
arch/powerpc/include/asm/irq_work.h +1 -0
@@ -5,5 +5,6 @@ static inline bool arch_irq_work_has_interrupt(void) {return true; } +extern void arch_irq_work_raise (void );#endif /* _ASM_POWERPC_IRQ_WORK_H */
arch/powerpc/perf/core-book3s.c +25 -0
@@ -443,6 +443,16 @@ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)/* invalid entry */ continue ; +/* +* BHRB rolling buffer could very much contain the kernel +* addresses at this point. Check the privileges before +* exporting it to userspace (avoid exposure of regions +* where we could have speculative execution) +*/ +if (perf_paranoid_kernel () && !capable (CAP_SYS_ADMIN ) && +is_kernel_addr (addr)) +continue ; +/* Branches are read most recent first (ie. mfbhrb 0 is * the most recent branch). * There are two types of valid entries:
@@ -1183,6 +1193,7 @@ static void power_pmu_disable(struct pmu *pmu)*/ write_mmcr0 (cpuhw, val);mb (); +isync ();/* * Disable instruction sampling if it was enabled
@@ -1191,12 +1202,26 @@ static void power_pmu_disable(struct pmu *pmu)mtspr (SPRN_MMCRA , cpuhw->mmcr[2 ] & ~MMCRA_SAMPLE_ENABLE );mb (); +isync (); } cpuhw->disabled =1 ; cpuhw->n_added =0 ;ebb_switch_out (mmcr0); + +#ifdef CONFIG_PPC64 +/* +* These are readable by userspace, may contain kernel +* addresses and are not switched by context switch, so clear +* them now to avoid leaking anything to userspace in general +* including to another process. +*/ +if (ppmu->flags &PPMU_ARCH_207S ) { +mtspr (SPRN_SDAR ,0 ); +mtspr (SPRN_SIAR ,0 ); + } +#endif }local_irq_restore (flags);
arch/powerpc/sysdev/mpic.c +1 -1
@@ -627,7 +627,7 @@ static inline u32 mpic_physmask(u32 cpumask)int i;u32 mask =0 ; -for (i =0 ; i <min (32 ,NR_CPUS ); ++i, cpumask >>=1 ) +for (i =0 ; i <min (32 ,NR_CPUS ) &&cpu_possible (i); ++i, cpumask >>=1 ) mask |= (cpumask &1 ) <<get_hard_smp_processor_id (i);return mask; }
arch/sh/kernel/entry-common.S +1 -1
@@ -255,7 +255,7 @@ debug_trap: mov.l @r8, r8 jsr @r8 nop - bra __restore_all + bra ret_from_exception nop CFI_ENDPROC
arch/sparc/include/asm/atomic_64.h +5 -1
@@ -70,7 +70,11 @@ ATOMIC_OPS(sub)#define atomic64_add_negative (i, v) (atomic64_add_return(i, v) < 0)#define atomic_cmpxchg (v, o, n) (cmpxchg(&((v)->counter), (o), (n))) -#define atomic_xchg (v, new) (xchg(&((v)->counter), new)) + +static inline int atomic_xchg (atomic_t *v,int new) +{ +return xchg (&v->counter, new); +}static inline int __atomic_add_unless (atomic_t *v,int a,int u) {
arch/x86/kernel/smpboot.c +1 -0
@@ -1290,6 +1290,7 @@ static void remove_siblinginfo(int cpu)cpumask_clear (cpu_core_mask (cpu)); c->phys_proc_id =0 ; c->cpu_core_id =0 ; + c->booted_cores =0 ;cpumask_clear_cpu (cpu, cpu_sibling_setup_mask); }
arch/x86/kvm/vmx.c +14 -6
@@ -2064,6 +2064,8 @@ static void vmx_queue_exception(struct kvm_vcpu *vcpu, unsigned nr,return ; } +WARN_ON_ONCE (vmx->emulation_required); +if (kvm_exception_is_soft (nr)) {vmcs_write32 (VM_ENTRY_INSTRUCTION_LEN , vmx->vcpu.arch.event_exit_inst_len);
@@ -5722,12 +5724,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) goto out; } -if (err !=EMULATE_DONE ) { - vcpu->run->exit_reason =KVM_EXIT_INTERNAL_ERROR ; - vcpu->run->internal.suberror =KVM_INTERNAL_ERROR_EMULATION ; - vcpu->run->internal.ndata =0 ; -return 0 ; - } +if (err !=EMULATE_DONE ) + goto emulation_error; + +if (vmx->emulation_required && !vmx->rmode.vm86_active && + vcpu->arch.exception.pending) + goto emulation_error;if (vcpu->arch.halt_request) { vcpu->arch.halt_request =0 ;
@@ -5743,6 +5745,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu) out:return ret; + +emulation_error: + vcpu->run->exit_reason =KVM_EXIT_INTERNAL_ERROR ; + vcpu->run->internal.suberror =KVM_INTERNAL_ERROR_EMULATION ; + vcpu->run->internal.ndata =0 ; +return 0 ; }static int __grow_ple_window (int val)
arch/x86/kvm/x86.c +4 -3
@@ -4025,13 +4025,14 @@ long kvm_arch_vm_ioctl(struct file *filp,break ; }case KVM_XEN_HVM_CONFIG : { +struct kvm_xen_hvm_config xhc; r = -EFAULT ; -if (copy_from_user (&kvm->arch.xen_hvm_config, argp, -sizeof (struct kvm_xen_hvm_config ))) +if (copy_from_user (&xhc, argp,sizeof (xhc))) goto out; r = -EINVAL ; -if (kvm->arch.xen_hvm_config.flags) +if (xhc.flags) goto out; +memcpy (&kvm->arch.xen_hvm_config, &xhc,sizeof (xhc)); r =0 ;break ; }
arch/x86/power/hibernate_32.c +1 -1
@@ -142,7 +142,7 @@ static inline void resume_init_first_level_page_table(pgd_t *pg_dir)#endif } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
arch/x86/power/hibernate_64.c +1 -1
@@ -78,7 +78,7 @@ static int set_up_temporary_mappings(void)return 0 ; } -int swsusp_arch_resume (void ) +asmlinkage int swsusp_arch_resume(void) {int error;
drivers/acpi/acpi_pad.c +3 -0
@@ -117,6 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index)cpumask_andnot (tmp, cpu_online_mask, pad_busy_cpus);if (cpumask_empty (tmp)) {mutex_unlock (&round_robin_lock); +free_cpumask_var (tmp);return ; }for_each_cpu (cpu, tmp) {
@@ -134,6 +135,8 @@ static void round_robin_cpu(unsigned int tsk_index)mutex_unlock (&round_robin_lock);set_cpus_allowed_ptr (current,cpumask_of (preferred_cpu)); + +free_cpumask_var (tmp); }static void exit_round_robin (unsigned int tsk_index)
drivers/acpi/acpica/evevent.c +7 -2
@@ -204,6 +204,7 @@ u32 acpi_ev_fixed_event_detect(void)u32 fixed_status;u32 fixed_enable;u32 i; +acpi_status status;ACPI_FUNCTION_NAME (ev_fixed_event_detect);
@@ -211,8 +212,12 @@ u32 acpi_ev_fixed_event_detect(void)* Read the fixed feature status and enable registers, as all the cases * depend on their values. Ignore errors here. */ - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); + status =acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); + status |= +acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); +if (ACPI_FAILURE (status)) { +return (int_status); + } ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, "Fixed Event Block: Enable %08X Status %08X\n",
drivers/acpi/acpica/nseval.c +8 -0
@@ -308,6 +308,14 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ status =AE_OK ; + }else if (ACPI_FAILURE (status)) { + +/* If return_object exists, delete it */ + +if (info->return_object) { +acpi_ut_remove_reference (info->return_object); + info->return_object =NULL ; + } } ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
drivers/acpi/processor_perflib.c +1 -1
@@ -165,7 +165,7 @@ int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag) {int ret; -if (ignore_ppc) { +if (ignore_ppc || !pr->performance) {/* * Only when it is notification event, the _OST object * will be evaluated. Otherwise it is skipped.
drivers/ata/libata-core.c +4 -0
@@ -4188,6 +4188,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {/* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, + /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on + SD7SN6S256G and SD8SN8U256G */ + { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, }, + /* devices which puke on READ_NATIVE_MAX */ { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, { "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_HORKAGE_BROKEN_HPA },
drivers/block/paride/pcd.c +2 -0
@@ -229,6 +229,8 @@ static int pcd_block_open(struct block_device *bdev, fmode_t mode)struct pcd_unit *cd = bdev->bd_disk->private_data;int ret; +check_disk_change (bdev); +mutex_lock (&pcd_mutex); ret =cdrom_open (&cd->info, bdev, mode);mutex_unlock (&pcd_mutex);
drivers/cdrom/cdrom.c +0 -3
@@ -1153,9 +1153,6 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,cd_dbg (CD_OPEN ,"entering cdrom_open\n" ); -/* open is event synchronization point, check events first */ -check_disk_change (bdev); -/* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */ cdi->use_count++;
drivers/cdrom/gdrom.c +3 -0
@@ -497,6 +497,9 @@ static struct cdrom_device_ops gdrom_ops = {static int gdrom_bdops_open (struct block_device *bdev,fmode_t mode) {int ret; + +check_disk_change (bdev); +mutex_lock (&gdrom_mutex); ret =cdrom_open (gd.cd_info, bdev, mode);mutex_unlock (&gdrom_mutex);
drivers/clk/samsung/clk-exynos3250.c +2 -2
@@ -740,7 +740,7 @@ static struct samsung_pll_rate_table exynos3250_epll_rates[] = {PLL_36XX_RATE (144000000 ,96 ,2 ,3 ,0 ),PLL_36XX_RATE (96000000 ,128 ,2 ,4 ,0 ),PLL_36XX_RATE (84000000 ,112 ,2 ,4 ,0 ), -PLL_36XX_RATE (80000004 ,106 ,2 ,4 ,43691 ), +PLL_36XX_RATE (80000003 ,106 ,2 ,4 ,43691 ),PLL_36XX_RATE (73728000 ,98 ,2 ,4 ,19923 ),PLL_36XX_RATE (67737598 ,270 ,3 ,5 ,62285 ), PLL_36XX_RATE( 65535999, 174, 2, 5, 49982),
@@ -776,7 +776,7 @@ static struct samsung_pll_rate_table exynos3250_vpll_rates[] = {PLL_36XX_RATE (148352005 ,98 ,2 ,3 ,59070 ),PLL_36XX_RATE (108000000 ,144 ,2 ,4 ,0 ),PLL_36XX_RATE (74250000 ,99 ,2 ,4 ,0 ), -PLL_36XX_RATE (74176002 ,98 ,3 ,4 ,59070 ), +PLL_36XX_RATE (74176002 ,98 ,2 ,4 ,59070 ),PLL_36XX_RATE (54054000 ,216 ,3 ,5 ,14156 ), PLL_36XX_RATE( 54000000, 144, 2, 5, 0), { /* sentinel */ }
drivers/clk/samsung/clk-exynos5250.c +4 -4
@@ -700,13 +700,13 @@ static struct samsung_pll_rate_table epll_24mhz_tbl[] __initdata = {/* sorted in descending order */ /* PLL_36XX_RATE(rate, m, p, s, k) */ PLL_36XX_RATE (192000000 ,64 ,2 ,2 ,0 ), -PLL_36XX_RATE (180633600 ,90 ,3 ,2 ,20762 ), +PLL_36XX_RATE (180633605 ,90 ,3 ,2 ,20762 ),PLL_36XX_RATE (180000000 ,90 ,3 ,2 ,0 ),PLL_36XX_RATE (73728000 ,98 ,2 ,4 ,19923 ), -PLL_36XX_RATE (67737600 ,90 ,2 ,4 ,20762 ), +PLL_36XX_RATE (67737602 ,90 ,2 ,4 ,20762 ),PLL_36XX_RATE (49152000 ,98 ,3 ,4 ,19923 ), -PLL_36XX_RATE (45158400 ,90 ,3 ,4 ,20762 ), - PLL_36XX_RATE(32768000, 131, 3, 5, 4719), +PLL_36XX_RATE (45158401 ,90 ,3 ,4 ,20762 ), + PLL_36XX_RATE(32768001, 131, 3, 5, 4719), { }, };
drivers/clk/samsung/clk-exynos5260.c +1 -1
@@ -102,7 +102,7 @@ static struct samsung_pll_rate_table pll2650_24mhz_tbl[] __initdata = {PLL_36XX_RATE (480000000 ,160 ,2 ,2 ,0 ),PLL_36XX_RATE (432000000 ,144 ,2 ,2 ,0 ),PLL_36XX_RATE (400000000 ,200 ,3 ,2 ,0 ), -PLL_36XX_RATE (394073130 ,459 ,7 ,2 ,49282 ), +PLL_36XX_RATE (394073128 ,459 ,7 ,2 ,49282 ),PLL_36XX_RATE (333000000 ,111 ,2 ,2 ,0 ),PLL_36XX_RATE (300000000 ,100 ,2 ,2 ,0 ), PLL_36XX_RATE(266000000, 266, 3, 3, 0),
drivers/clk/samsung/clk-s3c2410.c +8 -8
@@ -170,7 +170,7 @@ static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = {PLL_35XX_RATE (226000000 ,105 ,1 ,1 ),PLL_35XX_RATE (210000000 ,132 ,2 ,1 ),/* 2410 common */ -PLL_35XX_RATE (203000000 ,161 ,3 ,1 ), +PLL_35XX_RATE (202800000 ,161 ,3 ,1 ),PLL_35XX_RATE (192000000 ,88 ,1 ,1 ),PLL_35XX_RATE (186000000 ,85 ,1 ,1 ), PLL_35XX_RATE(180000000, 82, 1, 1),
@@ -180,18 +180,18 @@ static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = {PLL_35XX_RATE (147000000 ,90 ,2 ,1 ),PLL_35XX_RATE (135000000 ,82 ,2 ,1 ),PLL_35XX_RATE (124000000 ,116 ,1 ,2 ), -PLL_35XX_RATE (118000000 ,150 ,2 ,2 ), +PLL_35XX_RATE (118500000 ,150 ,2 ,2 ),PLL_35XX_RATE (113000000 ,105 ,1 ,2 ), -PLL_35XX_RATE (101000000 ,127 ,2 ,2 ), +PLL_35XX_RATE (101250000 ,127 ,2 ,2 ),PLL_35XX_RATE (90000000 ,112 ,2 ,2 ), -PLL_35XX_RATE (85000000 ,105 ,2 ,2 ), +PLL_35XX_RATE (84750000 ,105 ,2 ,2 ),PLL_35XX_RATE (79000000 ,71 ,1 ,2 ), -PLL_35XX_RATE (68000000 ,82 ,2 ,2 ), -PLL_35XX_RATE (56000000 ,142 ,2 ,3 ), +PLL_35XX_RATE (67500000 ,82 ,2 ,2 ), +PLL_35XX_RATE (56250000 ,142 ,2 ,3 ),PLL_35XX_RATE (48000000 ,120 ,2 ,3 ), -PLL_35XX_RATE (51000000 ,161 ,3 ,3 ), +PLL_35XX_RATE (50700000 ,161 ,3 ,3 ),PLL_35XX_RATE (45000000 ,82 ,1 ,3 ), - PLL_35XX_RATE(34000000, 82, 2, 3), + PLL_35XX_RATE(33750000, 82, 2, 3), { /* sentinel */ }, };
drivers/clocksource/fsl_ftm_timer.c +1 -1
@@ -282,7 +282,7 @@ static int __init __ftm_clk_init(struct device_node *np, char *cnt_name,static unsigned long __init ftm_clk_init (struct device_node *np) { -unsigned long freq; +long freq; freq =__ftm_clk_init (np,"ftm-evt-counter-en" ,"ftm-evt" );if (freq <=0 )
drivers/dma/pl330.c +4 -2
@@ -1516,7 +1516,7 @@ static void pl330_dotask(unsigned long data)/* Returns 1 if state was updated, 0 otherwise */ static int pl330_update (struct pl330_dmac *pl330) { -struct dma_pl330_desc *descdone, *tmp; +struct dma_pl330_desc *descdone;unsigned long flags;void __iomem *regs;u32 val;
@@ -1592,7 +1592,9 @@ static int pl330_update(struct pl330_dmac *pl330) }/* Now that we are in no hurry, do the callbacks */ -list_for_each_entry_safe (descdone, tmp, &pl330->req_done, rqd) { +while (!list_empty (&pl330->req_done)) { + descdone =list_first_entry (&pl330->req_done, + struct dma_pl330_desc, rqd);list_del (&descdone->rqd);spin_unlock_irqrestore (&pl330->lock, flags);dma_pl330_rqcb (descdone,PL330_ERR_NONE );
drivers/firewire/ohci.c +7 -1
@@ -1137,7 +1137,13 @@ static int context_add_buffer(struct context *ctx)return -ENOMEM ; offset = (void *)&desc->buffer - (void *)desc; - desc->buffer_size =PAGE_SIZE - offset; +/* +* Some controllers, like JMicron ones, always issue 0x20-byte DMA reads +* for descriptors, even 0x10-byte ones. This can cause page faults when +* an IOMMU is in use and the oversized read crosses a page boundary. +* Work around this by always leaving at least 0x10 bytes of padding. +*/ + desc->buffer_size =PAGE_SIZE - offset -0x10 ; desc->buffer_bus = bus_addr + offset; desc->used =0 ;
drivers/firmware/dmi_scan.c +9 -13
@@ -15,7 +15,7 @@* of and an antecedent to, SMBIOS, which stands for System * Management BIOS. See further: http://www.dmtf.org/standards */ -static const char dmi_empty_string[] =" " ; +static const char dmi_empty_string[] ="" ;static u16 __initdata dmi_ver;/*
@@ -36,25 +36,21 @@ static int dmi_memdev_nr;static const char *__init dmi_string_nosave (const struct dmi_header *dm,u8 s) {const u8 *bp = ((u8 *) dm) + dm->length; +const u8 *nsp;if (s) { - s--; -while (s >0 && *bp) { +while (--s >0 && *bp) bp +=strlen (bp) +1 ; - s--; - } - -if (*bp !=0 ) { -size_t len =strlen (bp)+1 ; -size_t cmp_len = len >8 ?8 : len; -if (!memcmp (bp, dmi_empty_string, cmp_len)) -return dmi_empty_string; +/* Strings containing only spaces are considered empty */ + nsp = bp; +while (*nsp ==' ' ) + nsp++; +if (*nsp !='\0' )return bp; - } } -return "" ; +return dmi_empty_string; }static const char *__init dmi_string (const struct dmi_header *dm,u8 s)
drivers/gpu/drm/exynos/regs-fimc.h +1 -1
@@ -569,7 +569,7 @@#define EXYNOS_CIIMGEFF_FIN_EMBOSSING (4 << 26)#define EXYNOS_CIIMGEFF_FIN_SILHOUETTE (5 << 26)#define EXYNOS_CIIMGEFF_FIN_MASK (7 << 26) -#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK ((0xff < 13) | (0xff < 0)) +#define EXYNOS_CIIMGEFF_PAT_CBCR_MASK ((0xff << 13) | (0xff << 0))/* Real input DMA size register */ #define EXYNOS_CIREAL_ISIZE_AUTOLOAD_ENABLE (1 << 31)
drivers/hid/hid-roccat-kovaplus.c +2 -0
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(uint value)static void kovaplus_profile_activated (struct kovaplus_device *kovaplus,uint new_profile_index) { +if (new_profile_index >=ARRAY_SIZE (kovaplus->profile_settings)) +return ; kovaplus->actual_profile = new_profile_index; kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
drivers/hwmon/nct6775.c +5 -5
@@ -1286,7 +1286,7 @@ static void nct6775_update_pwm(struct device *dev) duty_is_dc = data->REG_PWM_MODE[i] && (nct6775_read_value (data, data->REG_PWM_MODE[i]) & data->PWM_MODE_MASK[i]); - data->pwm_mode[i] = duty_is_dc; + data->pwm_mode[i] = !duty_is_dc; fanmodecfg =nct6775_read_value (data, data->REG_FAN_MODE[i]);for (j =0 ; j <ARRAY_SIZE (data->REG_PWM); j++) {
@@ -2145,7 +2145,7 @@ show_pwm_mode(struct device *dev, struct device_attribute *attr, char *buf)struct nct6775_data *data =nct6775_update_device (dev);struct sensor_device_attribute *sattr =to_sensor_dev_attr (attr); -return sprintf (buf,"%d\n" , !data->pwm_mode[sattr->index]); +return sprintf (buf,"%d\n" , data->pwm_mode[sattr->index]); } static ssize_t
@@ -2166,9 +2166,9 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,if (val >1 )return -EINVAL ; -/* Setting DC mode is not supported for all chips/channels */ +/* Setting DC mode (0) is not supported for all chips/channels */ if (data->REG_PWM_MODE[nr] ==0 ) { -if (val) +if (!val)return -EINVAL ;return count; }
@@ -2177,7 +2177,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, data->pwm_mode[nr] = val; reg =nct6775_read_value (data, data->REG_PWM_MODE[nr]); reg &= ~data->PWM_MODE_MASK[nr]; -if (val) +if (!val) reg |= data->PWM_MODE_MASK[nr];nct6775_write_value (data, data->REG_PWM_MODE[nr], reg);mutex_unlock (&data->update_lock);
drivers/hwmon/pmbus/adm1275.c +2 -2
@@ -67,7 +67,7 @@ static int adm1275_read_word_data(struct i2c_client *client, int page, int reg)const struct adm1275_data *data =to_adm1275_data (info);int ret =0 ; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
@@ -144,7 +144,7 @@ static int adm1275_write_word_data(struct i2c_client *client, int page, int reg, {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
drivers/hwmon/pmbus/max8688.c +1 -1
@@ -44,7 +44,7 @@ static int max8688_read_word_data(struct i2c_client *client, int page, int reg) {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
drivers/i2c/busses/i2c-mv64xxx.c +6 -2
@@ -783,12 +783,16 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,*/ if (of_device_is_compatible (np,"marvell,mv78230-i2c" )) { drv_data->offload_enabled = true; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"marvell,mv78230-a0-i2c" )) { drv_data->offload_enabled = false; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"allwinner,sun6i-a31-i2c" ))
drivers/ide/ide-cd.c +2 -0
@@ -1593,6 +1593,8 @@ static int idecd_open(struct block_device *bdev, fmode_t mode)struct cdrom_info *info;int rc = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&ide_cd_mutex); info =ide_cd_get (bdev->bd_disk);if (!info)
drivers/infiniband/hw/mlx5/qp.c +1 -4
@@ -3032,12 +3032,9 @@ int mlx5_ib_dealloc_xrcd(struct ib_xrcd *xrcd)int err; err =mlx5_core_xrcd_dealloc (dev->mdev, xrcdn); -if (err) { +if (err)mlx5_ib_warn (dev,"failed to dealloc xrcdn 0x%x\n" , xrcdn); -return err; - }kfree (xrcd); -return 0 ; }
drivers/infiniband/ulp/ipoib/ipoib_main.c +3 -0
@@ -1644,6 +1644,9 @@ static struct net_device *ipoib_add_port(const char *format, goto event_failed; } +/* call event handler to ensure pkey in sync */ +queue_work (ipoib_workqueue, &priv->flush_heavy); + result =register_netdev (priv->dev);if (result) { printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -488,7 +488,7 @@ static void gic_send_sgi(u64 cluster_id, u16 tlist, unsigned int irq)MPIDR_TO_SGI_AFFINITY (cluster_id,1 ) | tlist << ICC_SGI1R_TARGET_LIST_SHIFT); -pr_debug ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val); +pr_devel ("CPU%d: ICC_SGI1R_EL1 %llx\n" ,smp_processor_id (), val);gic_write_sgi1r (val); }
drivers/md/bcache/alloc.c +3 -1
@@ -285,8 +285,10 @@ do { \break ; \ \mutex_unlock (&(ca)->set->bucket_lock); \ -if (kthread_should_stop ()) \ +if (kthread_should_stop ()) { \ +set_current_state (TASK_RUNNING ); \return 0 ; \ + } \ \try_to_freeze (); \schedule (); \
drivers/md/bcache/bcache.h +1 -1
@@ -922,7 +922,7 @@ void bcache_write_super(struct cache_set *);int bch_flash_dev_create (struct cache_set *c,uint64_t size); -int bch_cached_dev_attach (struct cached_dev *,struct cache_set *); +int bch_cached_dev_attach (struct cached_dev *,struct cache_set *,uint8_t *);void bch_cached_dev_detach (struct cached_dev *);void bch_cached_dev_run (struct cached_dev *);void bcache_device_stop (struct bcache_device *);
drivers/md/bcache/btree.c +6 -3
@@ -1869,14 +1869,17 @@ void bch_initial_gc_finish(struct cache_set *c)*/ for_each_cache (ca, c, i) {for_each_bucket (b, ca) { -if (fifo_full (&ca->free[RESERVE_PRIO ])) +if (fifo_full (&ca->free[RESERVE_PRIO ]) && +fifo_full (&ca->free[RESERVE_BTREE ]))break ;if (bch_can_invalidate_bucket (ca, b) && !GC_MARK (b)) {__bch_invalidate_one_bucket (ca, b); -fifo_push (&ca->free[RESERVE_PRIO ], - b - ca->buckets); +if (!fifo_push (&ca->free[RESERVE_PRIO ], + b - ca->buckets)) +fifo_push (&ca->free[RESERVE_BTREE ], + b - ca->buckets); } } }
drivers/md/bcache/request.c +1 -1
@@ -631,11 +631,11 @@ static void do_bio_hook(struct search *s, struct bio *orig_bio)static void search_free (struct closure *cl) { struct search *s = container_of(cl, struct search, cl); -bio_complete (s);if (s->iop.bio)bio_put (s->iop.bio); +bio_complete (s);closure_debug_destroy (cl);mempool_free (s, s->d->c->search); }
drivers/md/bcache/super.c +18 -5
@@ -967,7 +967,8 @@ void bch_cached_dev_detach(struct cached_dev *dc)cached_dev_put (dc); } -int bch_cached_dev_attach (struct cached_dev *dc,struct cache_set *c) +int bch_cached_dev_attach (struct cached_dev *dc,struct cache_set *c, +uint8_t *set_uuid) {uint32_t rtime =cpu_to_le32 (get_seconds ());struct uuid_entry *u;
@@ -975,7 +976,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)bdevname (dc->bdev, buf); -if (memcmp (dc->sb.set_uuid, c->sb.set_uuid,16 )) +if ((set_uuid &&memcmp (set_uuid, c->sb.set_uuid,16 )) || + (!set_uuid &&memcmp (dc->sb.set_uuid, c->sb.set_uuid,16 )))return -ENOENT ;if (dc->disk.c) {
@@ -1209,7 +1211,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,list_add (&dc->list, &uncached_devices);list_for_each_entry (c, &bch_cache_sets, list) -bch_cached_dev_attach (dc, c); +bch_cached_dev_attach (dc, c,NULL );if (BDEV_STATE (&dc->sb) ==BDEV_STATE_NONE ||BDEV_STATE (&dc->sb) ==BDEV_STATE_STALE )
@@ -1729,7 +1731,7 @@ static void run_cache_set(struct cache_set *c)bcache_write_super (c);list_for_each_entry_safe (dc, t, &uncached_devices, list) -bch_cached_dev_attach (dc, c); +bch_cached_dev_attach (dc, c,NULL );flash_devs_run (c);
@@ -1848,6 +1850,7 @@ void bch_cache_release(struct kobject *kobj)static int cache_alloc (struct cache_sb *sb,struct cache *ca) {size_t free; +size_t btree_buckets;struct bucket *b;__module_get (THIS_MODULE );
@@ -1857,9 +1860,19 @@ static int cache_alloc(struct cache_sb *sb, struct cache *ca) ca->journal.bio.bi_max_vecs =8 ; ca->journal.bio.bi_io_vec = ca->journal.bio.bi_inline_vecs; +/* +* when ca->sb.njournal_buckets is not zero, journal exists, +* and in bch_journal_replay(), tree node may split, +* so bucket of RESERVE_BTREE type is needed, +* the worst situation is all journal buckets are valid journal, +* and all the keys need to replay, +* so the number of RESERVE_BTREE type buckets should be as much +* as journal buckets +*/ + btree_buckets = ca->sb.njournal_buckets ?:8 ; free =roundup_pow_of_two (ca->sb.nbuckets) >>10 ; - if (!init_fifo(&ca->free[RESERVE_BTREE], 8, GFP_KERNEL) || + if (!init_fifo(&ca->free[RESERVE_BTREE], btree_buckets, GFP_KERNEL) || !init_fifo_exact(&ca->free[RESERVE_PRIO], prio_buckets(ca), GFP_KERNEL) || !init_fifo(&ca->free[RESERVE_MOVINGGC], free, GFP_KERNEL) || !init_fifo(&ca->free[RESERVE_NONE], free, GFP_KERNEL) ||
drivers/md/bcache/sysfs.c +7 -4
@@ -191,7 +191,7 @@ STORE(__cached_dev) { struct cached_dev *dc = container_of(kobj, struct cached_dev, disk.kobj); -ssize_t v = size; +ssize_t v;struct cache_set *c;struct kobj_uevent_env *env;
@@ -263,17 +263,20 @@ STORE(__cached_dev) }if (attr == &sysfs_attach) { -if (bch_parse_uuid (buf, dc->sb.set_uuid) <16 ) +uint8_t set_uuid[16 ]; + +if (bch_parse_uuid (buf, set_uuid) <16 )return -EINVAL ; + v = -ENOENT ;list_for_each_entry (c, &bch_cache_sets, list) { - v =bch_cached_dev_attach (dc, c); + v =bch_cached_dev_attach (dc, c, set_uuid);if (!v)return size; }pr_err ("Can't attach %s: cache set not found" , buf); - size = v; +return v; }if (attr == &sysfs_detach && dc->disk.c)
drivers/md/bcache/writeback.c +22 -5
@@ -425,19 +425,28 @@ static int bch_writeback_thread(void *arg)while (!kthread_should_stop ()) {down_write (&dc->writeback_lock); -if (!atomic_read (&dc->has_dirty) || - (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && - !dc->writeback_running)) { +set_current_state (TASK_INTERRUPTIBLE ); +/* +* If the bache device is detaching, skip here and continue +* to perform writeback. Otherwise, if no dirty data on cache, +* or there is dirty data on cache but writeback is disabled, +* the writeback thread should sleep here and wait for others +* to wake up it. +*/ +if (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && + (!atomic_read (&dc->has_dirty) || !dc->writeback_running)) {up_write (&dc->writeback_lock); -set_current_state (TASK_INTERRUPTIBLE ); -if (kthread_should_stop ()) +if (kthread_should_stop ()) { +set_current_state (TASK_RUNNING );return 0 ; + }try_to_freeze ();schedule ();continue ; } +set_current_state (TASK_RUNNING ); searched_full_index =refill_dirty (dc);
@@ -447,6 +456,14 @@ static int bch_writeback_thread(void *arg)cached_dev_put (dc);SET_BDEV_STATE (&dc->sb,BDEV_STATE_CLEAN );bch_write_bdev_super (dc,NULL ); +/* +* If bcache device is detaching via sysfs interface, +* writeback thread should stop after there is no dirty +* data on cache. BCACHE_DEV_DETACHING flag is set in +* bch_cached_dev_detach(). +*/ +if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) +break ; }up_write (&dc->writeback_lock);
drivers/md/raid1.c +11 -0
@@ -1722,6 +1722,17 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)struct md_rdev *repl = conf->mirrors[conf->raid_disks + number].rdev;freeze_array (conf,0 ); +if (atomic_read (&repl->nr_pending)) { +/* It means that some queued IO of retry_list +* hold repl. Thus, we cannot set replacement +* as NULL, avoiding rdev NULL pointer +* dereference in sync_request_write and +* handle_write_finished. +*/ + err = -EBUSY ; +unfreeze_array (conf); + goto abort; + }clear_bit (Replacement, &repl->flags); p->rdev = repl; conf->mirrors[conf->raid_disks + number].rdev =NULL ;
drivers/md/raid10.c +4 -2
@@ -2754,7 +2754,8 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)for (m =0 ; m < conf->copies; m++) {int dev = r10_bio->devs[m].devnum; rdev = conf->mirrors[dev].rdev; -if (r10_bio->devs[m].bio ==NULL ) +if (r10_bio->devs[m].bio ==NULL || + r10_bio->devs[m].bio->bi_end_io ==NULL )continue ;if (test_bit (BIO_UPTODATE , &r10_bio->devs[m].bio->bi_flags)) {
@@ -2770,7 +2771,8 @@ static void handle_write_completed(struct r10conf *conf, struct r10bio *r10_bio)md_error (conf->mddev, rdev); } rdev = conf->mirrors[dev].replacement; -if (r10_bio->devs[m].repl_bio ==NULL ) +if (r10_bio->devs[m].repl_bio ==NULL || + r10_bio->devs[m].repl_bio->bi_end_io ==NULL )continue ;if (test_bit (BIO_UPTODATE , &r10_bio->devs[m].repl_bio->bi_flags)) {
drivers/media/dvb-core/dmxdev.c +1 -1
@@ -1069,7 +1069,7 @@ static int dvb_demux_do_ioctl(struct file *file,break ;default : - ret = -EINVAL ; + ret = -ENOTTY ;break ; }mutex_unlock (&dmxdev->mutex);
drivers/media/pci/cx23885/cx23885-cards.c +4 -0
@@ -1950,6 +1950,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) &dev->i2c_bus[2 ].i2c_adap, "cx25840", 0x88 >> 1, NULL);if (dev->sd_cx25840) { +/* set host data for clk_freq configuration */ +v4l2_set_subdev_hostdata (dev->sd_cx25840, + &dev->clk_freq); + dev->sd_cx25840->grp_id =CX23885_HW_AV_CORE ;v4l2_subdev_call (dev->sd_cx25840, core, load_fw); }
drivers/media/pci/cx23885/cx23885-core.c +10 -0
@@ -870,6 +870,16 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)if (cx23885_boards[dev->board].clk_freq >0 ) dev->clk_freq = cx23885_boards[dev->board].clk_freq; +if (dev->board ==CX23885_BOARD_HAUPPAUGE_IMPACTVCBE && + dev->pci->subsystem_device ==0x7137 ) { +/* Hauppauge ImpactVCBe device ID 0x7137 is populated +* with an 888, and a 25Mhz crystal, instead of the +* usual third overtone 50Mhz. The default clock rate must +* be overridden so the cx25840 is properly configured +*/ + dev->clk_freq =25000000 ; + } + dev->pci_bus = dev->pci->bus->number; dev->pci_slot =PCI_SLOT (dev->pci->devfn);cx23885_irq_add (dev,0x001f00 );
drivers/media/pci/cx25821/cx25821-core.c +4 -3
@@ -871,6 +871,10 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) dev->nr = ++cx25821_devcount;sprintf (dev->name,"cx25821[%d]" , dev->nr); +if (dev->nr >=ARRAY_SIZE (card)) { +CX25821_INFO ("dev->nr >= %zd" ,ARRAY_SIZE (card)); +return -ENODEV ; + }if (dev->pci->device !=0x8210 ) {pr_info ("%s(): Exiting. Incorrect Hardware device = 0x%02x\n" , __func__, dev->pci->device);
@@ -887,9 +891,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) dev->channels[i].sram_channels = &cx25821_sram_channels[i]; } -if (dev->nr >1 ) -CX25821_INFO ("dev->nr > 1!" ); -/* board config */ dev->board =1 ;/* card[dev->nr]; */ dev->_max_num_decoders =MAX_DECODERS ;
drivers/media/platform/s3c-camif/camif-capture.c +4 -3
@@ -1280,16 +1280,17 @@ static void __camif_subdev_try_format(struct camif_dev *camif, {const struct s3c_camif_variant *variant = camif->variant;const struct vp_pix_limits *pix_lim; -int i =ARRAY_SIZE (camif_mbus_formats); +unsigned int i;/* FIXME: constraints against codec or preview path ? */ pix_lim = &variant->vp_pix_limits[VP_CODEC ]; -while (i-- >=0 ) +for (i =0 ; i <ARRAY_SIZE (camif_mbus_formats); i++)if (camif_mbus_formats[i] == mf->code)break ; - mf->code = camif_mbus_formats[i]; +if (i ==ARRAY_SIZE (camif_mbus_formats)) + mf->code = camif_mbus_formats[0 ];if (pad ==CAMIF_SD_PAD_SINK ) { v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH,
drivers/media/usb/em28xx/em28xx.h +1 -1
@@ -183,7 +183,7 @@USB 2.0 spec says bulk packet size is always 512 bytes */ #define EM28XX_BULK_PACKET_MULTIPLIER 384 -#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 384 +#define EM28XX_DVB_BULK_PACKET_MULTIPLIER 94#define EM28XX_INTERLACED_DEFAULT 1
drivers/message/fusion/mptctl.c +2 -0
@@ -2694,6 +2694,8 @@ mptctl_hp_targetinfo(unsigned long arg) __FILE__, __LINE__, iocnum);return -ENODEV ; } +if (karg.hdr.id >=MPT_MAX_FC_DEVICES ) +return -EINVAL ;dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_hp_targetinfo called.\n" , ioc->name));
drivers/net/ethernet/intel/e1000e/ich8lan.c +1 -1
@@ -1441,7 +1441,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)* we have already determined whether we have link or not. */ if (!mac->autoneg) -return -E1000_ERR_CONFIG ; +return 1 ;/* Auto-Neg is enabled. Auto Speed Detection takes care * of MAC speed/duplex configuration. So we only need to
drivers/net/ethernet/intel/e1000e/mac.c +1 -1
@@ -450,7 +450,7 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)* we have already determined whether we have link or not. */ if (!mac->autoneg) -return -E1000_ERR_CONFIG ; +return 1 ;/* Auto-Neg is enabled. Auto Speed Detection takes care * of MAC speed/duplex configuration. So we only need to
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -2330,8 +2330,8 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter, {struct pci_dev *pdev = adapter->pdev; - ring->desc =dma_alloc_coherent (&pdev->dev, ring->size, &ring->dma, -GFP_KERNEL ); + ring->desc =dma_zalloc_coherent (&pdev->dev, ring->size, &ring->dma, +GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
drivers/net/ethernet/marvell/mvneta.c +1 -0
@@ -748,6 +748,7 @@ static void mvneta_port_up(struct mvneta_port *pp) }mvreg_write (pp,MVNETA_TXQ_CMD , q_map); + q_map =0 ;/* Enable all initialized RXQs. */ q_map =0 ;for (queue =0 ; queue < rxq_number; queue++) {
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 -1
@@ -1371,7 +1371,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) cmd->checksum_disabled =1 ; cmd->max_reg_cmds = (1 << cmd->log_sz) -1 ; - cmd->bitmask = (1 << cmd->max_reg_cmds) -1 ; + cmd->bitmask = (1UL << cmd->max_reg_cmds) -1 ; cmd->cmdif_rev =ioread32be (&dev->iseg->cmdif_rev_fw_sub) >>16 ;if (cmd->cmdif_rev >CMD_IF_REV ) {
drivers/net/phy/dp83640.c +18 -0
@@ -1173,6 +1173,23 @@ static void dp83640_remove(struct phy_device *phydev)kfree (dp83640); } +static int dp83640_soft_reset (struct phy_device *phydev) +{ +int ret; + + ret =genphy_soft_reset (phydev); +if (ret <0 ) +return ret; + +/* From DP83640 datasheet: "Software driver code must wait 3 us +* following a software reset before allowing further serial MII +* operations with the DP83640." +*/ +udelay (10 );/* Taking udelay inaccuracy into account */ + +return 0 ; +} +static int dp83640_config_init (struct phy_device *phydev) {struct dp83640_private *dp83640 = phydev->priv;
@@ -1470,6 +1487,7 @@ static struct phy_driver dp83640_driver = { .flags = PHY_HAS_INTERRUPT, .probe = dp83640_probe, .remove = dp83640_remove, + .soft_reset = dp83640_soft_reset, .config_init = dp83640_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status,
drivers/net/usb/qmi_wwan.c +4 -0
@@ -679,6 +679,9 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
@@ -755,6 +758,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ + {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
drivers/net/usb/r8152.c +1 -1
@@ -1590,7 +1590,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg) tx_data += len; agg->skb_len += len; - agg->skb_num++; + agg->skb_num +=skb_shinfo (skb)->gso_segs ?:1 ;dev_kfree_skb_any (skb);
drivers/net/usb/smsc75xx.c +4 -3
@@ -945,10 +945,11 @@ static int smsc75xx_set_features(struct net_device *netdev,/* it's racing here! */ ret =smsc75xx_write_reg (dev,RFE_CTL , pdata->rfe_ctl); -if (ret <0 ) +if (ret <0 ) {netdev_warn (dev->net,"Error writing RFE_CTL\n" ); - -return ret; +return ret; + } +return 0 ; }static int smsc75xx_wait_ready (struct usbnet *dev,int in_pm)
drivers/net/virtio_net.c +1 -1
@@ -1876,8 +1876,8 @@ static int virtnet_probe(struct virtio_device *vdev)/* Assume link up if device can't report link status, otherwise get link status from config. */ +netif_carrier_off (dev);if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_STATUS )) { -netif_carrier_off (dev);schedule_work (&vi->config_work); }else { vi->status =VIRTIO_NET_S_LINK_UP ;
drivers/net/wireless/ath/ath10k/mac.c +10 -0
@@ -4319,10 +4319,20 @@ static void ath10k_sta_rc_update(struct ieee80211_hw *hw, {struct ath10k *ar = hw->priv;struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; +struct ath10k_vif *arvif = (void *)vif->drv_priv; +struct ath10k_peer *peer;u32 bw, smps;spin_lock_bh (&ar->data_lock); + peer =ath10k_peer_find (ar, arvif->vdev_id, sta->addr); +if (!peer) { +spin_unlock_bh (&ar->data_lock); +ath10k_warn (ar,"mac sta rc update failed to find peer %pM on vdev %i\n" , + sta->addr, arvif->vdev_id); +return ; + } + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", sta->addr, changed, sta->bandwidth, sta->rx_nss,
drivers/parisc/lba_pci.c +19 -1
@@ -1366,9 +1366,27 @@ lba_hw_init(struct lba_device *d)WRITE_REG32 (stat, d->hba.base_addr +LBA_ERROR_CONFIG ); } -/* Set HF mode as the default (vs. -1 mode). */ + +/* +* Hard Fail vs. Soft Fail on PCI "Master Abort". +* +* "Master Abort" means the MMIO transaction timed out - usually due to +* the device not responding to an MMIO read. We would like HF to be +* enabled to find driver problems, though it means the system will +* crash with a HPMC. +* +* In SoftFail mode "~0L" is returned as a result of a timeout on the +* pci bus. This is like how PCI busses on x86 and most other +* architectures behave. In order to increase compatibility with +* existing (x86) PCI hardware and existing Linux drivers we enable +* Soft Faul mode on PA-RISC now too. +*/ stat =READ_REG32 (d->hba.base_addr +LBA_STAT_CTL ); +#if defined(ENABLE_HARDFAIL )WRITE_REG32 (stat |HF_ENABLE , d->hba.base_addr +LBA_STAT_CTL ); +#else +WRITE_REG32 (stat & ~HF_ENABLE , d->hba.base_addr +LBA_STAT_CTL ); +#endif /* ** Writing a zero to STAT_CTL.rf (bit 0) will clear reset signal
drivers/pci/pci-driver.c +11 -6
@@ -1120,11 +1120,14 @@ static int pci_pm_runtime_suspend(struct device *dev)int error;/* -* If pci_dev->driver is not set (unbound), the device should -* always remain in D0 regardless of the runtime PM status +* If pci_dev->driver is not set (unbound), we leave the device in D0, +* but it may go to D3cold when the bridge above it runtime suspends. +* Save its config space in case that happens. */ -if (!pci_dev->driver) +if (!pci_dev->driver) { +pci_save_state (pci_dev);return 0 ; + }if (!pm || !pm->runtime_suspend)return -ENOSYS ;
@@ -1163,16 +1166,18 @@ static int pci_pm_runtime_resume(struct device *dev)const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ;/* -* If pci_dev->driver is not set (unbound), the device should -* always remain in D0 regardless of the runtime PM status +* Restoring config space is necessary even if the device is not bound +* to a driver because although we left it in D0, it may have gone to +* D3cold when the bridge above it runtime suspended. */ +pci_restore_standard_config (pci_dev); +if (!pci_dev->driver)return 0 ;if (!pm || !pm->runtime_resume)return -ENOSYS ; -pci_restore_standard_config (pci_dev);pci_fixup_device (pci_fixup_resume_early, pci_dev);__pci_enable_wake (pci_dev,PCI_D0 , true, false);pci_fixup_device (pci_fixup_resume, pci_dev);
drivers/pci/quirks.c +5 -0
@@ -3559,6 +3559,8 @@ static void quirk_dma_func1_alias(struct pci_dev *dev)*/ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9123 , quirk_dma_func1_alias); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9128 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9130 , quirk_dma_func1_alias);
@@ -3571,6 +3573,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x917a,/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x91a0 , quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9220 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9230 , quirk_dma_func1_alias);
drivers/regulator/of_regulator.c +1 -0
@@ -181,6 +181,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,dev_err (dev,"failed to parse DT for regulator %s\n" , child->name); +of_node_put (child);return -EINVAL ; } match->of_node =of_node_get (child);
drivers/rtc/rtc-tx4939.c +4 -2
@@ -86,7 +86,8 @@ static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm)for (i =2 ; i <6 ; i++) buf[i] =__raw_readl (&rtcreg->dat);spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, tm);return rtc_valid_tm (tm); }
@@ -147,7 +148,8 @@ static int tx4939_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) alrm->enabled = (ctl &TX4939_RTCCTL_ALME ) ?1 :0 ; alrm->pending = (ctl &TX4939_RTCCTL_ALMD ) ?1 :0 ;spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, &alrm->time);return rtc_valid_tm (&alrm->time); }
drivers/s390/cio/device_fsm.c +5 -2
@@ -784,6 +784,7 @@ ccw_device_online_timeout(struct ccw_device *cdev, enum dev_event dev_event)ccw_device_set_timeout (cdev,0 ); cdev->private->iretry =255 ; + cdev->private->async_kill_io_rc = -ETIMEDOUT ; ret =ccw_device_cancel_halt_clear (cdev);if (ret == -EBUSY ) {ccw_device_set_timeout (cdev,3 *HZ );
@@ -860,7 +861,7 @@ ccw_device_killing_irq(struct ccw_device *cdev, enum dev_event dev_event)/* OK, i/o is dead now. Call interrupt handler. */ if (cdev->handler) cdev->handler (cdev, cdev->private->intparm, -ERR_PTR (-EIO )); +ERR_PTR (cdev->private->async_kill_io_rc)); } static void
@@ -877,14 +878,16 @@ ccw_device_killing_timeout(struct ccw_device *cdev, enum dev_event dev_event)ccw_device_online_verify (cdev,0 );if (cdev->handler) cdev->handler (cdev, cdev->private->intparm, -ERR_PTR (-EIO )); +ERR_PTR (cdev->private->async_kill_io_rc)); }void ccw_device_kill_io (struct ccw_device *cdev) {int ret; +ccw_device_set_timeout (cdev,0 ); cdev->private->iretry =255 ; + cdev->private->async_kill_io_rc = -EIO ; ret =ccw_device_cancel_halt_clear (cdev);if (ret == -EBUSY ) {ccw_device_set_timeout (cdev,3 *HZ );
drivers/s390/cio/io_sch.h +1 -0
@@ -155,6 +155,7 @@ struct ccw_device_private {unsigned long intparm;/* user interruption parameter */ struct qdio_irq *qdio_data;struct irb irb;/* device status */ +int async_kill_io_rc;struct senseid senseid;/* SenseID info */ struct pgid pgid[8 ];/* path group IDs per chpid*/ struct ccw1 iccws[2 ];/* ccws for SNID/SID/SPGID commands */
drivers/scsi/aacraid/commsup.c +3 -1
@@ -1270,9 +1270,10 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) host = aac->scsi_host_ptr;scsi_block_requests (host);aac_adapter_disable_int (aac); -if (aac->thread->pid != current->pid) { +if (aac->thread && aac->thread->pid != current->pid) {spin_unlock_irq (host->host_lock);kthread_stop (aac->thread); + aac->thread =NULL ; jafo =1 ; }
@@ -1343,6 +1344,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced) aac->name);if (IS_ERR (aac->thread)) { retval =PTR_ERR (aac->thread); + aac->thread =NULL ; goto out; } }
drivers/scsi/aacraid/linit.c +4 -1
@@ -1096,6 +1096,7 @@ static void __aac_shutdown(struct aac_dev * aac)up (&fib->event_wait); }kthread_stop (aac->thread); + aac->thread =NULL ; }aac_send_shutdown (aac);aac_adapter_disable_int (aac);
@@ -1172,8 +1173,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)* Map in the registers from the adapter. */ aac->base_size =AAC_MIN_FOOTPRINT_SIZE ; -if ((*aac_drivers[index].init)(aac)) +if ((*aac_drivers[index].init)(aac)) { + error = -ENODEV ; goto out_unmap; + }if (aac->sync_mode) {if (aac_sync_mode)
drivers/scsi/arm/fas216.c +1 -1
@@ -2010,7 +2010,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt,* have valid data in the sense buffer that could * confuse the higher levels. */ -memset (SCpnt->sense_buffer,0 ,sizeof (SCpnt->sense_buffer)); +memset (SCpnt->sense_buffer,0 ,SCSI_SENSE_BUFFERSIZE );//printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); //{ int i; for (i = 0; i < 32; i++) printk("%02x ", SCpnt->sense_buffer[i]); printk("\n"); } /*
drivers/scsi/bnx2fc/bnx2fc_io.c +1 -0
@@ -1932,6 +1932,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,/* we will not receive ABTS response for this IO */ BNX2FC_IO_DBG (io_req,"Timer context finished processing " "this scsi cmd\n" ); +return ; }/* Cancel the timeout_work, as we received IO completion */
drivers/scsi/lpfc/lpfc_attr.c +5 -0
@@ -629,7 +629,12 @@ lpfc_issue_lip(struct Scsi_Host *shost)LPFC_MBOXQ_t *pmboxq;int mbxstatus =MBXERR_ERROR ; +/* +* If the link is offline, disabled or BLOCK_MGMT_IO +* it doesn't make any sense to allow issue_lip +*/ if ((vport->fc_flag &FC_OFFLINE_MODE ) || + (phba->hba_flag &LINK_DISABLED ) || (phba->sli.sli_flag &LPFC_BLOCK_MGMT_IO ))return -EPERM ;
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -2
@@ -716,8 +716,9 @@ lpfc_work_done(struct lpfc_hba *phba) (phba->hba_flag & HBA_SP_QUEUE_EVT)) {if (pring->flag &LPFC_STOP_IOCB_EVENT ) { pring->flag |=LPFC_DEFERRED_RING_EVENT ; -/* Set the lpfc data pending flag */ -set_bit (LPFC_DATA_READY , &phba->data_flags); +/* Preserve legacy behavior. */ +if (!(phba->hba_flag &HBA_SP_QUEUE_EVT )) +set_bit (LPFC_DATA_READY , &phba->data_flags); }else {if (phba->link_state >=LPFC_LINK_UP ) { pring->flag &= ~LPFC_DEFERRED_RING_EVENT ;
drivers/scsi/lpfc/lpfc_sli.c +2 -0
@@ -115,6 +115,8 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe)/* set consumption flag every once in a while */ if (!((q->host_index +1 ) % q->entry_repost))bf_set (wqe_wqec, &wqe->generic.wqe_com,1 ); +else +bf_set (wqe_wqec, &wqe->generic.wqe_com,0 );if (q->phba->sli3_options &LPFC_SLI4_PHWQ_ENABLED )bf_set (wqe_wqid, &wqe->generic.wqe_com, q->queue_id);lpfc_sli_pcimem_bcopy (wqe, temp_wqe, q->entry_size);
drivers/scsi/qla2xxx/qla_isr.c +4 -2
@@ -268,7 +268,8 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;/* Read all mbox registers? */ - mboxes = (1 << ha->mbx_count) -1 ; +WARN_ON_ONCE (ha->mbx_count >32 ); + mboxes = (1ULL << ha->mbx_count) -1 ;if (!ha->mcp)ql_dbg (ql_dbg_async, vha,0x5001 ,"MBX pointer ERROR.\n" );else
@@ -2454,7 +2455,8 @@ qla24xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;/* Read all mbox registers? */ - mboxes = (1 << ha->mbx_count) -1 ; +WARN_ON_ONCE (ha->mbx_count >32 ); + mboxes = (1ULL << ha->mbx_count) -1 ;if (!ha->mcp)ql_dbg (ql_dbg_async, vha,0x504e ,"MBX pointer ERROR.\n" );else
drivers/scsi/qla4xxx/ql4_def.h +2 -0
@@ -167,6 +167,8 @@#define DEV_DB_NON_PERSISTENT 0#define DEV_DB_PERSISTENT 1 +#define QL4_ISP_REG_DISCONNECT 0xffffffffU +#define COPY_ISID (dst_isid, src_isid) { \ int i, j; \ for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \
drivers/scsi/qla4xxx/ql4_os.c +46 -0
95 lines not on this page · raw message
drivers/scsi/sd.c +2 -1
@@ -2318,6 +2318,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)int res;struct scsi_device *sdp = sdkp->device;struct scsi_mode_data data; +int disk_ro =get_disk_ro (sdkp->disk);int old_wp = sdkp->write_prot;set_disk_ro (sdkp->disk,0 );
@@ -2358,7 +2359,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) "Test WP failed, assume Write Enabled\n"); }else { sdkp->write_prot = ((data.device_specific &0x80 ) !=0 ); -set_disk_ro (sdkp->disk, sdkp->write_prot); +set_disk_ro (sdkp->disk, sdkp->write_prot || disk_ro);if (sdkp->first_scan || old_wp != sdkp->write_prot) {sd_printk (KERN_NOTICE , sdkp,"Write Protect is %s\n" , sdkp->write_prot ?"on" :"off" );
drivers/scsi/sr.c +17 -4
@@ -522,6 +522,8 @@ static int sr_block_open(struct block_device *bdev, fmode_t mode)struct scsi_cd *cd;int ret = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&sr_mutex); cd =scsi_cd_get (bdev->bd_disk);if (cd) {
@@ -587,18 +589,28 @@ out:static unsigned int sr_block_check_events (struct gendisk *disk,unsigned int clearing) { -struct scsi_cd *cd =scsi_cd (disk); +unsigned int ret =0 ; +struct scsi_cd *cd; -if (atomic_read (&cd->device->disk_events_disable_depth)) + cd =scsi_cd_get (disk); +if (!cd)return 0 ; -return cdrom_check_events (&cd->cdi, clearing); +if (!atomic_read (&cd->device->disk_events_disable_depth)) + ret =cdrom_check_events (&cd->cdi, clearing); + +scsi_cd_put (cd); +return ret; }static int sr_block_revalidate_disk (struct gendisk *disk) { -struct scsi_cd *cd =scsi_cd (disk);struct scsi_sense_hdr sshdr; +struct scsi_cd *cd; + + cd =scsi_cd_get (disk); +if (!cd) +return -ENXIO ;/* if the unit is not ready, nothing more to do */ if (scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr))
@@ -607,6 +619,7 @@ static int sr_block_revalidate_disk(struct gendisk *disk)sr_cd_check (&cd->cdi);get_sectorsize (cd); out: +scsi_cd_put (cd);return 0 ; }
drivers/scsi/sym53c8xx_2/sym_hipd.c +1 -1
@@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa* Look for the greatest clock divisor that allows an * input speed faster than the period. */ -while (div-- >0 ) +while (--div >0 )if (kpc >= (div_10M[div] <<2 ))break ;/*
drivers/scsi/ufs/ufshcd.c +2 -0
@@ -2795,6 +2795,8 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)/* REPORT SUPPORTED OPERATION CODES is not supported */ sdev->no_report_opcodes =1 ; +/* WRITE_SAME command is not supported */ + sdev->no_write_same =1 ;ufshcd_set_queue_depth (sdev);
drivers/staging/rtl8192u/r8192U_core.c +2 -0
@@ -1682,6 +1682,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) priv->rx_urb[16 ] =usb_alloc_urb (0 ,GFP_KERNEL ); priv->oldaddr =kmalloc (16 ,GFP_KERNEL ); +if (!priv->oldaddr) +return -ENOMEM ; oldaddr = priv->oldaddr; align = ((long )oldaddr) &3 ;if (align) {
drivers/tty/serial/arc_uart.c +5 -0
@@ -597,6 +597,11 @@ static int arc_serial_probe(struct platform_device *pdev)if (dev_id <0 ) dev_id =0 ; +if (dev_id >=ARRAY_SIZE (arc_uart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , dev_id); +return -EINVAL ; + } + uart = &arc_uart_ports[dev_id]; port = &uart->port;
drivers/tty/serial/fsl_lpuart.c +4 -0
@@ -1791,6 +1791,10 @@ static int lpuart_probe(struct platform_device *pdev)dev_err (&pdev->dev,"failed to get alias id, errno %d\n" , ret);return ret; } +if (ret >=ARRAY_SIZE (lpuart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , ret); +return -EINVAL ; + } sport->port.line = ret; sport->lpuart32 =of_device_is_compatible (np,"fsl,ls1021a-lpuart" ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
drivers/tty/serial/imx.c +6 -0
@@ -1899,6 +1899,12 @@ static int serial_imx_probe(struct platform_device *pdev)else if (ret <0 )return ret; +if (sport->port.line >=ARRAY_SIZE (imx_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , + sport->port.line); +return -EINVAL ; + } + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (base))
drivers/tty/serial/samsung.c +4 -0
@@ -1288,6 +1288,10 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)dbg ("s3c24xx_serial_probe(%p) %d\n" , pdev, index); +if (index >=ARRAY_SIZE (s3c24xx_serial_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , index); +return -EINVAL ; + } ourport = &s3c24xx_serial_ports[index]; ourport->drv_data =s3c24xx_get_driver_data (pdev);
drivers/tty/serial/xilinx_uartps.c +1 -1
@@ -1001,7 +1001,7 @@ static struct uart_port *cdns_uart_get_port(int id)struct uart_port *port;/* Try the given port id if failed use default method */ -if (cdns_uart_port[id].mapbase !=0 ) { +if (id <CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase !=0 ) {/* Find the next unused port */ for (id =0 ; id <CDNS_UART_NR_PORTS ; id++)if (cdns_uart_port[id].mapbase ==0 )
drivers/usb/dwc2/core.h +1 -1
@@ -144,7 +144,7 @@ struct s3c_hsotg_ep {unsigned char dir_in;unsigned char index;unsigned char mc; -unsigned char interval; +u16 interval; unsigned int halted:1; unsigned int periodic:1;
drivers/usb/dwc3/core.h +2 -0
@@ -178,6 +178,8 @@#define DWC3_GUSB3PIPECTL_SUSPHY (1 << 17)/* Global TX Fifo Size Register */ +#define DWC31_GTXFIFOSIZ_TXFRAMNUM BIT(15)/* DWC_usb31 only */ +#define DWC31_GTXFIFOSIZ_TXFDEF (n) ((n) & 0x7fff)/* DWC_usb31 only */ #define DWC3_GTXFIFOSIZ_TXFDEF (n) ((n) & 0xffff)#define DWC3_GTXFIFOSIZ_TXFSTADDR (n) ((n) & 0xffff0000)
drivers/usb/gadget/composite.c +19 -21
@@ -1279,7 +1279,7 @@ static int count_ext_compat(struct usb_configuration *c)return res; } -static void fill_ext_compat (struct usb_configuration *c,u8 *buf) +static int fill_ext_compat (struct usb_configuration *c,u8 *buf) {int i, count;
@@ -1306,10 +1306,12 @@ static void fill_ext_compat(struct usb_configuration *c, u8 *buf) buf +=23 ; } count +=24 ; -if (count >=4096 ) -return ; +if (count +24 >=USB_COMP_EP0_OS_DESC_BUFSIZ ) +return count; } } + +return count; }static int count_ext_prop (struct usb_configuration *c,int interface)
@@ -1354,25 +1356,20 @@ static int fill_ext_prop(struct usb_configuration *c, int interface, u8 *buf)struct usb_os_desc *d;struct usb_os_desc_ext_prop *ext_prop;int j, count, n, ret; -u8 *start = buf; f = c->interface[interface]; + count =10 ;/* header length */ for (j =0 ; j < f->os_desc_n; ++j) {if (interface != f->os_desc_table[j].if_id)continue ; d = f->os_desc_table[j].os_desc;if (d)list_for_each_entry (ext_prop, &d->ext_prop, entry) { -/* 4kB minus header length */ - n = buf - start; -if (n >=4086 ) -return 0 ; - - count = ext_prop->data_len + + n = ext_prop->data_len + ext_prop->name_len +14 ; -if (count >4086 - n) -return -EINVAL ; -usb_ext_prop_put_size (buf, count); +if (count + n >=USB_COMP_EP0_OS_DESC_BUFSIZ ) +return count; +usb_ext_prop_put_size (buf, n);usb_ext_prop_put_type (buf, ext_prop->type); ret =usb_ext_prop_put_name (buf, ext_prop->name, ext_prop->name_len);
@@ -1398,11 +1395,12 @@ static int fill_ext_prop(struct usb_configuration *c, int interface, u8 *buf)default :return -EINVAL ; } - buf += count; + buf += n; + count += n; } } -return 0 ; +return count; }/*
@@ -1630,6 +1628,7 @@ unknown: req->complete = composite_setup_complete; buf = req->buf; os_desc_cfg = cdev->os_desc_config; + w_length =min_t (u16, w_length,USB_COMP_EP0_OS_DESC_BUFSIZ );memset (buf,0 , w_length); buf[5 ] =0x01 ;switch (ctrl->bRequestType &USB_RECIP_MASK ) {
@@ -1653,8 +1652,8 @@ unknown: count +=16 ;/* header */ put_unaligned_le32 (count, buf); buf +=16 ; -fill_ext_compat (os_desc_cfg, buf); - value = w_length; + value =fill_ext_compat (os_desc_cfg, buf); + value =min_t (u16, w_length, value); }break ;case USB_RECIP_INTERFACE :
@@ -1683,8 +1682,7 @@ unknown: interface, buf);if (value <0 )return value; - - value = w_length; + value =min_t (u16, w_length, value); }break ; }
@@ -1938,8 +1936,8 @@ int composite_os_desc_req_prepare(struct usb_composite_dev *cdev, goto end; } -/* OS feature descriptor length <= 4kB */ - cdev->os_desc_req->buf =kmalloc (4096 ,GFP_KERNEL ); + cdev->os_desc_req->buf =kmalloc (USB_COMP_EP0_OS_DESC_BUFSIZ , +GFP_KERNEL );if (!cdev->os_desc_req->buf) { ret =PTR_ERR (cdev->os_desc_req->buf);kfree (cdev->os_desc_req);
drivers/usb/gadget/function/f_fs.c +1 -1
@@ -2987,7 +2987,7 @@ static int ffs_func_setup(struct usb_function *f,__ffs_event_add (ffs,FUNCTIONFS_SETUP );spin_unlock_irqrestore (&ffs->ev.waitq.lock, flags); -return 0 ; +return USB_GADGET_DELAYED_STATUS ; }static void ffs_func_suspend (struct usb_function *f)
drivers/usb/gadget/function/f_uac2.c +2 -0
@@ -1029,6 +1029,8 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)dev_err (dev,"%s:%d Error!\n" , __func__, __LINE__);return ret; } + iad_desc.bFirstInterface = ret; + std_ac_if_desc.bInterfaceNumber = ret; agdev->ac_intf = ret; agdev->ac_alt =0 ;
drivers/usb/gadget/udc/fsl_udc_core.c +2 -2
@@ -1305,7 +1305,7 @@ static void udc_reset_ep_queue(struct fsl_udc *udc, u8 pipe) {struct fsl_ep *ep =get_ep_by_pipe (udc, pipe); -if (ep->name) +if (ep->ep.name)nuke (ep, -ESHUTDOWN ); }
@@ -1693,7 +1693,7 @@ static void dtd_complete_irq(struct fsl_udc *udc) curr_ep =get_ep_by_pipe (udc, i);/* If the ep is configured */ -if (curr_ep->name ==NULL ) { +if (!curr_ep->ep.name) {WARNING ("Invalid EP?" );continue ; }
drivers/usb/gadget/udc/goku_udc.h +1 -1
@@ -28,7 +28,7 @@ struct goku_udc_regs {# define INT_EP1DATASET 0x00040# define INT_EP2DATASET 0x00080# define INT_EP3DATASET 0x00100 -#define INT_EPnNAK (n) (0x00100 < (n))/* 0 < n < 4 */ +#define INT_EPnNAK (n) (0x00100 << (n))/* 0 < n < 4 */ # define INT_EP1NAK 0x00200# define INT_EP2NAK 0x00400# define INT_EP3NAK 0x00800
drivers/usb/host/ohci-hcd.c +2 -1
@@ -443,7 +443,8 @@ static int ohci_init (struct ohci_hcd *ohci)struct usb_hcd *hcd =ohci_to_hcd (ohci);/* Accept arbitrarily long scatter-gather lists */ - hcd->self.sg_tablesize = ~0 ; +if (!(hcd->driver->flags &HCD_LOCAL_MEM )) + hcd->self.sg_tablesize = ~0 ;if (distrust_firmware) ohci->flags |=OHCI_QUIRK_HUB_POWER ;
drivers/usb/host/xhci-mem.c +2 -0
@@ -962,6 +962,8 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)if (dev->out_ctx)xhci_free_container_ctx (xhci, dev->out_ctx); +if (dev->udev && dev->udev->slot_id) + dev->udev->slot_id =0 ;kfree (xhci->devs[slot_id]); xhci->devs[slot_id] =NULL ; }
drivers/usb/musb/musb_core.c +2 -0
@@ -1700,6 +1700,7 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)unsigned long val;int vbus; +pm_runtime_get_sync (dev);spin_lock_irqsave (&musb->lock, flags); val = musb->a_wait_bcon;/* FIXME get_vbus_status() is normally #defined as false...
@@ -1707,6 +1708,7 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)*/ vbus =musb_platform_get_vbus_status (musb);spin_unlock_irqrestore (&musb->lock, flags); +pm_runtime_put_sync (dev);return sprintf (buf,"Vbus %s, timeout %lu msec\n" , vbus ?"on" :"off" , val);
drivers/video/fbdev/sbuslib.c +2 -2
@@ -121,7 +121,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,unsigned char __user *ured;unsigned char __user *ugreen;unsigned char __user *ublue; -int index, count, i; +unsigned int index, count, i; if (get_user(index, &c->index) || __get_user(count, &c->count) ||
@@ -160,7 +160,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,unsigned char __user *ugreen;unsigned char __user *ublue;struct fb_cmap *cmap = &info->cmap; -int index, count, i; +unsigned int index, count, i;u8 red, green, blue; if (get_user(index, &c->index) ||
drivers/watchdog/f71808e_wdt.c +2 -1
@@ -520,7 +520,8 @@ static ssize_t watchdog_write(struct file *file, const char __user *buf,char c;if (get_user (c, buf + i))return -EFAULT ; - expect_close = (c =='V' ); +if (c =='V' ) + expect_close = true; }/* Properly order writes across fork()ed processes */
drivers/watchdog/sp5100_tco.h +1 -1
@@ -54,7 +54,7 @@#define SB800_PM_WATCHDOG_CONFIG 0x4C#define SB800_PCI_WATCHDOG_DECODE_EN (1 << 0) -#define SB800_PM_WATCHDOG_DISABLE (1 << 2) +#define SB800_PM_WATCHDOG_DISABLE (1 << 1)#define SB800_PM_WATCHDOG_SECOND_RES (3 << 0)#define SB800_ACPI_MMIO_DECODE_EN (1 << 0)#define SB800_ACPI_MMIO_SEL (1 << 1)
drivers/xen/events/events_base.c +2 -2
@@ -763,8 +763,8 @@ out:mutex_unlock (&irq_mapping_update_lock);return irq; error_irq: -for (; i >=0 ; i--) -__unbind_from_irq (irq + i); +while (nvec--) +__unbind_from_irq (irq + nvec);mutex_unlock (&irq_mapping_update_lock);return ret; }
drivers/xen/grant-table.c +2 -2
@@ -322,7 +322,7 @@ static void gnttab_handle_deferred(unsigned long unused)if (entry->page) {pr_debug ("freeing g.e. %#x (pfn %#lx)\n" , entry->ref,page_to_pfn (entry->page)); -__free_page (entry->page); +put_page (entry->page); }else pr_info ("freeing g.e. %#x\n" , entry->ref);kfree (entry);
@@ -378,7 +378,7 @@ void gnttab_end_foreign_access(grant_ref_t ref, int readonly,if (gnttab_end_foreign_access_ref (ref, readonly)) {put_free_entry (ref);if (page !=0 ) -free_page (page); +put_page (virt_to_page (page)); }else gnttab_add_deferred (ref, readonly, page ?virt_to_page (page) :NULL );
drivers/xen/swiotlb-xen.c +1 -1
@@ -366,7 +366,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,* physical address */ phys =xen_bus_to_phys (dev_addr); -if (((dev_addr + size -1 > dma_mask)) || +if (((dev_addr + size -1 <= dma_mask)) ||range_straddles_page_boundary (phys, size))xen_destroy_contiguous_region (phys, order);
drivers/xen/xen-acpi-processor.c +3 -3
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl, void *context, void **rv) }/* There are more ACPI Processor objects than in x2APIC or MADT. * This can happen with incorrect ACPI SSDT declerations. */ -if (acpi_id > nr_acpi_bits) { -pr_debug ("We only have %u, trying to set %u\n" , - nr_acpi_bits, acpi_id); +if (acpi_id >= nr_acpi_bits) { +pr_debug ("max acpi id %u, trying to set %u\n" , + nr_acpi_bits -1 , acpi_id);return AE_OK ; }/* OK, There is a ACPI Processor object */
drivers/xen/xenbus/xenbus_probe.c +4 -1
@@ -470,8 +470,11 @@ int xenbus_probe_node(struct xen_bus_type *bus,/* Register with generic device framework. */ err =device_register (&xendev->dev); -if (err) +if (err) { +put_device (&xendev->dev); + xendev =NULL ; goto fail; + }return 0 ; fail:
drivers/zorro/zorro.c +12 -0
@@ -16,6 +16,7 @@#include <linux/bitops.h> #include <linux/string.h> #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <asm/byteorder.h>
@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) z->dev.parent = &bus->dev; z->dev.bus = &zorro_bus_type; z->dev.id = i; +switch (z->rom.er_Type &ERT_TYPEMASK ) { +case ERT_ZORROIII : + z->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); +break ; + +case ERT_ZORROII : +default : + z->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); +break ; + } + z->dev.dma_mask = &z->dev.coherent_dma_mask; }/* ... then register them */
fs/affs/namei.c +7 -3
@@ -224,9 +224,10 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)affs_lock_dir (dir); bh =affs_find_entry (dir, dentry); -affs_unlock_dir (dir); -if (IS_ERR (bh)) +if (IS_ERR (bh)) { +affs_unlock_dir (dir);return ERR_CAST (bh); + }if (bh) {u32 ino = bh->b_blocknr;
@@ -240,10 +241,13 @@ affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) }affs_brelse (bh); inode =affs_iget (sb, ino); -if (IS_ERR (inode)) +if (IS_ERR (inode)) { +affs_unlock_dir (dir);return ERR_CAST (inode); + } }d_add (dentry, inode); +affs_unlock_dir (dir);return NULL ; }
fs/aio.c +2 -2
@@ -1006,8 +1006,8 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) ctx =rcu_dereference (table->table[id]);if (ctx && ctx->user_id == ctx_id) { -percpu_ref_get (&ctx->users); - ret = ctx; +if (percpu_ref_tryget_live (&ctx->users)) + ret = ctx; } out:rcu_read_unlock ();
fs/btrfs/ctree.c +9 -3
@@ -2758,6 +2758,8 @@ again:* contention with the cow code */ if (cow) { +bool last_level = (level == (BTRFS_MAX_LEVEL -1 )); +/* * if we don't really need to cow this block * then we don't want to set the path blocking,
@@ -2782,9 +2784,13 @@ again: }btrfs_set_path_blocking (p); - err =btrfs_cow_block (trans, root, b, - p->nodes[level +1 ], - p->slots[level +1 ], &b); +if (last_level) + err =btrfs_cow_block (trans, root, b,NULL ,0 , + &b); +else + err =btrfs_cow_block (trans, root, b, + p->nodes[level +1 ], + p->slots[level +1 ], &b);if (err) { ret = err; goto done;
fs/btrfs/disk-io.c +1 -1
@@ -1194,7 +1194,7 @@ static struct btrfs_subvolume_writers *btrfs_alloc_subvolume_writers(void)if (!writers)return ERR_PTR (-ENOMEM ); - ret =percpu_counter_init (&writers->counter,0 ,GFP_KERNEL ); + ret =percpu_counter_init (&writers->counter,0 ,GFP_NOFS );if (ret <0 ) {kfree (writers);return ERR_PTR (ret);
fs/btrfs/extent-tree.c +1 -0
@@ -3946,6 +3946,7 @@ again:if (wait_for_alloc) {mutex_unlock (&fs_info->chunk_mutex); wait_for_alloc =0 ; +cond_resched (); goto again; }
fs/btrfs/inode.c +4 -12
@@ -5996,8 +5996,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, goto out_unlock_inode; }else {btrfs_update_inode (trans, root, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); } out_unlock:
@@ -6073,8 +6072,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, goto out_unlock_inode;BTRFS_I (inode)->io_tree.ops = &btrfs_extent_io_ops; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
@@ -6217,12 +6215,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)if (err) goto out_fail_inode; -d_instantiate (dentry, inode); -/* -* mkdir is special. We're unlocking after we call d_instantiate -* to avoid a race with nfsd calling d_instantiate. -*/ -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); drop_on_err =0 ; out_fail:
@@ -9251,8 +9244,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, goto out_unlock_inode; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out_unlock:btrfs_end_transaction (trans, root);
fs/btrfs/send.c +3 -0
@@ -4485,6 +4485,9 @@ static int send_hole(struct send_ctx *sctx, u64 end)u64 len;int ret =0 ; +if (sctx->flags &BTRFS_SEND_FLAG_NO_FILE_DATA ) +return send_update_extent (sctx, offset, end - offset); + p =fs_path_alloc ();if (!p)return -ENOMEM ;
fs/btrfs/tests/qgroup-tests.c +1 -1
@@ -69,7 +69,7 @@ static int insert_normal_tree_ref(struct btrfs_root *root, u64 bytenr,btrfs_set_extent_generation (leaf, item,1 );btrfs_set_extent_flags (leaf, item,BTRFS_EXTENT_FLAG_TREE_BLOCK ); block_info = (struct btrfs_tree_block_info *)(item +1 ); -btrfs_set_tree_block_level (leaf, block_info,1 ); +btrfs_set_tree_block_level (leaf, block_info,0 ); iref = (struct btrfs_extent_inline_ref *)(block_info +1 );if (parent >0 ) { btrfs_set_extent_inline_ref_type(leaf, iref,
fs/btrfs/tree-log.c +9 -3
@@ -1983,8 +1983,10 @@ again: nritems =btrfs_header_nritems (path->nodes[0 ]);if (path->slots[0 ] >= nritems) { ret =btrfs_next_leaf (root, path); -if (ret) +if (ret ==1 )break ; +else if (ret <0 ) + goto out; }btrfs_item_key_to_cpu (path->nodes[0 ], &found_key, path->slots[0 ]);
@@ -3083,8 +3085,11 @@ static noinline int log_dir_items(struct btrfs_trans_handle *trans,* from this directory and from this transaction */ ret =btrfs_next_leaf (root, path); -if (ret ==1 ) { - last_offset = (u64)-1 ; +if (ret) { +if (ret ==1 ) + last_offset = (u64)-1 ; +else + err = ret; goto done; }btrfs_item_key_to_cpu (path->nodes[0 ], &tmp, path->slots[0 ]);
@@ -3534,6 +3539,7 @@ fill_holes:ASSERT (ret ==0 ); src = src_path->nodes[0 ]; i =0 ; + need_find_last_extent = true; }btrfs_item_key_to_cpu (src, &key, i);
fs/cifs/cifssmb.c +1 -3
@@ -6413,9 +6413,7 @@ SetEARetry: pSMB->InformationLevel =cpu_to_le16 (SMB_SET_FILE_EA ); - parm_data = - (struct fealist *) (((char *) &pSMB->hdr.Protocol) + - offset); + parm_data = (void *)pSMB + offsetof(struct smb_hdr , Protocol) + offset; pSMB->ParameterOffset =cpu_to_le16 (param_offset); pSMB->DataOffset =cpu_to_le16 (offset); pSMB->SetupCount =1 ;
fs/dcache.c +22 -0
@@ -1868,6 +1868,28 @@ static struct dentry * __d_find_any_alias(struct inode *inode)return alias; } +/* +* This should be equivalent to d_instantiate() + unlock_new_inode(), +* with lockdep-related part of unlock_new_inode() done before +* anything else. Use that instead of open-coding d_instantiate()/ +* unlock_new_inode() combinations. +*/ +void d_instantiate_new (struct dentry *entry,struct inode *inode) +{ +BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +BUG_ON (!inode); +lockdep_annotate_inode_mutex_key (inode); +security_d_instantiate (entry, inode); +spin_lock (&inode->i_lock); +__d_instantiate (entry, inode); +WARN_ON (!(inode->i_state &I_NEW )); + inode->i_state &= ~I_NEW ; +smp_mb (); +wake_up_bit (&inode->i_state, __I_NEW); +spin_unlock (&inode->i_lock); +} +EXPORT_SYMBOL (d_instantiate_new); +/** * d_find_any_alias - find any alias for a given inode * @inode: inode to find an alias for
fs/ecryptfs/inode.c +1 -2
@@ -289,8 +289,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,iput (ecryptfs_inode); goto out; } -unlock_new_inode (ecryptfs_inode); -d_instantiate (ecryptfs_dentry, ecryptfs_inode); +d_instantiate_new (ecryptfs_dentry, ecryptfs_inode); out:return rc; }
fs/ext2/namei.c +2 -4
@@ -41,8 +41,7 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) {int err =ext2_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -265,8 +264,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)if (err) goto out_fail; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out:return err;
fs/ext4/namei.c +2 -4
@@ -2205,8 +2205,7 @@ static int ext4_add_nondir(handle_t *handle,int err =ext4_add_entry (handle, dentry, inode);if (!err) {ext4_mark_inode_dirty (handle, inode); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }drop_nlink (inode);
@@ -2440,8 +2439,7 @@ out_clear_inode: err =ext4_mark_inode_dirty (handle, dir);if (err) goto out_clear_inode; -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (IS_DIRSYNC (dir))ext4_handle_sync (handle);
fs/f2fs/namei.c +4 -8
@@ -129,8 +129,7 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,alloc_nid_done (sbi, ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ; out:handle_failed_inode (inode);
@@ -259,8 +258,7 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry, err =page_symlink (inode, symname, symlen);alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return err; out:handle_failed_inode (inode);
@@ -293,8 +291,7 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ;
@@ -338,8 +335,7 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,f2fs_unlock_op (sbi);alloc_nid_done (sbi, inode->i_ino); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ; out:handle_failed_inode (inode);
fs/jffs2/dir.c +4 -8
@@ -207,8 +207,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, __func__, inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->pino_nlink, inode->i_mapping->nrpages); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -427,8 +426,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const charmutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -572,8 +570,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t modemutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
@@ -747,8 +744,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t modemutex_unlock (&dir_f->sem);jffs2_complete_reservation (c); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; fail:
fs/jffs2/fs.c +0 -1
@@ -363,7 +363,6 @@ error_io: ret = -EIO ; error:mutex_unlock (&f->sem); -jffs2_do_clear_inode (c, f);iget_failed (inode);return ERR_PTR (ret); }
fs/jfs/namei.c +4 -8
@@ -176,8 +176,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -309,8 +308,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1043,8 +1041,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out2:
@@ -1424,8 +1421,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,unlock_new_inode (ip);iput (ip); }else { -unlock_new_inode (ip); -d_instantiate (dentry, ip); +d_instantiate_new (dentry, ip); } out1:
fs/nfs/nfs4sysctl.c +1 -1
@@ -31,7 +31,7 @@ static struct ctl_table nfs4_cb_sysctls[] = { .data = &nfs_idmap_cache_timeout, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec_jiffies, + .proc_handler = proc_dointvec, }, { } };
fs/nilfs2/namei.c +2 -4
@@ -50,8 +50,7 @@ static inline int nilfs_add_nondir(struct dentry *dentry, struct inode *inode) {int err =nilfs_add_link (dentry, inode);if (!err) { -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -249,8 +248,7 @@ static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) goto out_fail;nilfs_mark_inode_dirty (inode); -d_instantiate (dentry, inode); -unlock_new_inode (inode); +d_instantiate_new (dentry, inode); out:if (!err) err =nilfs_transaction_commit (dir->i_sb);
fs/ocfs2/acl.c +6 -0
@@ -300,7 +300,9 @@ struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)if (ret <0 )return ERR_PTR (ret); +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode, type, di_bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);brelse (di_bh);
@@ -319,7 +321,9 @@ int ocfs2_acl_chmod(struct inode *inode, struct buffer_head *bh)if (!(osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ))return 0 ; +down_read (&OCFS2_I (inode)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (inode,ACL_TYPE_ACCESS , bh); +up_read (&OCFS2_I (inode)->ip_xattr_sem);if (IS_ERR (acl) || !acl)return PTR_ERR (acl); ret =__posix_acl_chmod (&acl,GFP_KERNEL , inode->i_mode);
@@ -350,8 +354,10 @@ int ocfs2_init_acl(handle_t *handle,if (!S_ISLNK (inode->i_mode)) {if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl =ocfs2_get_acl_nolock (dir,ACL_TYPE_DEFAULT , dir_bh); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (IS_ERR (acl))return PTR_ERR (acl); }
fs/ocfs2/super.c +2 -3
@@ -467,9 +467,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog_errno (status); -/* FIXME: Should ERROR_RO_FS */ mlog (ML_ERROR ,"Unable to load system inode %d, " "possibly corrupt fs?" , i); goto bail;
@@ -498,7 +497,7 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) new =ocfs2_get_system_file_inode (osb, i, osb->slot_num);if (!new) {ocfs2_release_system_inodes (osb); - status = -EINVAL ; + status =ocfs2_is_soft_readonly (osb) ? -EROFS : -EINVAL ;mlog (ML_ERROR ,"status=%d, sysfile=%d, slot=%d\n" , status, i, osb->slot_num); goto bail;
fs/ocfs2/xattr.c +2 -0
@@ -645,9 +645,11 @@ int ocfs2_calc_xattr_init(struct inode *dir, si->value_len);if (osb->s_mount_opt &OCFS2_MOUNT_POSIX_ACL ) { +down_read (&OCFS2_I (dir)->ip_xattr_sem); acl_len =ocfs2_xattr_get_nolock (dir, dir_bh,OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ,"" ,NULL ,0 ); +up_read (&OCFS2_I (dir)->ip_xattr_sem);if (acl_len >0 ) { a_size =ocfs2_xattr_entry_real_size (0 , acl_len);if (S_ISDIR (mode))
fs/proc/base.c +28 -1
@@ -94,6 +94,8 @@#include "internal.h" #include "fd.h" +#include "../../lib/kstrtox.h" +/* NOTE: * Implementing inode permission operations in /proc is almost * certainly an error. Permission checks need to happen during
@@ -1642,8 +1644,33 @@ end_instantiate:static int dname_to_vma_addr (struct dentry *dentry,unsigned long *start,unsigned long *end) { -if (sscanf (dentry->d_name.name,"%lx-%lx" , start, end) !=2 ) +const char *str = dentry->d_name.name; +unsigned long long sval, eval; +unsigned int len; + + len =_parse_integer (str,16 , &sval); +if (len &KSTRTOX_OVERFLOW ) +return -EINVAL ; +if (sval != (unsigned long )sval)return -EINVAL ; + str += len; + +if (*str !='-' ) +return -EINVAL ; + str++; + + len =_parse_integer (str,16 , &eval); +if (len &KSTRTOX_OVERFLOW ) +return -EINVAL ; +if (eval != (unsigned long )eval) +return -EINVAL ; + str += len; + +if (*str !='\0' ) +return -EINVAL ; + + *start = sval; + *end = eval;return 0 ; }
fs/proc/proc_sysctl.c +3 -0
@@ -617,7 +617,10 @@ static bool proc_sys_link_fill_cache(struct file *file, struct ctl_table *table) {bool ret = true; + head =sysctl_head_grab (head); +if (IS_ERR (head)) +return false;if (S_ISLNK (table->mode)) {/* It is not an error if we can not follow the link ignore it */
fs/reiserfs/namei.c +4 -8
@@ -682,8 +682,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t modreiserfs_update_inode_transaction (inode);reiserfs_update_inode_transaction (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -763,8 +762,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:
@@ -857,8 +855,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode/* the above add_entry did not update dir's stat data */ reiserfs_update_sd (&th, dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (dir->i_sb);
@@ -1162,8 +1159,7 @@ static int reiserfs_symlink(struct inode *parent_dir, goto out_failed; } -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); retval =journal_end (&th); out_failed:reiserfs_write_unlock (parent_dir->i_sb);
fs/udf/namei.c +2 -4
@@ -574,8 +574,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode)if (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }
@@ -684,8 +683,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)udf_write_fi (dir, &cfi, fi, &fibh,NULL ,NULL );inc_nlink (dir);mark_inode_dirty (dir); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);if (fibh.sbh != fibh.ebh)brelse (fibh.ebh);brelse (fibh.sbh);
fs/udf/super.c +3 -2
@@ -2067,8 +2067,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)struct udf_sb_info *sbi; uopt.flags = (1 <<UDF_FLAG_USE_AD_IN_ICB ) | (1 <<UDF_FLAG_STRICT ); - uopt.uid =INVALID_UID ; - uopt.gid =INVALID_GID ; +/* By default we'll use overflow[ug]id when UDF inode [ug]id == -1 */ + uopt.uid =make_kuid (current_user_ns (), overflowuid); + uopt.gid =make_kgid (current_user_ns (), overflowgid); uopt.umask =0 ; uopt.fmode =UDF_INVALID_MODE ; uopt.dmode =UDF_INVALID_MODE ;
fs/ufs/namei.c +2 -4
@@ -38,8 +38,7 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) {int err =ufs_add_link (dentry, inode);if (!err) { -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);return 0 ; }inode_dec_link_count (inode);
@@ -212,8 +211,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) goto out_fail;unlock_ufs (dir->i_sb); -unlock_new_inode (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode); out:return err;
fs/xfs/xfs_discard.c +7 -7
@@ -51,19 +51,19 @@ xfs_trim_extents( pag =xfs_perag_get (mp, agno); - error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp); -if (error || !agbp) - goto out_put_perag; - - cur =xfs_allocbt_init_cursor (mp,NULL , agbp, agno,XFS_BTNUM_CNT ); -/* * Force out the log. This means any transactions that might have freed -* space before we took the AGF buffer lock are now on disk, and the +* space before we take the AGF buffer lock are now on disk, and the * volatile disk cache is flushed. */ xfs_log_force (mp,XFS_LOG_SYNC ); + error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp); +if (error || !agbp) + goto out_put_perag; + + cur =xfs_allocbt_init_cursor (mp,NULL , agbp, agno,XFS_BTNUM_CNT ); +/* * Look up the longest btree in the AGF and start with it. */
include/asm-generic/pgtable.h +15 -0
@@ -181,6 +181,21 @@ extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,extern pgtable_t pgtable_trans_huge_withdraw (struct mm_struct *mm,pmd_t *pmdp);#endif +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +/* +* This is an implementation of pmdp_establish() that is only suitable for an +* architecture that doesn't have hardware dirty/accessed bits. In this case we +* can't race with CPU which sets these bits and non-atomic aproach is fine. +*/ +static inline pmd_t generic_pmdp_establish (struct vm_area_struct *vma, +unsigned long address,pmd_t *pmdp,pmd_t pmd) +{ +pmd_t old_pmd = *pmdp; +set_pmd_at (vma->vm_mm, address, pmdp, pmd); +return old_pmd; +} +#endif +#ifndef __HAVE_ARCH_PMDP_INVALIDATEextern void pmdp_invalidate (struct vm_area_struct *vma,unsigned long address,pmd_t *pmdp);
include/linux/dcache.h +1 -0
@@ -231,6 +231,7 @@ extern seqlock_t rename_lock;* These are the low-level FS interfaces to the dcache.. */ extern void d_instantiate (struct dentry *,struct inode *); +extern void d_instantiate_new (struct dentry *,struct inode *);extern struct dentry *d_instantiate_unique (struct dentry *,struct inode *);extern struct dentry *d_materialise_unique (struct dentry *,struct inode *);extern int d_instantiate_no_diralias (struct dentry *,struct inode *);
include/linux/suspend.h +2 -0
@@ -325,6 +325,8 @@ extern int swsusp_page_is_forbidden(struct page *);extern void swsusp_set_page_free (struct page *);extern void swsusp_unset_page_free (struct page *);extern unsigned long get_safe_page (gfp_t gfp_mask); +extern asmlinkage int swsusp_arch_suspend(void); +extern asmlinkage int swsusp_arch_resume(void);extern void hibernation_set_ops (const struct platform_hibernation_ops *ops);extern int hibernate (void );
include/linux/usb/composite.h +3 -0
@@ -53,6 +53,9 @@/* big enough to hold our biggest descriptor */ #define USB_COMP_EP0_BUFSIZ 1024 +/* OS feature descriptor length <= 4kB */ +#define USB_COMP_EP0_OS_DESC_BUFSIZ 4096 +#define USB_MS_TO_HS_INTERVAL (x) (ilog2((x * 1000 / 125)) + 1)struct usb_configuration ;
include/net/llc_conn.h +1 -1
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk);/* Access to a connection */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb); -void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb); +int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_rtn_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_resend_i_pdu_as_cmd (struct sock *sk,u8 nr,u8 first_p_bit);void llc_conn_resend_i_pdu_as_rsp (struct sock *sk,u8 nr,u8 first_f_bit);
include/net/mac80211.h +1 -1
@@ -3368,7 +3368,7 @@ static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,* The TX headroom reserved by mac80211 for its own tx_status functions. * This is enough for the radiotap header. */ -#define IEEE80211_TX_STATUS_HEADROOM 14 +#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4)/** * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
include/net/regulatory.h +1 -1
@@ -78,7 +78,7 @@ struct regulatory_request {int wiphy_idx;enum nl80211_reg_initiator initiator;enum nl80211_user_reg_hint_type user_reg_hint_type; -char alpha2[2 ]; +char alpha2[3 ];enum nl80211_dfs_regions dfs_region;bool intersect;bool processed;
include/trace/events/timer.h +16 -4
@@ -121,6 +121,20 @@ DEFINE_EVENT(timer_class, timer_cancel,TP_ARGS (timer) ); +#define decode_clockid (type) \ + __print_symbolic(type, \ + { CLOCK_REALTIME, "CLOCK_REALTIME" }, \ + { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, \ + { CLOCK_BOOTTIME, "CLOCK_BOOTTIME" }, \ + { CLOCK_TAI, "CLOCK_TAI" }) + +#define decode_hrtimer_mode (mode) \ + __print_symbolic(mode, \ + { HRTIMER_MODE_ABS, "ABS" }, \ + { HRTIMER_MODE_REL, "REL" }, \ + { HRTIMER_MODE_ABS_PINNED, "ABS|PINNED" }, \ + { HRTIMER_MODE_REL_PINNED, "REL|PINNED" }) +/** * hrtimer_init - called when the hrtimer is initialized * @hrtimer: pointer to struct hrtimer
@@ -147,10 +161,8 @@ TRACE_EVENT(hrtimer_init, ),TP_printk ("hrtimer=%p clockid=%s mode=%s" , __entry->hrtimer, - __entry->clockid ==CLOCK_REALTIME ? -"CLOCK_REALTIME" :"CLOCK_MONOTONIC" , - __entry->mode ==HRTIMER_MODE_ABS ? -"HRTIMER_MODE_ABS" :"HRTIMER_MODE_REL" ) +decode_clockid (__entry->clockid), +decode_hrtimer_mode (__entry->mode)) );/**
include/uapi/linux/if_ether.h +1 -0
@@ -29,6 +29,7 @@*/ #define ETH_ALEN 6/* Octets in one ethernet addr */ +#define ETH_TLEN 2/* Octets in ethernet type field */ #define ETH_HLEN 14/* Total octets in header. */ #define ETH_ZLEN 60/* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500/* Max. octets in payload */
kernel/audit.c +2 -0
@@ -738,6 +738,8 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_featurereturn ; ab =audit_log_start (NULL ,GFP_KERNEL ,AUDIT_FEATURE_CHANGE ); +if (!ab) +return ;audit_log_task_info (ab, current); audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", audit_feature_names[which], !!old_feature, !!new_feature,
kernel/debug/kdb/kdb_main.c +21 -6
@@ -1524,6 +1524,7 @@ static int kdb_md(int argc, const char **argv)int symbolic =0 ;int valid =0 ;int phys =0 ; +int raw =0 ;kdbgetintenv ("MDCOUNT" , &mdcount);kdbgetintenv ("RADIX" , &radix);
@@ -1533,9 +1534,10 @@ static int kdb_md(int argc, const char **argv) repeat = mdcount *16 / bytesperword;if (strcmp (argv[0 ],"mdr" ) ==0 ) { -if (argc !=2 ) +if (argc ==2 || (argc ==0 && last_addr !=0 )) + valid = raw =1 ; +else return KDB_ARGCOUNT ; - valid =1 ; }else if (isdigit (argv[0 ][2 ])) { bytesperword = (int )(argv[0 ][2 ] -'0' );if (bytesperword ==0 ) {
@@ -1571,7 +1573,10 @@ static int kdb_md(int argc, const char **argv) radix = last_radix; bytesperword = last_bytesperword; repeat = last_repeat; - mdcount = ((repeat * bytesperword) +15 ) /16 ; +if (raw) + mdcount = repeat; +else + mdcount = ((repeat * bytesperword) +15 ) /16 ; }if (argc) {
@@ -1588,7 +1593,10 @@ static int kdb_md(int argc, const char **argv) diag =kdbgetularg (argv[nextarg], &val);if (!diag) { mdcount = (int ) val; - repeat = mdcount *16 / bytesperword; +if (raw) + repeat = mdcount; +else + repeat = mdcount *16 / bytesperword; } }if (argc >= nextarg+1 ) {
@@ -1598,8 +1606,15 @@ static int kdb_md(int argc, const char **argv) } } -if (strcmp (argv[0 ],"mdr" ) ==0 ) -return kdb_mdr (addr, mdcount); +if (strcmp (argv[0 ],"mdr" ) ==0 ) { +int ret; + last_addr = addr; + ret =kdb_mdr (addr, mdcount); + last_addr += mdcount; + last_repeat = mdcount; + last_bytesperword = bytesperword;// to make REPEAT happy +return ret; + }switch (radix) {case 10 :
kernel/events/core.c +2 -1
@@ -4878,7 +4878,8 @@ static void perf_output_read_group(struct perf_output_handle *handle,if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if (leader != event) +if ((leader != event) && + (leader->state ==PERF_EVENT_STATE_ACTIVE )) leader->pmu->read (leader); values[n++] =perf_event_count (leader);
kernel/power/power.h +0 -3
@@ -85,9 +85,6 @@ extern int in_suspend;extern dev_t swsusp_resume_device;extern sector_t swsusp_resume_block; -extern asmlinkage int swsusp_arch_suspend(void); -extern asmlinkage int swsusp_arch_resume(void); -extern int create_basic_memory_bitmaps (void );extern void free_basic_memory_bitmaps (void );extern int hibernate_preallocate_memory (void );
kernel/relay.c +1 -1
@@ -166,7 +166,7 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan) {struct rchan_buf *buf; -if (chan->n_subbufs >UINT_MAX /sizeof (size_t *)) +if (chan->n_subbufs >KMALLOC_MAX_SIZE /sizeof (size_t *))return NULL ; buf =kzalloc (sizeof (struct rchan_buf ),GFP_KERNEL );
kernel/sched/rt.c +2 -0
@@ -818,6 +818,8 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)struct rq *rq =rq_of_rt_rq (rt_rq);raw_spin_lock (&rq->lock); +update_rq_clock (rq); +if (rt_rq->rt_time) {u64 runtime;
kernel/signal.c +4 -0
@@ -1435,6 +1435,10 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)return ret; } +/* -INT_MIN is undefined. Exclude this case to avoid a UBSAN warning */ +if (pid ==INT_MIN ) +return -ESRCH ; +read_lock (&tasklist_lock);if (pid !=-1 ) { ret = __kill_pgrp_info(sig, info,
mm/ksm.c +28 -0
@@ -1475,8 +1475,22 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) tree_rmap_item =unstable_tree_search_insert (rmap_item, page, &tree_page);if (tree_rmap_item) { +bool split; + kpage =try_to_merge_two_pages (rmap_item, page, tree_rmap_item, tree_page); +/* +* If both pages we tried to merge belong to the same compound +* page, then we actually ended up increasing the reference +* count of the same compound page twice, and split_huge_page +* failed. +* Here we set a flag if that happened, and we use it later to +* try split_huge_page again. Since we call put_page right +* afterwards, the reference count will be correct and +* split_huge_page should succeed. +*/ + split =PageTransCompound (page) + &&compound_head (page) ==compound_head (tree_page);put_page (tree_page);if (kpage) {/*
@@ -1501,6 +1515,20 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)break_cow (tree_rmap_item);break_cow (rmap_item); } + }else if (split) { +/* +* We are here if we tried to merge two pages and +* failed because they both belonged to the same +* compound page. We will split the page now, but no +* merging will take place. +* We do not want to add the cost of a full lock; if +* the page is locked, it is better to skip it and +* perhaps try again later. +*/ +if (!trylock_page (page)) +return ; +split_huge_page (page); +unlock_page (page); } } }
mm/mempolicy.c +30 -6
@@ -1286,6 +1286,7 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, unsigned long maxnode) {unsigned long k; +unsigned long t;unsigned long nlongs;unsigned long endmask;
@@ -1302,13 +1303,19 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,else endmask = (1UL << (maxnode %BITS_PER_LONG )) -1 ; -/* When the user specified more nodes than supported just check -if the non supported part is all zero. */ +/*
Lines of this file are not shown. View the raw message.
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc new file +46 -0
46 lines not on this page · raw message
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc new file +97 -0
97 lines not on this page · raw message
tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc new file +43 -0
43 lines not on this page · raw message
tools/testing/selftests/memfd/config new file +1 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Hello,
Quoted 14 lines · Greg KH
I'm announcing the release of the 3.18.111 kernel.
All users of the 3.18 kernel series must upgrade.
The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.gitlinux-3.18.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=summarythanks,
greg k-h
------------
<snip.>
Quoted 1 line
do d_instantiate/unlock_new_inode combinations safely
Recent my test in 3.18.113 kernel with security smack showed following crash during mkdir on ext4 fs.
Unable to handle kernel paging request at virtual address ffffffffffffff98 pgd = ffffffc012411000 [ffffffffffffff98] *pgd=0000000000000000, *pud=0000000000000000 ------------[ cut here ]------------ Kernel BUG at ffffffc0007d9430 [verbose debug info unavailable] Internal error: Oops - BUG: 96000005 [#1] PREEMPT SMP CPU: 0 MPIDR: 80000000 PID: 1237 Comm: mkdir Not tainted
3.18.113-00083-g1bfc02f-dirty #29-Tizen
task: ffffffc02cbc2340 ti: ffffffc02b7fc000 task.ti: ffffffc02b7fc000 PC is at down_read+0x24/0x54
LR is at down_read+0x24/0x54
[...]
Call trace: [<ffffffc0007d9430>] down_read+0x24/0x54 [<ffffffc00022ff64>] ext4_xattr_get+0x74/0x1f4 [<ffffffc000234838>] ext4_xattr_security_get+0x28/0x38 [<ffffffc0001ab9f0>] generic_getxattr+0x4c/0x60 [<ffffffc0002786a0>] smk_fetch.isra.6+0x8c/0xe0 [<ffffffc000278888>] smack_d_instantiate+0x194/0x324 [<ffffffc000273794>] security_d_instantiate+0x24/0x30 [<ffffffc00019edf4>] d_instantiate_new+0x34/0x94 [<ffffffc0002046b4>] ext4_mkdir+0x284/0x354 [<ffffffc0001959bc>] vfs_mkdir+0xc0/0x150 [<ffffffc00019a108>] SyS_mkdirat+0x88/0xb8 [<ffffffc00019a150>] SyS_mkdir+0x18/0x20 Code: aa0003f3 b00017c0 912e1000 97e38943 (c85f7e60) ---[ end trace b1ad797d63dae9c5 ]---
It is because d_instantiate_new() added from above commit calls security_d_instantiate() before calling __d_instantiate() and dentry->d_inode is not yet set and null. In 3.18.113 kernel, inode->i_op_getxattr() of ext4 is still generic_getxattr() and it only has dentry parameter without inode, so it tries to access dentry->d_inode.
I did not test with selinux, but selinux also calls inode->i_op_getxattr() from selinux_d_instantiate(), so maybe there is also same issue.
Best Regards,
- Seung-Woo Kim
Signature · 3 lines
Seung-Woo Kim Samsung Research --
Greg KH
maintainerQuoted 59 lines · Seung-Woo Kim
Hello,
Quoted 14 lines · Greg KH
I'm announcing the release of the 3.18.111 kernel.
All users of the 3.18 kernel series must upgrade.
The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.gitlinux-3.18.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=summarythanks,
greg k-h
------------
<snip.>
Quoted 1 line
do d_instantiate/unlock_new_inode combinations safely
Recent my test in 3.18.113 kernel with security smack showed following crash during mkdir on ext4 fs.
Unable to handle kernel paging request at virtual address ffffffffffffff98 pgd = ffffffc012411000 [ffffffffffffff98] *pgd=0000000000000000, *pud=0000000000000000 ------------[ cut here ]------------ Kernel BUG at ffffffc0007d9430 [verbose debug info unavailable] Internal error: Oops - BUG: 96000005 [#1] PREEMPT SMP CPU: 0 MPIDR: 80000000 PID: 1237 Comm: mkdir Not tainted3.18.113-00083-g1bfc02f-dirty #29-Tizen
task:ffffffc02cbc2340ti:ffffffc02b7fc000task.ti:ffffffc02b7fc000PC is atdown_read+0x24/0x54
LR is atdown_read+0x24/0x54
[...]Call trace: [<ffffffc0007d9430>] down_read+0x24/0x54 [<ffffffc00022ff64>] ext4_xattr_get+0x74/0x1f4 [<ffffffc000234838>] ext4_xattr_security_get+0x28/0x38 [<ffffffc0001ab9f0>] generic_getxattr+0x4c/0x60 [<ffffffc0002786a0>] smk_fetch.isra.6+0x8c/0xe0 [<ffffffc000278888>] smack_d_instantiate+0x194/0x324 [<ffffffc000273794>] security_d_instantiate+0x24/0x30 [<ffffffc00019edf4>] d_instantiate_new+0x34/0x94 [<ffffffc0002046b4>] ext4_mkdir+0x284/0x354 [<ffffffc0001959bc>] vfs_mkdir+0xc0/0x150 [<ffffffc00019a108>] SyS_mkdirat+0x88/0xb8 [<ffffffc00019a150>] SyS_mkdir+0x18/0x20 Code: aa0003f3 b00017c0 912e1000 97e38943 (c85f7e60) ---[ end trace b1ad797d63dae9c5 ]---It is because
d_instantiate_new()added from above commit callssecurity_d_instantiate()before calling__d_instantiate()anddentry->d_inodeis not yet set and null. In 3.18.113 kernel,inode->i_op_getxattr()of ext4 is stillgeneric_getxattr()and it only has dentry parameter without inode, so it tries to accessdentry->d_inode.
Quoted 3 lines
I did not test with selinux, but selinux also calls
inode->i_op_getxattr()fromselinux_d_instantiate(), so maybe there is also same issue.
So should I revert something or do you have a proposed fix for this?
thanks,
greg k-h
Quoted 60 lines · Greg KH
Quoted 59 lines · Seung-Woo Kim
Hello,
Quoted 14 lines · Greg KH
I'm announcing the release of the 3.18.111 kernel.
All users of the 3.18 kernel series must upgrade.
The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.gitlinux-3.18.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=summarythanks,
greg k-h
------------
<snip.>
Quoted 1 line
do d_instantiate/unlock_new_inode combinations safely
Recent my test in 3.18.113 kernel with security smack showed following crash during mkdir on ext4 fs.
Unable to handle kernel paging request at virtual address ffffffffffffff98 pgd = ffffffc012411000 [ffffffffffffff98] *pgd=0000000000000000, *pud=0000000000000000 ------------[ cut here ]------------ Kernel BUG at ffffffc0007d9430 [verbose debug info unavailable] Internal error: Oops - BUG: 96000005 [#1] PREEMPT SMP CPU: 0 MPIDR: 80000000 PID: 1237 Comm: mkdir Not tainted3.18.113-00083-g1bfc02f-dirty #29-Tizen
task:ffffffc02cbc2340ti:ffffffc02b7fc000task.ti:ffffffc02b7fc000PC is atdown_read+0x24/0x54
LR is atdown_read+0x24/0x54
[...]Call trace: [<ffffffc0007d9430>] down_read+0x24/0x54 [<ffffffc00022ff64>] ext4_xattr_get+0x74/0x1f4 [<ffffffc000234838>] ext4_xattr_security_get+0x28/0x38 [<ffffffc0001ab9f0>] generic_getxattr+0x4c/0x60 [<ffffffc0002786a0>] smk_fetch.isra.6+0x8c/0xe0 [<ffffffc000278888>] smack_d_instantiate+0x194/0x324 [<ffffffc000273794>] security_d_instantiate+0x24/0x30 [<ffffffc00019edf4>] d_instantiate_new+0x34/0x94 [<ffffffc0002046b4>] ext4_mkdir+0x284/0x354 [<ffffffc0001959bc>] vfs_mkdir+0xc0/0x150 [<ffffffc00019a108>] SyS_mkdirat+0x88/0xb8 [<ffffffc00019a150>] SyS_mkdir+0x18/0x20 Code: aa0003f3 b00017c0 912e1000 97e38943 (c85f7e60) ---[ end trace b1ad797d63dae9c5 ]---It is because
d_instantiate_new()added from above commit callssecurity_d_instantiate()before calling__d_instantiate()anddentry->d_inodeis not yet set and null. In 3.18.113 kernel,inode->i_op_getxattr()of ext4 is stillgeneric_getxattr()and it only has dentry parameter without inode, so it tries to accessdentry->d_inode.
Quoted 5 lines
Quoted 3 lines
I did not test with selinux, but selinux also calls
inode->i_op_getxattr()fromselinux_d_instantiate(), so maybe there is also same issue.So should I revert something or do you have a proposed fix for this?
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +0 -0
@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry,
struct inode *inode)
BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));
BUG_ON(!inode);
lockdep_annotate_inode_mutex_key(inode);
+ /* WORKAROUND for calling security_d_instantiate() */
+ entry->d_inode = inode;
security_d_instantiate(entry, inode);
spin_lock(&inode->i_lock);
__d_instantiate(entry, inode);---
But I am not familiar with dentry/inode locking and there is no lock consideration at all.
Thanks,
- Seung-Woo Kim
Quoted 7 lines
thanks,
greg k-h
Signature · 3 lines
Seung-Woo Kim Samsung Research --
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);
Quoted 1 line
__d_instantiate(entry, inode);
Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit b296821a7c42 ("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.
But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Al - comments? This is all because of commit 1e2e547a93a0 ("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases of security_d_instantiate() calling down to getxattr. Which used to not get the inode at all, so those older kernels use d_inode(dentry), which doesn't work in this path since dentry->d_inode hasn't been instantiated yet..
Linus
Quoted 31 lines · Linus Torvalds
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);Quoted 1 line
__d_instantiate(entry, inode);Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit
b296821a7c42("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Quoted 6 lines
Al - comments? This is all because of commit
1e2e547a93a0("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases ofsecurity_d_instantiate()calling down to getxattr. Which used to not get the inode at all, so those older kernels used_inode(dentry), which doesn't work in this path sincedentry->d_inodehasn't been instantiated yet..
You also want b96809173e94 and ce23e6401334 there...
Quoted 32 lines · Al Viro
Quoted 31 lines · Linus Torvalds
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);Quoted 1 line
__d_instantiate(entry, inode);Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit
b296821a7c42("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Quoted 8 lines
Quoted 6 lines
Al - comments? This is all because of commit
1e2e547a93a0("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases ofsecurity_d_instantiate()calling down to getxattr. Which used to not get the inode at all, so those older kernels used_inode(dentry), which doesn't work in this path sincedentry->d_inodehasn't been instantiated yet..You also want
b96809173e94andce23e6401334there...
For above two commits, also b296821a7c42 is required. And after backport, smack still crashed because setxattr. To fix it, 5930122683df and 3767e255b390 are also required.
By the way, does no one have met this kind getxattr crash issue with selinux from 3.18.y?
Signature · 3 lines
Seung-Woo Kim Samsung Research --
PATCH 1/5 xattr_handler: pass dentry and inode as separate arguments of ->get()
In reply to Al ViroFrom: Al Viro <[email protected]>
commit b296821a7c42fa58baa17513b2b7b30ae66f3336 upstream.
... and do not assume they are already attached to each other
--- fs/9p/acl.c | 7 ++++--- fs/9p/xattr_security.c | 5 +++-- fs/9p/xattr_trusted.c | 5 +++-- fs/9p/xattr_user.c | 5 +++-- fs/ext2/xattr_security.c | 6 +++--- fs/ext2/xattr_trusted.c | 6 +++--- fs/ext2/xattr_user.c | 8 ++++---- fs/ext3/xattr_security.c | 6 +++--- fs/ext3/xattr_trusted.c | 6 +++--- fs/ext3/xattr_user.c | 8 ++++---- fs/ext4/xattr_security.c | 6 +++--- fs/ext4/xattr_trusted.c | 6 +++--- fs/ext4/xattr_user.c | 8 ++++---- fs/f2fs/xattr.c | 15 +++++++-------- fs/gfs2/xattr.c | 6 +++--- fs/hfsplus/xattr.c | 7 ++++--- fs/hfsplus/xattr.h | 10 +++++----- fs/hfsplus/xattr_security.c | 7 ++++--- fs/hfsplus/xattr_trusted.c | 7 ++++--- fs/hfsplus/xattr_user.c | 7 ++++--- fs/jffs2/security.c | 7 ++++--- fs/jffs2/xattr_trusted.c | 7 ++++--- fs/jffs2/xattr_user.c | 7 ++++--- fs/nfs/nfs4proc.c | 14 ++++++++------ fs/ocfs2/xattr.c | 23 +++++++++++++---------- fs/posix_acl.c | 10 +++++----- fs/reiserfs/xattr.c | 3 ++- fs/reiserfs/xattr_security.c | 8 ++++---- fs/reiserfs/xattr_trusted.c | 8 ++++---- fs/reiserfs/xattr_user.c | 8 ++++---- fs/squashfs/xattr.c | 22 +++++++++++++--------- fs/xattr.c | 3 ++- fs/xfs/xfs_xattr.c | 4 ++-- include/linux/xattr.h | 4 ++-- 34 files changed, 145 insertions(+), 124 deletions(-)
fs/9p/acl.c +4 -3
@@ -230,8 +230,9 @@ static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,return v9fs_xattr_get (dentry, full_name, buffer, size); } -static int v9fs_xattr_get_acl (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int v9fs_xattr_get_acl (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {struct v9fs_session_info *v9ses;struct posix_acl *acl;
@@ -247,7 +248,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,if ((v9ses->flags &V9FS_ACCESS_MASK ) !=V9FS_ACCESS_CLIENT )return v9fs_remote_get_acl (dentry, name, buffer, size, type); - acl =v9fs_get_cached_acl (dentry->d_inode, type); + acl =v9fs_get_cached_acl (inode, type);if (IS_ERR (acl))return PTR_ERR (acl);if (acl ==NULL )
fs/9p/xattr_security.c +3 -2
@@ -19,8 +19,9 @@#include <linux/slab.h> #include "xattr.h" -static int v9fs_xattr_security_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int v9fs_xattr_security_get (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {int retval;char *full_name;
fs/9p/xattr_trusted.c +3 -2
@@ -19,8 +19,9 @@#include <linux/slab.h> #include "xattr.h" -static int v9fs_xattr_trusted_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int v9fs_xattr_trusted_get (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {int retval;char *full_name;
fs/9p/xattr_user.c +3 -2
@@ -19,8 +19,9 @@#include <linux/slab.h> #include "xattr.h" -static int v9fs_xattr_user_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int v9fs_xattr_user_get (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {int retval;char *full_name;
fs/ext2/xattr_security.c +3 -3
@@ -23,12 +23,12 @@ ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext2_xattr_security_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext2_xattr_security_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext2_xattr_get (dentry->d_inode,EXT2_XATTR_INDEX_SECURITY , name, +return ext2_xattr_get (inode,EXT2_XATTR_INDEX_SECURITY , name, buffer, size); }
fs/ext2/xattr_trusted.c +3 -3
@@ -27,12 +27,12 @@ ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext2_xattr_trusted_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext2_xattr_trusted_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext2_xattr_get (dentry->d_inode,EXT2_XATTR_INDEX_TRUSTED , name, +return ext2_xattr_get (inode,EXT2_XATTR_INDEX_TRUSTED , name, buffer, size); }
fs/ext2/xattr_user.c +4 -4
@@ -29,14 +29,14 @@ ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext2_xattr_user_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext2_xattr_user_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext2_xattr_get (dentry->d_inode,EXT2_XATTR_INDEX_USER , +return ext2_xattr_get (inode,EXT2_XATTR_INDEX_USER , name, buffer, size); }
fs/ext3/xattr_security.c +3 -3
@@ -24,12 +24,12 @@ ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext3_xattr_security_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext3_xattr_security_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext3_xattr_get (dentry->d_inode,EXT3_XATTR_INDEX_SECURITY , +return ext3_xattr_get (inode,EXT3_XATTR_INDEX_SECURITY , name, buffer, size); }
fs/ext3/xattr_trusted.c +3 -3
@@ -27,12 +27,12 @@ ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext3_xattr_trusted_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext3_xattr_trusted_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext3_xattr_get (dentry->d_inode,EXT3_XATTR_INDEX_TRUSTED , +return ext3_xattr_get (inode,EXT3_XATTR_INDEX_TRUSTED , name, buffer, size); }
fs/ext3/xattr_user.c +4 -4
@@ -27,14 +27,14 @@ ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext3_xattr_user_get (struct dentry *dentry,const char *name,void *buffer, -size_t size,int type) +ext3_xattr_user_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext3_xattr_get (dentry->d_inode,EXT3_XATTR_INDEX_USER , +return ext3_xattr_get (inode,EXT3_XATTR_INDEX_USER , name, buffer, size); }
fs/ext4/xattr_security.c +3 -3
@@ -28,12 +28,12 @@ ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext4_xattr_security_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext4_xattr_security_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext4_xattr_get (dentry->d_inode,EXT4_XATTR_INDEX_SECURITY , +return ext4_xattr_get (inode,EXT4_XATTR_INDEX_SECURITY , name, buffer, size); }
fs/ext4/xattr_trusted.c +3 -3
@@ -31,12 +31,12 @@ ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext4_xattr_trusted_get (struct dentry *dentry,const char *name,void *buffer, -size_t size,int type) +ext4_xattr_trusted_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext4_xattr_get (dentry->d_inode,EXT4_XATTR_INDEX_TRUSTED , +return ext4_xattr_get (inode,EXT4_XATTR_INDEX_TRUSTED , name, buffer, size); }
fs/ext4/xattr_user.c +4 -4
@@ -30,14 +30,14 @@ ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, }static int -ext4_xattr_user_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +ext4_xattr_user_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext4_xattr_get (dentry->d_inode,EXT4_XATTR_INDEX_USER , +return ext4_xattr_get (inode,EXT4_XATTR_INDEX_USER , name, buffer, size); }
fs/f2fs/xattr.c +7 -8
@@ -62,10 +62,11 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,return total_len; } -static int f2fs_xattr_generic_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int f2fs_xattr_generic_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) { -struct f2fs_sb_info *sbi =F2FS_SB (dentry->d_sb); +struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb);switch (type) {case F2FS_XATTR_INDEX_USER :
@@ -83,7 +84,7 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, }if (strcmp (name,"" ) ==0 )return -EINVAL ; -return f2fs_getxattr (dentry->d_inode, type, name, buffer, size); +return f2fs_getxattr (inode, type, name, buffer, size); } static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
@@ -127,11 +128,9 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,return size; } -static int f2fs_xattr_advise_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int f2fs_xattr_advise_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) { -struct inode *inode = dentry->d_inode; -if (strcmp (name,"" ) !=0 )return -EINVAL ;
fs/gfs2/xattr.c +3 -3
@@ -583,10 +583,10 @@ out:* * Returns: actual size of data on success, -errno on error */ -static int gfs2_xattr_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int gfs2_xattr_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size,int type) { -struct gfs2_inode *ip =GFS2_I (dentry->d_inode); +struct gfs2_inode *ip =GFS2_I (inode);struct gfs2_ea_location el;int error;
fs/hfsplus/xattr.c +4 -3
@@ -803,8 +803,9 @@ end_removexattr:return err; } -static int hfsplus_osx_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int hfsplus_osx_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (!strcmp (name,"" ))return -EINVAL ;
@@ -822,7 +823,7 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,* creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ -return hfsplus_getxattr (dentry, name, buffer, size); +return hfsplus_getxattr (inode, name, buffer, size); } static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
fs/hfsplus/xattr.h +5 -5
@@ -30,12 +30,12 @@ static inline int hfsplus_setxattr(struct dentry *dentry, const char *name,ssize_t __hfsplus_getxattr (struct inode *inode,const char *name,void *value,size_t size); -static inline ssize_t hfsplus_getxattr (struct dentry *dentry, -const char *name, -void *value, -size_t size) +static inline ssize_t hfsplus_getxattr (struct inode *inode, +const char *name, +void *value, +size_t size) { -return __hfsplus_getxattr (dentry->d_inode, name, value, size); +return __hfsplus_getxattr (inode, name, value, size); }ssize_t hfsplus_listxattr (struct dentry *dentry,char *buffer,size_t size);
fs/hfsplus/xattr_security.c +4 -3
@@ -13,8 +13,9 @@#include "xattr.h" #include "acl.h" -static int hfsplus_security_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int hfsplus_security_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer, +size_t size,int type) {char *xattr_name;int res;
@@ -29,7 +30,7 @@ static int hfsplus_security_getxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_SECURITY_PREFIX );strcpy (xattr_name +XATTR_SECURITY_PREFIX_LEN , name); - res =hfsplus_getxattr (dentry, xattr_name, buffer, size); + res =hfsplus_getxattr (inode, xattr_name, buffer, size);kfree (xattr_name);return res; }
fs/hfsplus/xattr_trusted.c +4 -3
@@ -11,8 +11,9 @@#include "hfsplus_fs.h" #include "xattr.h" -static int hfsplus_trusted_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int hfsplus_trusted_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {char *xattr_name;int res;
@@ -27,7 +28,7 @@ static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_TRUSTED_PREFIX );strcpy (xattr_name +XATTR_TRUSTED_PREFIX_LEN , name); - res =hfsplus_getxattr (dentry, xattr_name, buffer, size); + res =hfsplus_getxattr (inode, xattr_name, buffer, size);kfree (xattr_name);return res; }
fs/hfsplus/xattr_user.c +4 -3
@@ -11,8 +11,9 @@#include "hfsplus_fs.h" #include "xattr.h" -static int hfsplus_user_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int hfsplus_user_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {char *xattr_name;int res;
@@ -27,7 +28,7 @@ static int hfsplus_user_getxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_USER_PREFIX );strcpy (xattr_name +XATTR_USER_PREFIX_LEN , name); - res =hfsplus_getxattr (dentry, xattr_name, buffer, size); + res =hfsplus_getxattr (inode, xattr_name, buffer, size);kfree (xattr_name);return res; }
fs/jffs2/security.c +4 -3
@@ -48,13 +48,14 @@ int jffs2_init_security(struct inode *inode, struct inode *dir, }/* ---- XATTR Handler for "security.*" ----------------- */ -static int jffs2_security_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int jffs2_security_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_getxattr (dentry->d_inode,JFFS2_XPREFIX_SECURITY , +return do_jffs2_getxattr (inode,JFFS2_XPREFIX_SECURITY , name, buffer, size); }
fs/jffs2/xattr_trusted.c +4 -3
@@ -16,12 +16,13 @@#include <linux/mtd/mtd.h> #include "nodelist.h" -static int jffs2_trusted_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int jffs2_trusted_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_getxattr (dentry->d_inode,JFFS2_XPREFIX_TRUSTED , +return do_jffs2_getxattr (inode,JFFS2_XPREFIX_TRUSTED , name, buffer, size); }
fs/jffs2/xattr_user.c +4 -3
@@ -16,12 +16,13 @@#include <linux/mtd/mtd.h> #include "nodelist.h" -static int jffs2_user_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int jffs2_user_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_getxattr (dentry->d_inode,JFFS2_XPREFIX_USER , +return do_jffs2_getxattr (inode,JFFS2_XPREFIX_USER , name, buffer, size); }
fs/nfs/nfs4proc.c +8 -6
@@ -6047,13 +6047,14 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,return nfs4_proc_set_acl (dentry->d_inode, buf, buflen); } -static int nfs4_xattr_get_nfs4_acl (struct dentry *dentry,const char *key, -void *buf,size_t buflen,int type) +static int nfs4_xattr_get_nfs4_acl (struct dentry *unused,struct inode *inode, +const char *key,void *buf,size_t buflen, +int type) {if (strcmp (key,"" ) !=0 )return -EINVAL ; -return nfs4_proc_get_acl (dentry->d_inode, buf, buflen); +return nfs4_proc_get_acl (inode, buf, buflen); } static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
@@ -6086,11 +6087,12 @@ static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key,return -EOPNOTSUPP ; } -static int nfs4_xattr_get_nfs4_label (struct dentry *dentry,const char *key, -void *buf,size_t buflen,int type) +static int nfs4_xattr_get_nfs4_label (struct dentry *unused,struct inode *inode, +const char *key,void *buf,size_t buflen, +int type) {if (security_ismaclabel (key)) -return nfs4_get_security_label (dentry->d_inode, buf, buflen); +return nfs4_get_security_label (inode, buf, buflen);return -EOPNOTSUPP ; }
fs/ocfs2/xattr.c +13 -10
@@ -7252,12 +7252,13 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,return total_len; } -static int ocfs2_xattr_security_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int ocfs2_xattr_security_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ocfs2_xattr_get (dentry->d_inode,OCFS2_XATTR_INDEX_SECURITY , +return ocfs2_xattr_get (inode,OCFS2_XATTR_INDEX_SECURITY , name, buffer, size); }
@@ -7342,12 +7343,13 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,return total_len; } -static int ocfs2_xattr_trusted_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int ocfs2_xattr_trusted_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ocfs2_xattr_get (dentry->d_inode,OCFS2_XATTR_INDEX_TRUSTED , +return ocfs2_xattr_get (inode,OCFS2_XATTR_INDEX_TRUSTED , name, buffer, size); }
@@ -7390,16 +7392,17 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,return total_len; } -static int ocfs2_xattr_user_get (struct dentry *dentry,const char *name, -void *buffer,size_t size,int type) +static int ocfs2_xattr_user_get (struct dentry *unused,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) { -struct ocfs2_super *osb =OCFS2_SB (dentry->d_sb); +struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);if (strcmp (name,"" ) ==0 )return -EINVAL ;if (osb->s_mount_opt &OCFS2_MOUNT_NOUSERXATTR )return -EOPNOTSUPP ; -return ocfs2_xattr_get (dentry->d_inode,OCFS2_XATTR_INDEX_USER , name, +return ocfs2_xattr_get (inode,OCFS2_XATTR_INDEX_USER , name, buffer, size); }
fs/posix_acl.c +5 -5
@@ -795,18 +795,18 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,EXPORT_SYMBOL (posix_acl_to_xattr);static int -posix_acl_xattr_get (struct dentry *dentry,const char *name, -void *value,size_t size,int type) +posix_acl_xattr_get (struct dentry *unused,struct inode *inode, +const char *name,void *value,size_t size,int type) {struct posix_acl *acl;int error; -if (!IS_POSIXACL (dentry->d_inode)) +if (!IS_POSIXACL (inode))return -EOPNOTSUPP ; -if (S_ISLNK (dentry->d_inode->i_mode)) +if (S_ISLNK (inode->i_mode))return -EOPNOTSUPP ; - acl =get_acl (dentry->d_inode, type); + acl =get_acl (inode, type);if (IS_ERR (acl))return PTR_ERR (acl);if (acl ==NULL )
fs/reiserfs/xattr.c +2 -1
@@ -777,7 +777,8 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,if (!handler ||get_inode_sd_version (dentry->d_inode) ==STAT_DATA_V1 )return -EOPNOTSUPP ; -return handler->get (dentry, name, buffer, size, handler->flags); +return handler->get (dentry, dentry->d_inode, name, buffer, size, + handler->flags); }/*
fs/reiserfs/xattr_security.c +4 -4
@@ -9,16 +9,16 @@#include <linux/uaccess.h> static int -security_get (struct dentry *dentry,const char *name,void *buffer,size_t size, -int handler_flags) +security_get (struct dentry *unused,struct inode *inode,const char *name, +void *buffer,size_t size,int handler_flags) {if (strlen (name) <sizeof (XATTR_SECURITY_PREFIX ))return -EINVAL ; -if (IS_PRIVATE (dentry->d_inode)) +if (IS_PRIVATE (inode))return -EPERM ; -return reiserfs_xattr_get (dentry->d_inode, name, buffer, size); +return reiserfs_xattr_get (inode, name, buffer, size); } static int
fs/reiserfs/xattr_trusted.c +4 -4
@@ -8,16 +8,16 @@#include <linux/uaccess.h> static int -trusted_get (struct dentry *dentry,const char *name,void *buffer,size_t size, -int handler_flags) +trusted_get (struct dentry *unused,struct inode *inode,const char *name, +void *buffer,size_t size,int handler_flags) {if (strlen (name) <sizeof (XATTR_TRUSTED_PREFIX ))return -EINVAL ; -if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (dentry->d_inode)) +if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (inode))return -EPERM ; -return reiserfs_xattr_get (dentry->d_inode, name, buffer, size); +return reiserfs_xattr_get (inode, name, buffer, size); } static int
fs/reiserfs/xattr_user.c +4 -4
@@ -7,15 +7,15 @@#include <linux/uaccess.h> static int -user_get (struct dentry *dentry,const char *name,void *buffer,size_t size, -int handler_flags) +user_get (struct dentry *unused,struct inode *inode,const char *name, +void *buffer,size_t size,int handler_flags) {if (strlen (name) <sizeof (XATTR_USER_PREFIX ))return -EINVAL ; -if (!reiserfs_xattrs_user (dentry->d_sb)) +if (!reiserfs_xattrs_user (inode->i_sb))return -EOPNOTSUPP ; -return reiserfs_xattr_get (dentry->d_inode, name, buffer, size); +return reiserfs_xattr_get (inode, name, buffer, size); } static int
fs/squashfs/xattr.c +13 -9
@@ -223,13 +223,15 @@ static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size,return XATTR_USER_PREFIX_LEN ; } -static int squashfs_user_get (struct dentry *d,const char *name,void *buffer, -size_t size,int type) +static int squashfs_user_get (struct dentry *unused, +struct inode *inode, +const char *name, +void *buffer,size_t size,int type) {if (name[0 ] =='\0' )return -EINVAL ; -return squashfs_xattr_get (d->d_inode,SQUASHFS_XATTR_USER , name, +return squashfs_xattr_get (inode,SQUASHFS_XATTR_USER , name, buffer, size); }
@@ -253,13 +255,14 @@ static size_t squashfs_trusted_list(struct dentry *d, char *list,return XATTR_TRUSTED_PREFIX_LEN ; } -static int squashfs_trusted_get (struct dentry *d,const char *name, -void *buffer,size_t size,int type) +static int squashfs_trusted_get (struct dentry *d,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (name[0 ] =='\0' )return -EINVAL ; -return squashfs_xattr_get (d->d_inode,SQUASHFS_XATTR_TRUSTED , name, +return squashfs_xattr_get (inode,SQUASHFS_XATTR_TRUSTED , name, buffer, size); }
@@ -280,13 +283,14 @@ static size_t squashfs_security_list(struct dentry *d, char *list,return XATTR_SECURITY_PREFIX_LEN ; } -static int squashfs_security_get (struct dentry *d,const char *name, -void *buffer,size_t size,int type) +static int squashfs_security_get (struct dentry *d,struct inode *inode, +const char *name,void *buffer,size_t size, +int type) {if (name[0 ] =='\0' )return -EINVAL ; -return squashfs_xattr_get (d->d_inode,SQUASHFS_XATTR_SECURITY , name, +return squashfs_xattr_get (inode,SQUASHFS_XATTR_SECURITY , name, buffer, size); }
fs/xattr.c +2 -1
@@ -724,7 +724,8 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s handler =xattr_resolve_name (dentry->d_sb->s_xattr, &name);if (!handler)return -EOPNOTSUPP ; -return handler->get (dentry, name, buffer, size, handler->flags); +return handler->get (dentry, dentry->d_inode, name, buffer, size, + handler->flags); }/*
fs/xfs/xfs_xattr.c +2 -2
@@ -34,10 +34,10 @@static int -xfs_xattr_get (struct dentry *dentry,const char *name, +xfs_xattr_get (struct dentry *unused,struct inode *inode,const char *name,void *value,size_t size,int xflags) { -struct xfs_inode *ip =XFS_I (dentry->d_inode); +struct xfs_inode *ip =XFS_I (inode);int error, asize = size;if (strcmp (name,"" ) ==0 )
include/linux/xattr.h +2 -2
@@ -24,8 +24,8 @@ struct xattr_handler {int flags;/* fs private flags passed back to the handlers */ size_t (*list)(struct dentry *dentry,char *list,size_t list_size,const char *name,size_t name_len,int handler_flags); -int (*get)(struct dentry *dentry,const char *name,void *buffer, -size_t size,int handler_flags); +int (*get)(struct dentry *dentry,struct inode *inode,const char *name, +void *buffer,size_t size,int handler_flags);int (*set)(struct dentry *dentry,const char *name,const void *buffer,size_t size,int flags,int handler_flags); };
Signature · 1 line
1.7.4.1
PATCH 3/5 security_d_instantiate(): move to the point prior to attaching dentry to inode
In reply to a message not in the archiveFrom: Al Viro <[email protected]>
commit b96809173e94ea2fa8c19c2e40e8545a1821bf57 upstream.
--- fs/dcache.c | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-)
fs/dcache.c +7 -11
@@ -1729,12 +1729,12 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode)void d_instantiate (struct dentry *entry,struct inode * inode) {BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +security_d_instantiate (entry, inode);if (inode)spin_lock (&inode->i_lock);__d_instantiate (entry, inode);if (inode)spin_unlock (&inode->i_lock); -security_d_instantiate (entry, inode); }EXPORT_SYMBOL (d_instantiate);
@@ -1795,16 +1795,15 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +security_d_instantiate (entry, inode);if (inode)spin_lock (&inode->i_lock); result =__d_instantiate_unique (entry, inode);if (inode)spin_unlock (&inode->i_lock); -if (!result) { -security_d_instantiate (entry, inode); +if (!result)return NULL ; - }BUG_ON (!d_unhashed (result));iput (inode);
@@ -1826,6 +1825,7 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) {BUG_ON (!hlist_unhashed (&entry->d_u.d_alias)); +security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);if (S_ISDIR (inode->i_mode) && !hlist_empty (&inode->i_dentry)) {spin_unlock (&inode->i_lock);
@@ -1834,7 +1834,6 @@ int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) }__d_instantiate (entry, inode);spin_unlock (&inode->i_lock); -security_d_instantiate (entry, inode);return 0 ; }
@@ -1930,6 +1929,7 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected) goto out_iput; } +security_d_instantiate (tmp, inode);spin_lock (&inode->i_lock); res =__d_find_any_alias (inode);if (res) {
@@ -1953,13 +1953,10 @@ static struct dentry *__d_obtain_alias(struct inode *inode, int disconnected)hlist_bl_unlock (&tmp->d_sb->s_anon);spin_unlock (&tmp->d_lock);spin_unlock (&inode->i_lock); -security_d_instantiate (tmp, inode);return tmp; out_iput: -if (res && !IS_ERR (res)) -security_d_instantiate (res, inode);iput (inode);return res; }
@@ -2817,6 +2814,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)return ERR_CAST (inode);if (inode &&S_ISDIR (inode->i_mode)) { +security_d_instantiate (dentry, inode);spin_lock (&inode->i_lock); new =__d_find_any_alias (inode);if (new) {
@@ -2836,13 +2834,11 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry)__d_move (new, dentry, false);write_sequnlock (&rename_lock);spin_unlock (&inode->i_lock); -security_d_instantiate (new, inode);iput (inode); }else {/* already taking inode->i_lock, so d_add() by hand */ __d_instantiate (dentry, inode);spin_unlock (&inode->i_lock); -security_d_instantiate (dentry, inode);d_rehash (dentry); } }else {
@@ -2876,6 +2872,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) goto out_nolock; } +security_d_instantiate (dentry, inode);spin_lock (&inode->i_lock);if (S_ISDIR (inode->i_mode)) {
@@ -2927,7 +2924,6 @@ found:spin_unlock (&inode->i_lock); out_nolock:if (actual == dentry) { -security_d_instantiate (dentry, inode);return NULL ; }
Signature · 1 line
1.7.4.1
PATCH 4/5 switch xattr_handler->set() to passing dentry and inode separately
In reply to a message not in the archiveFrom: Al Viro <[email protected]>
preparation for similar switch in ->setxattr() (see the next commit for rationale).
--- fs/9p/acl.c | 7 +++---- fs/9p/xattr_security.c | 5 +++-- fs/9p/xattr_trusted.c | 5 +++-- fs/9p/xattr_user.c | 5 +++-- fs/ext2/xattr_security.c | 7 ++++--- fs/ext2/xattr_trusted.c | 7 ++++--- fs/ext2/xattr_user.c | 9 +++++---- fs/ext3/xattr_security.c | 7 ++++--- fs/ext3/xattr_trusted.c | 7 ++++--- fs/ext3/xattr_user.c | 9 +++++---- fs/ext4/xattr_security.c | 7 ++++--- fs/ext4/xattr_trusted.c | 7 ++++--- fs/ext4/xattr_user.c | 9 +++++---- fs/f2fs/xattr.c | 17 ++++++++--------- fs/gfs2/xattr.c | 7 ++++--- fs/hfsplus/xattr.c | 7 ++++--- fs/hfsplus/xattr.h | 4 ++-- fs/hfsplus/xattr_security.c | 7 ++++--- fs/hfsplus/xattr_trusted.c | 7 ++++--- fs/hfsplus/xattr_user.c | 7 ++++--- fs/jffs2/security.c | 7 ++++--- fs/jffs2/xattr_trusted.c | 7 ++++--- fs/jffs2/xattr_user.c | 7 ++++--- fs/nfs/nfs4proc.c | 19 +++++++++---------- fs/ocfs2/xattr.c | 23 +++++++++++++---------- fs/posix_acl.c | 6 +++--- fs/reiserfs/xattr.c | 6 ++++-- fs/reiserfs/xattr_security.c | 8 ++++---- fs/reiserfs/xattr_trusted.c | 8 ++++---- fs/reiserfs/xattr_user.c | 8 ++++---- fs/xattr.c | 5 +++-- fs/xfs/xfs_xattr.c | 7 ++++--- include/linux/xattr.h | 5 +++-- 33 files changed, 144 insertions(+), 119 deletions(-)
fs/9p/acl.c +3 -4
@@ -279,14 +279,13 @@ static int v9fs_remote_set_acl(struct dentry *dentry, const char *name, } -static int v9fs_xattr_set_acl (struct dentry *dentry,const char *name, -const void *value,size_t size, -int flags,int type) +static int v9fs_xattr_set_acl (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {int retval;struct posix_acl *acl;struct v9fs_session_info *v9ses; -struct inode *inode = dentry->d_inode;if (strcmp (name,"" ) !=0 )return -EINVAL ;
fs/9p/xattr_security.c +3 -2
@@ -47,8 +47,9 @@ static int v9fs_xattr_security_get(struct dentry *dentry, struct inode *inode,return retval; } -static int v9fs_xattr_security_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int v9fs_xattr_security_set (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {int retval;char *full_name;
fs/9p/xattr_trusted.c +3 -2
@@ -47,8 +47,9 @@ static int v9fs_xattr_trusted_get(struct dentry *dentry, struct inode *inode,return retval; } -static int v9fs_xattr_trusted_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int v9fs_xattr_trusted_set (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {int retval;char *full_name;
fs/9p/xattr_user.c +3 -2
@@ -47,8 +47,9 @@ static int v9fs_xattr_user_get(struct dentry *dentry, struct inode *inode,return retval; } -static int v9fs_xattr_user_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int v9fs_xattr_user_set (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {int retval;char *full_name;
fs/ext2/xattr_security.c +4 -3
@@ -33,12 +33,13 @@ ext2_xattr_security_get(struct dentry *unused, struct inode *inode, }static int -ext2_xattr_security_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext2_xattr_security_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext2_xattr_set (dentry->d_inode,EXT2_XATTR_INDEX_SECURITY , name, +return ext2_xattr_set (inode,EXT2_XATTR_INDEX_SECURITY , name, value, size, flags); }
fs/ext2/xattr_trusted.c +4 -3
@@ -37,12 +37,13 @@ ext2_xattr_trusted_get(struct dentry *unused, struct inode *inode, }static int -ext2_xattr_trusted_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext2_xattr_trusted_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext2_xattr_set (dentry->d_inode,EXT2_XATTR_INDEX_TRUSTED , name, +return ext2_xattr_set (inode,EXT2_XATTR_INDEX_TRUSTED , name, value, size, flags); }
fs/ext2/xattr_user.c +5 -4
@@ -41,15 +41,16 @@ ext2_xattr_user_get(struct dentry *unused, struct inode *inode, }static int -ext2_xattr_user_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext2_xattr_user_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext2_xattr_set (dentry->d_inode,EXT2_XATTR_INDEX_USER , +return ext2_xattr_set (inode,EXT2_XATTR_INDEX_USER , name, value, size, flags); }
fs/ext3/xattr_security.c +4 -3
@@ -34,12 +34,13 @@ ext3_xattr_security_get(struct dentry *unused, struct inode *inode, }static int -ext3_xattr_security_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext3_xattr_security_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext3_xattr_set (dentry->d_inode,EXT3_XATTR_INDEX_SECURITY , +return ext3_xattr_set (inode,EXT3_XATTR_INDEX_SECURITY , name, value, size, flags); }
fs/ext3/xattr_trusted.c +4 -3
@@ -37,12 +37,13 @@ ext3_xattr_trusted_get(struct dentry *unused, struct inode *inode, }static int -ext3_xattr_trusted_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext3_xattr_trusted_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext3_xattr_set (dentry->d_inode,EXT3_XATTR_INDEX_TRUSTED , name, +return ext3_xattr_set (inode,EXT3_XATTR_INDEX_TRUSTED , name, value, size, flags); }
fs/ext3/xattr_user.c +5 -4
@@ -39,14 +39,15 @@ ext3_xattr_user_get(struct dentry *unused, struct inode *inode, }static int -ext3_xattr_user_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext3_xattr_user_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext3_xattr_set (dentry->d_inode,EXT3_XATTR_INDEX_USER , +return ext3_xattr_set (inode,EXT3_XATTR_INDEX_USER , name, value, size, flags); }
fs/ext4/xattr_security.c +4 -3
@@ -38,12 +38,13 @@ ext4_xattr_security_get(struct dentry *unused, struct inode *inode, }static int -ext4_xattr_security_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext4_xattr_security_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext4_xattr_set (dentry->d_inode,EXT4_XATTR_INDEX_SECURITY , +return ext4_xattr_set (inode,EXT4_XATTR_INDEX_SECURITY , name, value, size, flags); }
fs/ext4/xattr_trusted.c +4 -3
@@ -41,12 +41,13 @@ ext4_xattr_trusted_get(struct dentry *unused, struct inode *inode, }static int -ext4_xattr_trusted_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext4_xattr_trusted_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ext4_xattr_set (dentry->d_inode,EXT4_XATTR_INDEX_TRUSTED , +return ext4_xattr_set (inode,EXT4_XATTR_INDEX_TRUSTED , name, value, size, flags); }
fs/ext4/xattr_user.c +5 -4
@@ -42,14 +42,15 @@ ext4_xattr_user_get(struct dentry *unused, struct inode *inode, }static int -ext4_xattr_user_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +ext4_xattr_user_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -if (!test_opt (dentry->d_sb,XATTR_USER )) +if (!test_opt (inode->i_sb,XATTR_USER ))return -EOPNOTSUPP ; -return ext4_xattr_set (dentry->d_inode,EXT4_XATTR_INDEX_USER , +return ext4_xattr_set (inode,EXT4_XATTR_INDEX_USER , name, value, size, flags); }
fs/f2fs/xattr.c +8 -9
@@ -87,10 +87,11 @@ static int f2fs_xattr_generic_get(struct dentry *unused, struct inode *inode,return f2fs_getxattr (inode, type, name, buffer, size); } -static int f2fs_xattr_generic_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int f2fs_xattr_generic_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) { -struct f2fs_sb_info *sbi =F2FS_SB (dentry->d_sb); +struct f2fs_sb_info *sbi =F2FS_SB (inode->i_sb);switch (type) {case F2FS_XATTR_INDEX_USER :
@@ -109,8 +110,7 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,if (strcmp (name,"" ) ==0 )return -EINVAL ; -return f2fs_setxattr (dentry->d_inode, type, name, - value, size,NULL , flags); +return f2fs_setxattr (inode, type, name, value, size,NULL , flags); } static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
@@ -138,11 +138,10 @@ static int f2fs_xattr_advise_get(struct dentry *unused, struct inode *inode,return sizeof (char ); } -static int f2fs_xattr_advise_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int f2fs_xattr_advise_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) { -struct inode *inode = dentry->d_inode; -if (strcmp (name,"" ) !=0 )return -EINVAL ;if (!inode_owner_or_capable (inode))
fs/gfs2/xattr.c +4 -3
@@ -1227,10 +1227,11 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,return error; } -static int gfs2_xattr_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int gfs2_xattr_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) { -return __gfs2_xattr_set (dentry->d_inode, name, value, +return __gfs2_xattr_set (inode, name, value, size, flags, type); }
fs/hfsplus/xattr.c +4 -3
@@ -826,8 +826,9 @@ static int hfsplus_osx_getxattr(struct dentry *unused, struct inode *inode,return hfsplus_getxattr (inode, name, buffer, size); } -static int hfsplus_osx_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int hfsplus_osx_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {if (!strcmp (name,"" ))return -EINVAL ;
@@ -845,7 +846,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,* creates), so we pass the name through unmodified (after * ensuring it doesn't conflict with another namespace). */ -return hfsplus_setxattr (dentry, name, buffer, size, flags); +return hfsplus_setxattr (inode, name, buffer, size, flags); } static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list,
fs/hfsplus/xattr.h +2 -2
@@ -21,10 +21,10 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[];int __hfsplus_setxattr (struct inode *inode,const char *name,const void *value,size_t size,int flags); -static inline int hfsplus_setxattr (struct dentry *dentry,const char *name, +static inline int hfsplus_setxattr (struct inode *inode,const char *name,const void *value,size_t size,int flags) { -return __hfsplus_setxattr (dentry->d_inode, name, value, size, flags); +return __hfsplus_setxattr (inode, name, value, size, flags); } ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
fs/hfsplus/xattr_security.c +4 -3
@@ -35,8 +35,9 @@ static int hfsplus_security_getxattr(struct dentry *unused, struct inode *inode,return res; } -static int hfsplus_security_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int hfsplus_security_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {char *xattr_name;int res;
@@ -51,7 +52,7 @@ static int hfsplus_security_setxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_SECURITY_PREFIX );strcpy (xattr_name +XATTR_SECURITY_PREFIX_LEN , name); - res =hfsplus_setxattr (dentry, xattr_name, buffer, size, flags); + res =hfsplus_setxattr (inode, xattr_name, buffer, size, flags);kfree (xattr_name);return res; }
fs/hfsplus/xattr_trusted.c +4 -3
@@ -33,8 +33,9 @@ static int hfsplus_trusted_getxattr(struct dentry *unused, struct inode *inode,return res; } -static int hfsplus_trusted_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int hfsplus_trusted_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {char *xattr_name;int res;
@@ -49,7 +50,7 @@ static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_TRUSTED_PREFIX );strcpy (xattr_name +XATTR_TRUSTED_PREFIX_LEN , name); - res =hfsplus_setxattr (dentry, xattr_name, buffer, size, flags); + res =hfsplus_setxattr (inode, xattr_name, buffer, size, flags);kfree (xattr_name);return res; }
fs/hfsplus/xattr_user.c +4 -3
@@ -33,8 +33,9 @@ static int hfsplus_user_getxattr(struct dentry *unused, struct inode *inode,return res; } -static int hfsplus_user_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int hfsplus_user_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {char *xattr_name;int res;
@@ -49,7 +50,7 @@ static int hfsplus_user_setxattr(struct dentry *dentry, const char *name,strcpy (xattr_name,XATTR_USER_PREFIX );strcpy (xattr_name +XATTR_USER_PREFIX_LEN , name); - res =hfsplus_setxattr (dentry, xattr_name, buffer, size, flags); + res =hfsplus_setxattr (inode, xattr_name, buffer, size, flags);kfree (xattr_name);return res; }
fs/jffs2/security.c +4 -3
@@ -59,13 +59,14 @@ static int jffs2_security_getxattr(struct dentry *unused, struct inode *inode, name, buffer, size); } -static int jffs2_security_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int jffs2_security_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_setxattr (dentry->d_inode,JFFS2_XPREFIX_SECURITY , +return do_jffs2_setxattr (inode,JFFS2_XPREFIX_SECURITY , name, buffer, size, flags); }
fs/jffs2/xattr_trusted.c +4 -3
@@ -26,12 +26,13 @@ static int jffs2_trusted_getxattr(struct dentry *unused, struct inode *inode, name, buffer, size); } -static int jffs2_trusted_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int jffs2_trusted_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_setxattr (dentry->d_inode,JFFS2_XPREFIX_TRUSTED , +return do_jffs2_setxattr (inode,JFFS2_XPREFIX_TRUSTED , name, buffer, size, flags); }
fs/jffs2/xattr_user.c +4 -3
@@ -26,12 +26,13 @@ static int jffs2_user_getxattr(struct dentry *unused, struct inode *inode, name, buffer, size); } -static int jffs2_user_setxattr (struct dentry *dentry,const char *name, -const void *buffer,size_t size,int flags,int type) +static int jffs2_user_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *buffer, +size_t size,int flags,int type) {if (!strcmp (name,"" ))return -EINVAL ; -return do_jffs2_setxattr (dentry->d_inode,JFFS2_XPREFIX_USER , +return do_jffs2_setxattr (inode,JFFS2_XPREFIX_USER , name, buffer, size, flags); }
fs/nfs/nfs4proc.c +9 -10
@@ -4781,12 +4781,11 @@ static int nfs4_do_set_security_label(struct inode *inode, }static int -nfs4_set_security_label (struct dentry *dentry,const void *buf,size_t buflen) +nfs4_set_security_label (struct inode *inode,const void *buf,size_t buflen) {struct nfs4_label ilabel, *olabel =NULL ;struct nfs_fattr fattr;struct rpc_cred *cred; -struct inode *inode = dentry->d_inode;int status;if (!nfs_server_capable (inode,NFS_CAP_SECURITY_LABEL ))
@@ -6037,14 +6036,14 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" -static int nfs4_xattr_set_nfs4_acl (struct dentry *dentry,const char *key, -const void *buf,size_t buflen, -int flags,int type) +static int nfs4_xattr_set_nfs4_acl (struct dentry *unused,struct inode *inode, +const char *key,const void *buf, +size_t buflen,int flags,int type) {if (strcmp (key,"" ) !=0 )return -EINVAL ; -return nfs4_proc_set_acl (dentry->d_inode, buf, buflen); +return nfs4_proc_set_acl (inode, buf, buflen); } static int nfs4_xattr_get_nfs4_acl(struct dentry *unused, struct inode *inode,
@@ -6077,12 +6076,12 @@ static inline int nfs4_server_supports_labels(struct nfs_server *server)return server->caps &NFS_CAP_SECURITY_LABEL ; } -static int nfs4_xattr_set_nfs4_label (struct dentry *dentry,const char *key, -const void *buf,size_t buflen, -int flags,int type) +static int nfs4_xattr_set_nfs4_label (struct dentry *unused,struct inode *inode, +const char *key,const void *buf, +size_t buflen,int flags,int type) {if (security_ismaclabel (key)) -return nfs4_set_security_label (dentry, buf, buflen); +return nfs4_set_security_label (inode, buf, buflen);return -EOPNOTSUPP ; }
fs/ocfs2/xattr.c +13 -10
@@ -7262,13 +7262,14 @@ static int ocfs2_xattr_security_get(struct dentry *unused, struct inode *inode, name, buffer, size); } -static int ocfs2_xattr_security_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int ocfs2_xattr_security_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ocfs2_xattr_set (dentry->d_inode,OCFS2_XATTR_INDEX_SECURITY , +return ocfs2_xattr_set (inode,OCFS2_XATTR_INDEX_SECURITY , name, value, size, flags); }
@@ -7353,13 +7354,14 @@ static int ocfs2_xattr_trusted_get(struct dentry *unused, struct inode *inode, name, buffer, size); } -static int ocfs2_xattr_trusted_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int ocfs2_xattr_trusted_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) {if (strcmp (name,"" ) ==0 )return -EINVAL ; -return ocfs2_xattr_set (dentry->d_inode,OCFS2_XATTR_INDEX_TRUSTED , +return ocfs2_xattr_set (inode,OCFS2_XATTR_INDEX_TRUSTED , name, value, size, flags); }
@@ -7406,17 +7408,18 @@ static int ocfs2_xattr_user_get(struct dentry *unused, struct inode *inode, buffer, size); } -static int ocfs2_xattr_user_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +static int ocfs2_xattr_user_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int type) { -struct ocfs2_super *osb =OCFS2_SB (dentry->d_sb); +struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);if (strcmp (name,"" ) ==0 )return -EINVAL ;if (osb->s_mount_opt &OCFS2_MOUNT_NOUSERXATTR )return -EOPNOTSUPP ; -return ocfs2_xattr_set (dentry->d_inode,OCFS2_XATTR_INDEX_USER , +return ocfs2_xattr_set (inode,OCFS2_XATTR_INDEX_USER , name, value, size, flags); }
fs/posix_acl.c +3 -3
@@ -841,10 +841,10 @@ set_posix_acl(struct inode *inode, int type, struct posix_acl *acl)EXPORT_SYMBOL (set_posix_acl);static int -posix_acl_xattr_set (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags,int type) +posix_acl_xattr_set (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size, +int flags,int type) { -struct inode *inode = dentry->d_inode;struct posix_acl *acl =NULL ;int ret;
fs/reiserfs/xattr.c +4 -2
@@ -797,7 +797,8 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,if (!handler ||get_inode_sd_version (dentry->d_inode) ==STAT_DATA_V1 )return -EOPNOTSUPP ; -return handler->set (dentry, name, value, size, flags, handler->flags); +return handler->set (dentry, dentry->d_inode, name, value, size, + flags, handler->flags); }/*
@@ -814,7 +815,8 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)if (!handler ||get_inode_sd_version (dentry->d_inode) ==STAT_DATA_V1 )return -EOPNOTSUPP ; -return handler->set (dentry, name,NULL ,0 ,XATTR_REPLACE , handler->flags); +return handler->set (dentry, dentry->d_inode, name,NULL ,0 , +XATTR_REPLACE , handler->flags); }struct listxattr_buf {
fs/reiserfs/xattr_security.c +4 -4
@@ -22,16 +22,16 @@ security_get(struct dentry *unused, struct inode *inode, const char *name, }static int -security_set (struct dentry *dentry,const char *name,const void *buffer, -size_t size,int flags,int handler_flags) +security_set (struct dentry *unused,struct inode *inode,const char *name, +const void *buffer,size_t size,int flags,int handler_flags) {if (strlen (name) <sizeof (XATTR_SECURITY_PREFIX ))return -EINVAL ; -if (IS_PRIVATE (dentry->d_inode)) +if (IS_PRIVATE (inode))return -EPERM ; -return reiserfs_xattr_set (dentry->d_inode, name, buffer, size, flags); +return reiserfs_xattr_set (inode, name, buffer, size, flags); } static size_t security_list(struct dentry *dentry, char *list, size_t list_len,
fs/reiserfs/xattr_trusted.c +4 -4
@@ -21,16 +21,16 @@ trusted_get(struct dentry *unused, struct inode *inode, const char *name, }static int -trusted_set (struct dentry *dentry,const char *name,const void *buffer, -size_t size,int flags,int handler_flags) +trusted_set (struct dentry *unused,struct inode *inode,const char *name, +const void *buffer,size_t size,int flags,int handler_flags) {if (strlen (name) <sizeof (XATTR_TRUSTED_PREFIX ))return -EINVAL ; -if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (dentry->d_inode)) +if (!capable (CAP_SYS_ADMIN ) ||IS_PRIVATE (inode))return -EPERM ; -return reiserfs_xattr_set (dentry->d_inode, name, buffer, size, flags); +return reiserfs_xattr_set (inode, name, buffer, size, flags); } static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size,
fs/reiserfs/xattr_user.c +4 -4
@@ -19,15 +19,15 @@ user_get(struct dentry *unused, struct inode *inode, const char *name, }static int -user_set (struct dentry *dentry,const char *name,const void *buffer, -size_t size,int flags,int handler_flags) +user_set (struct dentry *unused,struct inode *inode,const char *name, +const void *buffer,size_t size,int flags,int handler_flags) {if (strlen (name) <sizeof (XATTR_USER_PREFIX ))return -EINVAL ; -if (!reiserfs_xattrs_user (dentry->d_sb)) +if (!reiserfs_xattrs_user (inode->i_sb))return -EOPNOTSUPP ; -return reiserfs_xattr_set (dentry->d_inode, name, buffer, size, flags); +return reiserfs_xattr_set (inode, name, buffer, size, flags); } static size_t user_list(struct dentry *dentry, char *list, size_t list_size,
fs/xattr.c +3 -2
@@ -773,7 +773,8 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz handler =xattr_resolve_name (dentry->d_sb->s_xattr, &name);if (!handler)return -EOPNOTSUPP ; -return handler->set (dentry, name, value, size, flags, handler->flags); +return handler->set (dentry, dentry->d_inode, name, value, size, + flags, handler->flags); }/*
@@ -788,7 +789,7 @@ generic_removexattr(struct dentry *dentry, const char *name) handler =xattr_resolve_name (dentry->d_sb->s_xattr, &name);if (!handler)return -EOPNOTSUPP ; -return handler->set (dentry, name,NULL ,0 , +return handler->set (dentry, dentry->d_inode, name,NULL ,0 ,XATTR_REPLACE , handler->flags); }
fs/xfs/xfs_xattr.c +4 -3
@@ -56,10 +56,11 @@ xfs_xattr_get(struct dentry *unused, struct inode *inode, const char *name, }static int -xfs_xattr_set (struct dentry *dentry,const char *name,const void *value, -size_t size,int flags,int xflags) +xfs_xattr_set (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags,int xflags) { -struct xfs_inode *ip =XFS_I (dentry->d_inode); +struct xfs_inode *ip =XFS_I (inode);if (strcmp (name,"" ) ==0 )return -EINVAL ;
include/linux/xattr.h +3 -2
@@ -26,8 +26,9 @@ struct xattr_handler { const char *name, size_t name_len, int handler_flags);int (*get)(struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size,int handler_flags); -int (*set)(struct dentry *dentry,const char *name,const void *buffer, -size_t size,int flags,int handler_flags); +int (*set)(struct dentry *dentry,struct inode *inode,const char *name, +const void *buffer,size_t size,int flags, +int handler_flags); };struct xattr {
Signature · 1 line
1.7.4.1
PATCH 2/5 ->getxattr(): pass dentry and inode as separate arguments
In reply to a message not in the archiveFrom: Al Viro <[email protected]>
commit ce23e640133484eebc20ca7b7668388213e11327 upstream.
--- Documentation/filesystems/porting | 6 +++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/llite/xattr.c | 6 +--- fs/bad_inode.c | 4 +- fs/btrfs/xattr.c | 8 +++--- fs/btrfs/xattr.h | 4 +- fs/ceph/super.h | 3 +- fs/ceph/xattr.c | 8 +++--- fs/cifs/cifsfs.h | 2 +- fs/cifs/xattr.c | 10 ++++---- fs/ecryptfs/crypto.c | 5 +++- fs/ecryptfs/ecryptfs_kernel.h | 4 +- fs/ecryptfs/inode.c | 23 ++++++++++--------- fs/ecryptfs/mmap.c | 3 +- fs/fuse/dir.c | 5 +-- fs/gfs2/inode.c | 9 +++---- fs/hfs/attr.c | 5 +-- fs/hfs/hfs_fs.h | 4 +- fs/jfs/jfs_xattr.h | 2 +- fs/jfs/xattr.c | 8 +++--- fs/kernfs/inode.c | 6 ++-- fs/kernfs/kernfs-internal.h | 4 +- fs/overlayfs/inode.c | 4 +- fs/overlayfs/overlayfs.h | 4 +- fs/overlayfs/super.c | 2 +- fs/reiserfs/xattr.c | 8 +++--- fs/reiserfs/xattr.h | 4 +- fs/ubifs/ubifs.h | 4 +- fs/ubifs/xattr.c | 6 ++-- fs/xattr.c | 13 ++++++----- include/linux/fs.h | 3 +- include/linux/xattr.h | 2 +- mm/shmem.c | 8 +++--- net/socket.c | 2 +- security/commoncap.c | 6 ++-- security/integrity/evm/evm_main.c | 2 +- security/selinux/hooks.c | 9 ++++--- security/smack/smack_lsm.c | 4 +- 38 files changed, 112 insertions(+), 102 deletions(-)
Documentation/filesystems/porting +6 -0
@@ -463,3 +463,9 @@ in your dentry operations instead. of the in-tree instances did). inode_hash_lock is still held, of course, so they are still serialized wrt removal from inode hash, as well as wrt set() callback of iget5_locked(). +-- +[mandatory] + ->getxattr() and xattr_handler.get() get dentry and inode passed separately. + dentry might be yet to be attached to inode, so do _not_ use its ->d_inode + in the instances. Rationale: !@#!@# security_d_instantiate() needs to be + called before we attach dentry to inode.
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -1070,8 +1070,8 @@ static inline __u64 ll_file_maxbytes(struct inode *inode)/* llite/xattr.c */ int ll_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); -ssize_t ll_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size); +ssize_t ll_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size);ssize_t ll_listxattr (struct dentry *dentry,char *buffer,size_t size);int ll_removexattr (struct dentry *dentry,const char *name);
drivers/staging/lustre/lustre/llite/xattr.c +2 -4
@@ -455,11 +455,9 @@ out:return rc; } -ssize_t ll_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size) +ssize_t ll_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) { -struct inode *inode = dentry->d_inode; -LASSERT (inode);LASSERT (name);
fs/bad_inode.c +2 -2
@@ -253,8 +253,8 @@ static int bad_inode_setxattr(struct dentry *dentry, const char *name,return -EIO ; } -static ssize_t bad_inode_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size) +static ssize_t bad_inode_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) {return -EIO ; }
fs/btrfs/xattr.c +4 -4
@@ -393,8 +393,8 @@ static int btrfs_is_valid_xattr(const char *name)return 0 ; } -ssize_t btrfs_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size) +ssize_t btrfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) {int ret;
@@ -404,12 +404,12 @@ ssize_t btrfs_getxattr(struct dentry *dentry, const char *name,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_getxattr (dentry, name, buffer, size); +return generic_getxattr (dentry, inode, name, buffer, size); ret =btrfs_is_valid_xattr (name);if (ret)return ret; -return __btrfs_getxattr (dentry->d_inode, name, buffer, size); +return __btrfs_getxattr (inode, name, buffer, size); } int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,
fs/btrfs/xattr.h +2 -2
@@ -28,8 +28,8 @@ extern ssize_t __btrfs_getxattr(struct inode *inode, const char *name,extern int __btrfs_setxattr (struct btrfs_trans_handle *trans,struct inode *inode,const char *name,const void *value,size_t size,int flags); -extern ssize_t btrfs_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size); +extern ssize_t btrfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size);extern int btrfs_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags);extern int btrfs_removexattr (struct dentry *dentry,const char *name);
fs/ceph/super.h +2 -1
@@ -727,7 +727,8 @@ extern int ceph_setxattr(struct dentry *, const char *, const void *,int __ceph_setxattr (struct dentry *,const char *,const void *,size_t ,int );ssize_t __ceph_getxattr (struct inode *,const char *,void *,size_t );int __ceph_removexattr (struct dentry *,const char *); -extern ssize_t ceph_getxattr (struct dentry *,const char *,void *,size_t ); +extern ssize_t ceph_getxattr (struct dentry *,struct inode *,const char *, +void *,size_t );extern ssize_t ceph_listxattr (struct dentry *,char *,size_t );extern int ceph_removexattr (struct dentry *,const char *);extern void __ceph_build_xattrs_blob (struct ceph_inode_info *ci);
fs/ceph/xattr.c +4 -4
@@ -773,13 +773,13 @@ out:return err; } -ssize_t ceph_getxattr (struct dentry *dentry,const char *name,void *value, -size_t size) +ssize_t ceph_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *value,size_t size) {if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_getxattr (dentry, name, value, size); +return generic_getxattr (dentry, inode, name, value, size); -return __ceph_getxattr (dentry->d_inode, name, value, size); +return __ceph_getxattr (inode, name, value, size); }ssize_t ceph_listxattr (struct dentry *dentry,char *names,size_t size)
fs/cifs/cifsfs.h +1 -1
@@ -124,7 +124,7 @@ extern int cifs_symlink(struct inode *inode, struct dentry *direntry,extern int cifs_removexattr (struct dentry *,const char *);extern int cifs_setxattr (struct dentry *,const char *,const void *,size_t ,int ); -extern ssize_t cifs_getxattr (struct dentry *,const char *,void *,size_t ); +extern ssize_t cifs_getxattr (struct dentry *,struct inode *,const char *,void *,size_t );extern ssize_t cifs_listxattr (struct dentry *,char *,size_t );extern long cifs_ioctl (struct file *filep,unsigned int cmd,unsigned long arg);
fs/cifs/xattr.c +5 -5
@@ -232,8 +232,8 @@ set_ea_exit:return rc; } -ssize_t cifs_getxattr (struct dentry *direntry,const char *ea_name, -void *ea_value,size_t buf_size) +ssize_t cifs_getxattr (struct dentry *direntry,struct inode *inode, +const char *ea_name,void *ea_value,size_t buf_size) {ssize_t rc = -EOPNOTSUPP ;#ifdef CONFIG_CIFS_XATTR
@@ -246,9 +246,9 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,if (direntry ==NULL )return -EIO ; -if (direntry->d_inode ==NULL ) +if (inode ==NULL )return -EIO ; - sb = direntry->d_inode->i_sb; + sb = inode->i_sb;if (sb ==NULL )return -EIO ;
@@ -324,7 +324,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, goto get_ea_exit;/* rc already EOPNOTSUPP */ pacl = pTcon->ses->server->ops->get_acl (cifs_sb, - direntry->d_inode, full_path, &acllen); + inode, full_path, &acllen);if (IS_ERR (pacl)) { rc =PTR_ERR (pacl); cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
fs/ecryptfs/crypto.c +4 -1
@@ -1377,7 +1377,9 @@ int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)ssize_t size;int rc =0 ; - size =ecryptfs_getxattr_lower (lower_dentry,ECRYPTFS_XATTR_NAME , + size =ecryptfs_getxattr_lower (lower_dentry, +ecryptfs_inode_to_lower (ecryptfs_inode), +ECRYPTFS_XATTR_NAME , page_virt,ECRYPTFS_DEFAULT_EXTENT_SIZE );if (size <0 ) {if (unlikely (ecryptfs_verbosity >0 ))
@@ -1399,6 +1401,7 @@ int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry,int rc; rc =ecryptfs_getxattr_lower (ecryptfs_dentry_to_lower (dentry), +ecryptfs_inode_to_lower (inode),ECRYPTFS_XATTR_NAME , file_size,ECRYPTFS_SIZE_AND_MARKER_BYTES );if (rc <ECRYPTFS_SIZE_AND_MARKER_BYTES )
fs/ecryptfs/ecryptfs_kernel.h +2 -2
@@ -618,8 +618,8 @@ ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat, unsigned char *src, struct dentry *ecryptfs_dentry);int ecryptfs_truncate (struct dentry *dentry,loff_t new_length);ssize_t -ecryptfs_getxattr_lower (struct dentry *lower_dentry,const char *name, -void *value,size_t size); +ecryptfs_getxattr_lower (struct dentry *lower_dentry,struct inode *lower_inode, +const char *name,void *value,size_t size);int ecryptfs_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags);
fs/ecryptfs/inode.c +12 -11
@@ -1036,29 +1036,30 @@ out: }ssize_t -ecryptfs_getxattr_lower (struct dentry *lower_dentry,const char *name, -void *value,size_t size) +ecryptfs_getxattr_lower (struct dentry *lower_dentry,struct inode *lower_inode, +const char *name,void *value,size_t size) {int rc =0 ; -if (!lower_dentry->d_inode->i_op->getxattr) { +if (!lower_inode->i_op->getxattr) { rc = -EOPNOTSUPP ; goto out; } -mutex_lock (&lower_dentry->d_inode->i_mutex); - rc = lower_dentry->d_inode->i_op->getxattr (lower_dentry, name, value, - size); -mutex_unlock (&lower_dentry->d_inode->i_mutex); +mutex_lock (&lower_inode->i_mutex); + rc = lower_inode->i_op->getxattr (lower_dentry, lower_inode, + name, value, size); +mutex_unlock (&lower_inode->i_mutex); out:return rc; }static ssize_t -ecryptfs_getxattr (struct dentry *dentry,const char *name,void *value, -size_t size) +ecryptfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *value,size_t size) { -return ecryptfs_getxattr_lower (ecryptfs_dentry_to_lower (dentry), name, - value, size); +return ecryptfs_getxattr_lower (ecryptfs_dentry_to_lower (dentry), +ecryptfs_inode_to_lower (inode), + name, value, size); } static ssize_t
fs/ecryptfs/mmap.c +2 -1
@@ -437,7 +437,8 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) goto out; }mutex_lock (&lower_inode->i_mutex); - size = lower_inode->i_op->getxattr (lower_dentry,ECRYPTFS_XATTR_NAME , + size = lower_inode->i_op->getxattr (lower_dentry, lower_inode, +ECRYPTFS_XATTR_NAME , xattr_virt,PAGE_CACHE_SIZE );if (size <0 ) size =8 ;
fs/fuse/dir.c +2 -3
@@ -1887,10 +1887,9 @@ static int fuse_setxattr(struct dentry *entry, const char *name,return err; } -static ssize_t fuse_getxattr (struct dentry *entry,const char *name, -void *value,size_t size) +static ssize_t fuse_getxattr (struct dentry *entry,struct inode *inode, +const char *name,void *value,size_t size) { -struct inode *inode = entry->d_inode;struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_req *req;struct fuse_getxattr_in inarg;
fs/gfs2/inode.c +4 -5
@@ -1871,22 +1871,21 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,return ret; } -static ssize_t gfs2_getxattr (struct dentry *dentry,const char *name, -void *data,size_t size) +static ssize_t gfs2_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *data,size_t size) { -struct inode *inode = dentry->d_inode;struct gfs2_inode *ip =GFS2_I (inode);struct gfs2_holder gh;int ret;/* For selinux during lookup */ if (gfs2_glock_is_locked_by_me (ip->i_gl)) -return generic_getxattr (dentry, name, data, size); +return generic_getxattr (dentry, inode, name, data, size);gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,LM_FLAG_ANY , &gh); ret =gfs2_glock_nq (&gh);if (ret ==0 ) { - ret =generic_getxattr (dentry, name, data, size); + ret =generic_getxattr (dentry, inode, name, data, size);gfs2_glock_dq (&gh); }gfs2_holder_uninit (&gh);
fs/hfs/attr.c +2 -3
@@ -56,10 +56,9 @@ out:return res; } -ssize_t hfs_getxattr (struct dentry *dentry,const char *name, -void *value,size_t size) +ssize_t hfs_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *value,size_t size) { -struct inode *inode = dentry->d_inode;struct hfs_find_data fd;hfs_cat_rec rec;struct hfs_cat_file *file;
fs/hfs/hfs_fs.h +2 -2
@@ -213,8 +213,8 @@ extern void hfs_delete_inode(struct inode *);/* attr.c */ extern int hfs_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); -extern ssize_t hfs_getxattr (struct dentry *dentry,const char *name, -void *value,size_t size); +extern ssize_t hfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *value,size_t size);extern ssize_t hfs_listxattr (struct dentry *dentry,char *buffer,size_t size);/* mdb.c */
fs/jfs/jfs_xattr.h +1 -1
@@ -57,7 +57,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,extern int jfs_setxattr (struct dentry *,const char *,const void *,size_t ,int );extern ssize_t __jfs_getxattr (struct inode *,const char *,void *,size_t ); -extern ssize_t jfs_getxattr (struct dentry *,const char *,void *,size_t ); +extern ssize_t jfs_getxattr (struct dentry *,struct inode *,const char *,void *,size_t );extern ssize_t jfs_listxattr (struct dentry *,char *,size_t );extern int jfs_removexattr (struct dentry *,const char *);
fs/jfs/xattr.c +4 -4
@@ -933,8 +933,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,return size; } -ssize_t jfs_getxattr (struct dentry *dentry,const char *name,void *data, -size_t buf_size) +ssize_t jfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *data,size_t buf_size) {int err;
@@ -944,7 +944,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_getxattr (dentry, name, data, buf_size); +return generic_getxattr (dentry, inode, name, data, buf_size);if (strncmp (name,XATTR_OS2_PREFIX ,XATTR_OS2_PREFIX_LEN ) ==0 ) {/*
@@ -959,7 +959,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,return -EOPNOTSUPP ; } - err =__jfs_getxattr (dentry->d_inode, name, data, buf_size); + err =__jfs_getxattr (inode, name, data, buf_size);return err; }
fs/kernfs/inode.c +3 -3
@@ -220,10 +220,10 @@ int kernfs_iop_removexattr(struct dentry *dentry, const char *name)return simple_xattr_remove (&attrs->xattrs, name); } -ssize_t kernfs_iop_getxattr (struct dentry *dentry,const char *name,void *buf, -size_t size) +ssize_t kernfs_iop_getxattr (struct dentry *unused,struct inode *inode, +const char *name,void *buf,size_t size) { -struct kernfs_node *kn = dentry->d_fsdata; +struct kernfs_node *kn = inode->i_private;struct kernfs_iattrs *attrs; attrs =kernfs_iattrs (kn);
fs/kernfs/kernfs-internal.h +2 -2
@@ -85,8 +85,8 @@ int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,int kernfs_iop_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags);int kernfs_iop_removexattr (struct dentry *dentry,const char *name); -ssize_t kernfs_iop_getxattr (struct dentry *dentry,const char *name,void *buf, -size_t size); +ssize_t kernfs_iop_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buf,size_t size);ssize_t kernfs_iop_listxattr (struct dentry *dentry,char *buf,size_t size);void kernfs_inode_init (void );
fs/overlayfs/inode.c +2 -2
@@ -246,8 +246,8 @@ static bool ovl_need_xattr_filter(struct dentry *dentry,return type ==OVL_PATH_UPPER &&S_ISDIR (dentry->d_inode->i_mode); } -ssize_t ovl_getxattr (struct dentry *dentry,const char *name, -void *value,size_t size) +ssize_t ovl_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *value,size_t size) {struct path realpath;enum ovl_path_type type =ovl_path_real (dentry, &realpath);
fs/overlayfs/overlayfs.h +2 -2
@@ -161,8 +161,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr);int ovl_permission (struct inode *inode,int mask);int ovl_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); -ssize_t ovl_getxattr (struct dentry *dentry,const char *name, -void *value,size_t size); +ssize_t ovl_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *value,size_t size);ssize_t ovl_listxattr (struct dentry *dentry,char *list,size_t size);int ovl_removexattr (struct dentry *dentry,const char *name);struct inode *ovl_d_select_inode (struct dentry *dentry,unsigned file_flags);
fs/overlayfs/super.c +1 -1
@@ -249,7 +249,7 @@ static bool ovl_is_opaquedir(struct dentry *dentry)if (!S_ISDIR (inode->i_mode) || !inode->i_op->getxattr)return false; - res = inode->i_op->getxattr (dentry, ovl_opaque_xattr, &val,1 ); + res = inode->i_op->getxattr (dentry, inode, ovl_opaque_xattr, &val,1 );if (res ==1 && val =='y' )return true;
fs/reiserfs/xattr.c +4 -4
@@ -767,8 +767,8 @@ find_xattr_handler_prefix(const struct xattr_handler **handlers,* Inode operation getxattr() */ ssize_t -reiserfs_getxattr (struct dentry * dentry,const char *name,void *buffer, -size_t size) +reiserfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) {const struct xattr_handler *handler;
@@ -777,8 +777,8 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,if (!handler ||get_inode_sd_version (dentry->d_inode) ==STAT_DATA_V1 )return -EOPNOTSUPP ; -return handler->get (dentry, dentry->d_inode, name, buffer, size, - handler->flags); +return handler->get (dentry, inode, + name, buffer, size, handler->flags); }/*
fs/reiserfs/xattr.h +2 -2
@@ -18,8 +18,8 @@ int reiserfs_permission(struct inode *inode, int mask);#ifdef CONFIG_REISERFS_FS_XATTR #define has_xattr_dir (inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) -ssize_t reiserfs_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size); +ssize_t reiserfs_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size);int reiserfs_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags);ssize_t reiserfs_listxattr (struct dentry *dentry,char *buffer,size_t size);
fs/ubifs/ubifs.h +2 -2
@@ -1750,8 +1750,8 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,/* xattr.c */ int ubifs_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); -ssize_t ubifs_getxattr (struct dentry *dentry,const char *name,void *buf, -size_t size); +ssize_t ubifs_getxattr (struct dentry *dentry,struct inode *host, +const char *name,void *buf,size_t size);ssize_t ubifs_listxattr (struct dentry *dentry,char *buffer,size_t size);int ubifs_removexattr (struct dentry *dentry,const char *name);
fs/ubifs/xattr.c +3 -3
@@ -357,10 +357,10 @@ out_free:return err; } -ssize_t ubifs_getxattr (struct dentry *dentry,const char *name,void *buf, -size_t size) +ssize_t ubifs_getxattr (struct dentry *dentry,struct inode *host, +const char *name,void *buf,size_t size) { -struct inode *inode, *host = dentry->d_inode; +struct inode *inode;struct ubifs_info *c = host->i_sb->s_fs_info;struct qstr nm =QSTR_INIT (name,strlen (name));struct ubifs_inode *ui;
fs/xattr.c +7 -6
@@ -192,7 +192,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,if (!inode->i_op->getxattr)return -EOPNOTSUPP ; - error = inode->i_op->getxattr (dentry, name,NULL ,0 ); + error = inode->i_op->getxattr (dentry, inode, name,NULL ,0 );if (error <0 )return error;
@@ -203,7 +203,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,memset (value,0 , error +1 ); } - error = inode->i_op->getxattr (dentry, name, value, error); + error = inode->i_op->getxattr (dentry, inode, name, value, error); *xattr_value = value;return error; }
@@ -255,7 +255,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) } nolsm:if (inode->i_op->getxattr) - error = inode->i_op->getxattr (dentry, name, value, size); + error = inode->i_op->getxattr (dentry, inode, name, value, size);else error = -EOPNOTSUPP ;
@@ -717,15 +717,16 @@ xattr_resolve_name(const struct xattr_handler **handlers, const char **name)* Find the handler for the prefix and dispatch its get() operation. */ ssize_t -generic_getxattr (struct dentry *dentry,const char *name,void *buffer,size_t size) +generic_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) {const struct xattr_handler *handler; handler =xattr_resolve_name (dentry->d_sb->s_xattr, &name);if (!handler)return -EOPNOTSUPP ; -return handler->get (dentry, dentry->d_inode, name, buffer, size, - handler->flags); +return handler->get (dentry, inode, + name, buffer, size, handler->flags); }/*
include/linux/fs.h +2 -1
@@ -1538,7 +1538,8 @@ struct inode_operations {int (*setattr) (struct dentry *,struct iattr *);int (*getattr) (struct vfsmount *mnt,struct dentry *,struct kstat *);int (*setxattr) (struct dentry *,const char *,const void *,size_t ,int ); -ssize_t (*getxattr) (struct dentry *,const char *,void *,size_t ); +ssize_t (*getxattr) (struct dentry *,struct inode *, +const char *,void *,size_t );ssize_t (*listxattr) (struct dentry *,char *,size_t );int (*removexattr) (struct dentry *,const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
include/linux/xattr.h +1 -1
@@ -43,7 +43,7 @@ int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, iint vfs_setxattr (struct dentry *,const char *,const void *,size_t ,int );int vfs_removexattr (struct dentry *,const char *); -ssize_t generic_getxattr (struct dentry *dentry,const char *name,void *buffer,size_t size); +ssize_t generic_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size);ssize_t generic_listxattr (struct dentry *dentry,char *buffer,size_t buffer_size);int generic_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags);int generic_removexattr (struct dentry *dentry,const char *name);
mm/shmem.c +4 -4
@@ -2576,10 +2576,10 @@ static int shmem_xattr_validate(const char *name)return -EOPNOTSUPP ; } -static ssize_t shmem_getxattr (struct dentry *dentry,const char *name, -void *buffer,size_t size) +static ssize_t shmem_getxattr (struct dentry *dentry,struct inode *inode, +const char *name,void *buffer,size_t size) { -struct shmem_inode_info *info =SHMEM_I (dentry->d_inode); +struct shmem_inode_info *info =SHMEM_I (inode);int err;/*
@@ -2588,7 +2588,7 @@ static ssize_t shmem_getxattr(struct dentry *dentry, const char *name,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_getxattr (dentry, name, buffer, size); +return generic_getxattr (dentry, inode, name, buffer, size); err =shmem_xattr_validate (name);if (err)
net/socket.c +1 -1
@@ -470,7 +470,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed)#define XATTR_SOCKPROTONAME_SUFFIX "sockprotoname"#define XATTR_NAME_SOCKPROTONAME (XATTR_SYSTEM_PREFIX XATTR_SOCKPROTONAME_SUFFIX)#define XATTR_NAME_SOCKPROTONAME_LEN (sizeof(XATTR_NAME_SOCKPROTONAME)-1) -static ssize_t sockfs_getxattr (struct dentry *dentry, +static ssize_t sockfs_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *value,size_t size) {const char *proto_name;
security/commoncap.c +3 -3
@@ -308,7 +308,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)if (!inode->i_op->getxattr)return 0 ; - error = inode->i_op->getxattr (dentry,XATTR_NAME_CAPS ,NULL ,0 ); + error = inode->i_op->getxattr (dentry, inode,XATTR_NAME_CAPS ,NULL ,0 );if (error <=0 )return 0 ;return 1 ;
@@ -391,8 +391,8 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_dataif (!inode || !inode->i_op->getxattr)return -ENODATA ; - size = inode->i_op->getxattr ((struct dentry *)dentry,XATTR_NAME_CAPS , &caps, -XATTR_CAPS_SZ ); + size = inode->i_op->getxattr ((struct dentry *)dentry, inode, +XATTR_NAME_CAPS , &caps,XATTR_CAPS_SZ );if (size == -ENODATA || size == -EOPNOTSUPP )/* no data, that's ok */ return -ENODATA ;
security/integrity/evm/evm_main.c +1 -1
@@ -83,7 +83,7 @@ static int evm_find_protected_xattrs(struct dentry *dentry)return -EOPNOTSUPP ;for (xattr = evm_config_xattrnames; *xattr !=NULL ; xattr++) { - error = inode->i_op->getxattr (dentry, *xattr,NULL ,0 ); + error = inode->i_op->getxattr (dentry, inode, *xattr,NULL ,0 );if (error <0 ) {if (error == -ENODATA )continue ;
security/selinux/hooks.c +5 -4
@@ -442,7 +442,8 @@ static int sb_finish_set_opts(struct super_block *sb) rc = -EOPNOTSUPP ; goto out; } - rc = root_inode->i_op->getxattr (root,XATTR_NAME_SELINUX ,NULL ,0 ); + rc = root_inode->i_op->getxattr (root, root_inode, +XATTR_NAME_SELINUX ,NULL ,0 );if (rc <0 && rc != -ENODATA ) {if (rc == -EOPNOTSUPP ) printk(KERN_WARNING "SELinux: (dev %s, type "
@@ -1344,13 +1345,13 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent goto out_unlock; } context[len] ='\0' ; - rc = inode->i_op->getxattr (dentry,XATTR_NAME_SELINUX , + rc = inode->i_op->getxattr (dentry, inode,XATTR_NAME_SELINUX , context, len);if (rc == -ERANGE ) {kfree (context);/* Need a larger buffer. Query for the right size. */ - rc = inode->i_op->getxattr (dentry,XATTR_NAME_SELINUX , + rc = inode->i_op->getxattr (dentry, inode,XATTR_NAME_SELINUX ,NULL ,0 );if (rc <0 ) {dput (dentry);
@@ -1364,7 +1365,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent goto out_unlock; } context[len] ='\0' ; - rc = inode->i_op->getxattr (dentry, + rc = inode->i_op->getxattr (dentry, inode,XATTR_NAME_SELINUX , context, len); }
security/smack/smack_lsm.c +2 -2
@@ -219,7 +219,7 @@ static struct smack_known *smk_fetch(const char *name, struct inode *ip,if (buffer ==NULL )return NULL ; - rc = ip->i_op->getxattr (dp, name, buffer,SMK_LONGLABEL ); + rc = ip->i_op->getxattr (dp, ip, name, buffer,SMK_LONGLABEL );if (rc >0 ) skp =smk_import_entry (buffer, rc);
@@ -3144,7 +3144,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)TRANS_TRUE ,TRANS_TRUE_SIZE , 0); } else { - rc = inode->i_op->getxattr (dp, + rc = inode->i_op->getxattr (dp, inode,XATTR_NAME_SMACKTRANSMUTE , trattr,TRANS_TRUE_SIZE ); if (rc >= 0 && strncmp(trattr, TRANS_TRUE,
Signature · 1 line
1.7.4.1
PATCH 5/5 switch ->setxattr() to passing dentry and inode separately
In reply to a message not in the archiveFrom: Al Viro <[email protected]>
smack ->d_instantiate() uses ->setxattr(), so to be able to call it before we'd hashed the new dentry and attached it to inode, we need ->setxattr() instances getting the inode as an explicit argument rather than obtaining it from dentry.
Similar change for ->getxattr() had been done in commit ce23e64. Unlike ->getxattr() (which is used by both selinux and smack instances of ->d_instantiate()) ->setxattr() is used only by smack one and unfortunately it got missed back then.
---
It is not clear, a26feccaba29 ("ceph: Get rid of d_find_alias in ceph_set_acl") is required backport for ceph or not.
--- Documentation/filesystems/porting | 7 +++++++ .../staging/lustre/lustre/llite/llite_internal.h | 4 ++-- drivers/staging/lustre/lustre/llite/xattr.c | 6 ++---- fs/bad_inode.c | 4 ++-- fs/btrfs/xattr.c | 12 +++++++----- fs/btrfs/xattr.h | 5 +++-- fs/ceph/super.h | 4 ++-- fs/ceph/xattr.c | 7 ++++--- fs/cifs/cifsfs.h | 4 ++-- fs/cifs/xattr.c | 13 +++++++------ fs/ecryptfs/crypto.c | 9 +++++---- fs/ecryptfs/ecryptfs_kernel.h | 4 ++-- fs/ecryptfs/inode.c | 7 ++++--- fs/ecryptfs/mmap.c | 3 ++- fs/fuse/dir.c | 6 +++--- fs/gfs2/inode.c | 9 +++++---- fs/hfs/attr.c | 6 +++--- fs/hfs/hfs_fs.h | 2 +- fs/jfs/jfs_xattr.h | 4 ++-- fs/jfs/xattr.c | 10 +++++----- fs/kernfs/inode.c | 11 ++++++----- fs/kernfs/kernfs-internal.h | 3 ++- fs/overlayfs/inode.c | 5 +++-- fs/overlayfs/overlayfs.h | 5 +++-- fs/reiserfs/xattr.c | 8 ++++---- fs/reiserfs/xattr.h | 5 +++-- fs/ubifs/ubifs.h | 2 +- fs/ubifs/xattr.c | 4 ++-- fs/xattr.c | 9 +++++---- include/linux/fs.h | 3 ++- include/linux/xattr.h | 3 ++- mm/shmem.c | 10 ++++++---- security/smack/smack_lsm.c | 2 +- 33 files changed, 110 insertions(+), 86 deletions(-)
Documentation/filesystems/porting +7 -0
@@ -469,3 +469,10 @@ in your dentry operations instead. dentry might be yet to be attached to inode, so do _not_ use its ->d_inode in the instances. Rationale: !@#!@# security_d_instantiate() needs to be called before we attach dentry to inode. +-- +[mandatory] + ->setxattr() and xattr_handler.set() get dentry and inode passed separately. + dentry might be yet to be attached to inode, so do _not_ use its ->d_inode + in the instances. Rationale: !@#!@# security_d_instantiate() needs to be + called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack + ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well.
drivers/staging/lustre/lustre/llite/llite_internal.h +2 -2
@@ -1068,8 +1068,8 @@ static inline __u64 ll_file_maxbytes(struct inode *inode) }/* llite/xattr.c */ -int ll_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags); +int ll_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags);ssize_t ll_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size);ssize_t ll_listxattr (struct dentry *dentry,char *buffer,size_t size);
drivers/staging/lustre/lustre/llite/xattr.c +2 -4
@@ -212,11 +212,9 @@ int ll_setxattr_common(struct inode *inode, const char *name,return 0 ; } -int ll_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +int ll_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags) { -struct inode *inode = dentry->d_inode; -LASSERT (inode);LASSERT (name);
fs/bad_inode.c +2 -2
@@ -247,8 +247,8 @@ static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs)return -EIO ; } -static int bad_inode_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +static int bad_inode_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags) {return -EIO ; }
fs/btrfs/xattr.c +7 -5
@@ -412,10 +412,11 @@ ssize_t btrfs_getxattr(struct dentry *dentry, struct inode *inode,return __btrfs_getxattr (inode, name, buffer, size); } -int btrfs_setxattr (struct dentry *dentry,const char *name,const void *value, +int btrfs_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags) { -struct btrfs_root *root =BTRFS_I (dentry->d_inode)->root; +struct btrfs_root *root =BTRFS_I (inode)->root;int ret;/*
@@ -431,20 +432,21 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_setxattr (dentry, name, value, size, flags); +return generic_setxattr (dentry, inode, name, value, + size, flags); ret =btrfs_is_valid_xattr (name);if (ret)return ret;if (!strncmp (name,XATTR_BTRFS_PREFIX ,XATTR_BTRFS_PREFIX_LEN )) -return btrfs_set_prop (dentry->d_inode, name, +return btrfs_set_prop (inode, name, value, size, flags);if (size ==0 ) value ="" ;/* empty EA, do not remove */ -return __btrfs_setxattr (NULL , dentry->d_inode, name, value, size, +return __btrfs_setxattr (NULL , inode, name, value, size, flags); }
fs/btrfs/xattr.h +3 -2
@@ -30,8 +30,9 @@ extern int __btrfs_setxattr(struct btrfs_trans_handle *trans, const void *value, size_t size, int flags);extern ssize_t btrfs_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size); -extern int btrfs_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags); +extern int btrfs_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags);extern int btrfs_removexattr (struct dentry *dentry,const char *name); extern int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
fs/ceph/super.h +2 -2
@@ -722,8 +722,8 @@ extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);/* xattr.c */ -extern int ceph_setxattr (struct dentry *,const char *,const void *, -size_t ,int ); +extern int ceph_setxattr (struct dentry *,struct inode *,const char *, +const void *,size_t ,int );int __ceph_setxattr (struct dentry *,const char *,const void *,size_t ,int );ssize_t __ceph_getxattr (struct inode *,const char *,void *,size_t );int __ceph_removexattr (struct dentry *,const char *);
fs/ceph/xattr.c +4 -3
@@ -995,14 +995,15 @@ out:return err; } -int ceph_setxattr (struct dentry *dentry,const char *name, +int ceph_setxattr (struct dentry *dentry,struct inode *inode,const char *name,const void *value,size_t size,int flags) { -if (ceph_snap (dentry->d_inode) !=CEPH_NOSNAP ) +if (ceph_snap (inode) !=CEPH_NOSNAP )return -EROFS ;if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_setxattr (dentry, name, value, size, flags); +return generic_setxattr (dentry, inode, name, value, size, + flags);return __ceph_setxattr (dentry, name, value, size, flags); }
fs/cifs/cifsfs.h +2 -2
@@ -122,8 +122,8 @@ extern int cifs_readlink(struct dentry *direntry, char __user *buffer,extern int cifs_symlink (struct inode *inode,struct dentry *direntry,const char *symname);extern int cifs_removexattr (struct dentry *,const char *); -extern int cifs_setxattr (struct dentry *,const char *,const void *, -size_t ,int ); +extern int cifs_setxattr (struct dentry *,struct inode *,const char *, +const void *,size_t ,int );extern ssize_t cifs_getxattr (struct dentry *,struct inode *,const char *,void *,size_t );extern ssize_t cifs_listxattr (struct dentry *,char *,size_t );extern long cifs_ioctl (struct file *filep,unsigned int cmd,unsigned long arg);
fs/cifs/xattr.c +7 -6
@@ -97,8 +97,9 @@ remove_ea_exit:return rc; } -int cifs_setxattr (struct dentry *direntry,const char *ea_name, -const void *ea_value,size_t value_size,int flags) +int cifs_setxattr (struct dentry *direntry,struct inode *inode, +const char *ea_name,const void *ea_value,size_t value_size, +int flags) {int rc = -EOPNOTSUPP ;#ifdef CONFIG_CIFS_XATTR
@@ -111,9 +112,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,if (direntry ==NULL )return -EIO ; -if (direntry->d_inode ==NULL ) +if (inode ==NULL )return -EIO ; - sb = direntry->d_inode->i_sb; + sb = inode->i_sb;if (sb ==NULL )return -EIO ;
@@ -177,12 +178,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,memcpy (pacl, ea_value, value_size);if (pTcon->ses->server->ops->set_acl) rc = pTcon->ses->server->ops->set_acl (pacl, - value_size, direntry->d_inode, + value_size, inode, full_path,CIFS_ACL_DACL );else rc = -EOPNOTSUPP ;if (rc ==0 )/* force revalidate of the inode */ -CIFS_I (direntry->d_inode)->time =0 ; +CIFS_I (inode)->time =0 ; kfree(pacl); }#else
fs/ecryptfs/crypto.c +5 -4
@@ -1149,12 +1149,13 @@ ecryptfs_write_metadata_to_contents(struct inode *ecryptfs_inode,static int ecryptfs_write_metadata_to_xattr (struct dentry *ecryptfs_dentry, +struct inode *ecryptfs_inode,char *page_virt,size_t size) {int rc; - rc =ecryptfs_setxattr (ecryptfs_dentry,ECRYPTFS_XATTR_NAME , page_virt, - size,0 ); + rc =ecryptfs_setxattr (ecryptfs_dentry, ecryptfs_inode, +ECRYPTFS_XATTR_NAME , page_virt, size,0 );return rc; }
@@ -1223,8 +1224,8 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry, goto out_free; }if (crypt_stat->flags &ECRYPTFS_METADATA_IN_XATTR ) - rc =ecryptfs_write_metadata_to_xattr (ecryptfs_dentry, virt, - size); + rc =ecryptfs_write_metadata_to_xattr (ecryptfs_dentry, ecryptfs_inode, + virt, size);else rc =ecryptfs_write_metadata_to_contents (ecryptfs_inode, virt, virt_len);
fs/ecryptfs/ecryptfs_kernel.h +2 -2
@@ -621,8 +621,8 @@ ssize_t ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, const char *name, void *value, size_t size);int -ecryptfs_setxattr (struct dentry *dentry,const char *name,const void *value, -size_t size,int flags); +ecryptfs_setxattr (struct dentry *dentry,struct inode *inode,const char *name, +const void *value,size_t size,int flags);int ecryptfs_read_xattr_region (char *page_virt,struct inode *ecryptfs_inode);#ifdef CONFIG_ECRYPT_FS_MESSAGING int ecryptfs_process_response(struct ecryptfs_daemon *daemon,
fs/ecryptfs/inode.c +4 -3
@@ -1016,7 +1016,8 @@ static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, }int -ecryptfs_setxattr (struct dentry *dentry,const char *name,const void *value, +ecryptfs_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags) {int rc =0 ;
@@ -1029,8 +1030,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, } rc =vfs_setxattr (lower_dentry, name, value, size, flags); -if (!rc && dentry->d_inode) -fsstack_copy_attr_all (dentry->d_inode, lower_dentry->d_inode); +if (!rc && inode) +fsstack_copy_attr_all (inode, lower_dentry->d_inode); out:return rc; }
fs/ecryptfs/mmap.c +2 -1
@@ -443,7 +443,8 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)if (size <0 ) size =8 ;put_unaligned_be64 (i_size_read (ecryptfs_inode), xattr_virt); - rc = lower_inode->i_op->setxattr (lower_dentry,ECRYPTFS_XATTR_NAME , + rc = lower_inode->i_op->setxattr (lower_dentry, lower_inode, +ECRYPTFS_XATTR_NAME , xattr_virt, size,0 );mutex_unlock (&lower_inode->i_mutex);if (rc)
fs/fuse/dir.c +3 -3
@@ -1845,10 +1845,10 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,return fuse_update_attributes (inode, stat,NULL ,NULL ); } -static int fuse_setxattr (struct dentry *entry,const char *name, -const void *value,size_t size,int flags) +static int fuse_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags) { -struct inode *inode = entry->d_inode;struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_req *req;struct fuse_setxattr_in inarg;
fs/gfs2/inode.c +5 -4
@@ -1851,10 +1851,10 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,return 0 ; } -static int gfs2_setxattr (struct dentry *dentry,const char *name, -const void *data,size_t size,int flags) +static int gfs2_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *data,size_t size, +int flags) { -struct inode *inode = dentry->d_inode;struct gfs2_inode *ip =GFS2_I (inode);struct gfs2_holder gh;int ret;
@@ -1864,7 +1864,8 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,if (ret ==0 ) { ret =gfs2_rs_alloc (ip);if (ret ==0 ) - ret =generic_setxattr (dentry, name, data, size, flags); + ret =generic_setxattr (dentry, inode, name, data, + size, flags);gfs2_glock_dq (&gh); }gfs2_holder_uninit (&gh);
fs/hfs/attr.c +3 -3
@@ -13,10 +13,10 @@#include "hfs_fs.h" #include "btree.h" -int hfs_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +int hfs_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags) { -struct inode *inode = dentry->d_inode;struct hfs_find_data fd;hfs_cat_rec rec;struct hfs_cat_file *file;
fs/hfs/hfs_fs.h +1 -1
@@ -211,7 +211,7 @@ extern void hfs_evict_inode(struct inode *);extern void hfs_delete_inode (struct inode *);/* attr.c */ -extern int hfs_setxattr (struct dentry *dentry,const char *name, +extern int hfs_setxattr (struct dentry *dentry,struct inode *inode,const char *name,const void *value,size_t size,int flags);extern ssize_t hfs_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *value,size_t size);
fs/jfs/jfs_xattr.h +2 -2
@@ -54,8 +54,8 @@ struct jfs_ea_list {extern int __jfs_setxattr (tid_t ,struct inode *,const char *,const void *,size_t ,int ); -extern int jfs_setxattr (struct dentry *,const char *,const void *,size_t , -int ); +extern int jfs_setxattr (struct dentry *,struct inode *,const char *, +const void *,size_t ,int );extern ssize_t __jfs_getxattr (struct inode *,const char *,void *,size_t );extern ssize_t jfs_getxattr (struct dentry *,struct inode *,const char *,void *,size_t );extern ssize_t jfs_listxattr (struct dentry *,char *,size_t );
fs/jfs/xattr.c +5 -5
@@ -846,10 +846,9 @@ int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name,return rc; } -int jfs_setxattr (struct dentry *dentry,const char *name,const void *value, -size_t value_len,int flags) +int jfs_setxattr (struct dentry *dentry,struct inode *inode,const char *name, +const void *value,size_t value_len,int flags) { -struct inode *inode = dentry->d_inode;struct jfs_inode_info *ji =JFS_IP (inode);int rc;tid_t tid;
@@ -860,7 +859,8 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_setxattr (dentry, name, value, value_len, flags); +return generic_setxattr (dentry, inode, name, value, value_len, + flags);if ((rc =can_set_xattr (inode, name, value, value_len)))return rc;
@@ -872,7 +872,7 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, tid =txBegin (inode->i_sb,0 );mutex_lock (&ji->commit_mutex); - rc =__jfs_setxattr (tid, dentry->d_inode, name, value, value_len, + rc =__jfs_setxattr (tid, inode, name, value, value_len, flags);if (!rc) rc =txCommit (tid,1 , &inode,0 );
fs/kernfs/inode.c +6 -5
@@ -169,10 +169,11 @@ static int kernfs_node_setsecdata(struct kernfs_node *kn, void **secdata,return 0 ; } -int kernfs_iop_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +int kernfs_iop_setxattr (struct dentry *unused,struct inode *inode, +const char *name,const void *value, +size_t size,int flags) { -struct kernfs_node *kn = dentry->d_fsdata; +struct kernfs_node *kn = inode->i_private;struct kernfs_iattrs *attrs;void *secdata;int error;
@@ -184,11 +185,11 @@ int kernfs_iop_setxattr(struct dentry *dentry, const char *name,if (!strncmp (name,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN )) {const char *suffix = name +XATTR_SECURITY_PREFIX_LEN ; - error =security_inode_setsecurity (dentry->d_inode, suffix, + error =security_inode_setsecurity (inode, suffix, value, size, flags);if (error)return error; - error =security_inode_getsecctx (dentry->d_inode, + error =security_inode_getsecctx (inode, &secdata, &secdata_len);if (error)return error;
fs/kernfs/kernfs-internal.h +2 -1
@@ -82,7 +82,8 @@ int kernfs_iop_permission(struct inode *inode, int mask);int kernfs_iop_setattr (struct dentry *dentry,struct iattr *iattr);int kernfs_iop_getattr (struct vfsmount *mnt,struct dentry *dentry,struct kstat *stat); -int kernfs_iop_setxattr (struct dentry *dentry,const char *name,const void *value, +int kernfs_iop_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags);int kernfs_iop_removexattr (struct dentry *dentry,const char *name); ssize_t kernfs_iop_getxattr(struct dentry *dentry, struct inode *inode,
fs/overlayfs/inode.c +3 -2
@@ -213,8 +213,9 @@ bool ovl_is_private_xattr(const char *name)return strncmp (name,"trusted.overlay." ,14 ) ==0 ; } -int ovl_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +int ovl_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags) {int err;struct dentry *upperdentry;
fs/overlayfs/overlayfs.h +3 -2
@@ -159,8 +159,9 @@ void ovl_cache_free(struct list_head *list);/* inode.c */ int ovl_setattr (struct dentry *dentry,struct iattr *attr);int ovl_permission (struct inode *inode,int mask); -int ovl_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags); +int ovl_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value, +size_t size,int flags);ssize_t ovl_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *value,size_t size);ssize_t ovl_listxattr (struct dentry *dentry,char *list,size_t size);
fs/reiserfs/xattr.c +4 -4
@@ -787,8 +787,8 @@ reiserfs_getxattr(struct dentry *dentry, struct inode *inode,* dentry->d_inode->i_mutex down */ int -reiserfs_setxattr (struct dentry *dentry,const char *name,const void *value, -size_t size,int flags) +reiserfs_setxattr (struct dentry *dentry,struct inode *inode,const char *name, +const void *value,size_t size,int flags) {const struct xattr_handler *handler;
@@ -797,8 +797,8 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,if (!handler ||get_inode_sd_version (dentry->d_inode) ==STAT_DATA_V1 )return -EOPNOTSUPP ; -return handler->set (dentry, dentry->d_inode, name, value, size, - flags, handler->flags); +return handler->set (dentry, inode, name, value, size, flags, + handler->flags); }/*
fs/reiserfs/xattr.h +3 -2
@@ -20,8 +20,9 @@ int reiserfs_permission(struct inode *inode, int mask);#define has_xattr_dir (inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)ssize_t reiserfs_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size); -int reiserfs_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags); +int reiserfs_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size, +int flags);ssize_t reiserfs_listxattr (struct dentry *dentry,char *buffer,size_t size);int reiserfs_removexattr (struct dentry *dentry,const char *name);
fs/ubifs/ubifs.h +1 -1
@@ -1748,7 +1748,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);/* xattr.c */ -int ubifs_setxattr (struct dentry *dentry,const char *name, +int ubifs_setxattr (struct dentry *dentry,struct inode *inode,const char *name,const void *value,size_t size,int flags);ssize_t ubifs_getxattr (struct dentry *dentry,struct inode *host,const char *name,void *buf,size_t size);
fs/ubifs/xattr.c +2 -2
@@ -294,10 +294,10 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum)return ERR_PTR (-EINVAL ); } -int ubifs_setxattr (struct dentry *dentry,const char *name, +int ubifs_setxattr (struct dentry *dentry,struct inode *host,const char *name,const void *value,size_t size,int flags) { -struct inode *inode, *host = dentry->d_inode; +struct inode *inode;struct ubifs_info *c = host->i_sb->s_fs_info;struct qstr nm =QSTR_INIT (name,strlen (name));struct ubifs_dent_node *xent;
fs/xattr.c +5 -4
@@ -100,7 +100,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,if (issec) inode->i_flags &= ~S_NOSEC ;if (inode->i_op->setxattr) { - error = inode->i_op->setxattr (dentry, name, value, size, flags); + error = inode->i_op->setxattr (dentry, inode, name, value, size, flags);if (!error) {fsnotify_xattr (dentry); security_inode_post_setxattr(dentry, name, value,
@@ -764,7 +764,8 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)* Find the handler for the prefix and dispatch its set() operation. */ int -generic_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags) +generic_setxattr (struct dentry *dentry,struct inode *inode,const char *name, +const void *value,size_t size,int flags) {const struct xattr_handler *handler;
@@ -773,8 +774,8 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz handler =xattr_resolve_name (dentry->d_sb->s_xattr, &name);if (!handler)return -EOPNOTSUPP ; -return handler->set (dentry, dentry->d_inode, name, value, size, - flags, handler->flags); +return handler->set (dentry, inode, name, value, size, flags, + handler->flags); }/*
include/linux/fs.h +2 -1
@@ -1537,7 +1537,8 @@ struct inode_operations { struct inode *, struct dentry *, unsigned int);int (*setattr) (struct dentry *,struct iattr *);int (*getattr) (struct vfsmount *mnt,struct dentry *,struct kstat *); -int (*setxattr) (struct dentry *,const char *,const void *,size_t ,int ); +int (*setxattr) (struct dentry *,struct inode *, +const char *,const void *,size_t ,int );ssize_t (*getxattr) (struct dentry *,struct inode *,const char *,void *,size_t );ssize_t (*listxattr) (struct dentry *,char *,size_t );
include/linux/xattr.h +2 -1
@@ -46,7 +46,8 @@ int vfs_removexattr(struct dentry *, const char *);ssize_t generic_getxattr (struct dentry *dentry,struct inode *inode,const char *name,void *buffer,size_t size);ssize_t generic_listxattr (struct dentry *dentry,char *buffer,size_t buffer_size); -int generic_setxattr (struct dentry *dentry,const char *name,const void *value,size_t size,int flags); +int generic_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size,int flags);int generic_removexattr (struct dentry *dentry,const char *name);ssize_t vfs_getxattr_alloc (struct dentry *dentry,const char *name,char **xattr_value,size_t size,gfp_t flags);
mm/shmem.c +6 -4
@@ -2597,10 +2597,11 @@ static ssize_t shmem_getxattr(struct dentry *dentry, struct inode *inode,return simple_xattr_get (&info->xattrs, name, buffer, size); } -static int shmem_setxattr (struct dentry *dentry,const char *name, -const void *value,size_t size,int flags) +static int shmem_setxattr (struct dentry *dentry,struct inode *inode, +const char *name,const void *value,size_t size, +int flags) { -struct shmem_inode_info *info =SHMEM_I (dentry->d_inode); +struct shmem_inode_info *info =SHMEM_I (inode);int err;/*
@@ -2609,7 +2610,8 @@ static int shmem_setxattr(struct dentry *dentry, const char *name,* for it via sb->s_xattr. */ if (!strncmp (name,XATTR_SYSTEM_PREFIX ,XATTR_SYSTEM_PREFIX_LEN )) -return generic_setxattr (dentry, name, value, size, flags); +return generic_setxattr (dentry, inode, name, value, size, + flags); err =shmem_xattr_validate (name);if (err)
security/smack/smack_lsm.c +1 -1
@@ -3139,7 +3139,7 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)*/ if (isp->smk_flags &SMK_INODE_CHANGED ) { isp->smk_flags &= ~SMK_INODE_CHANGED ; - rc = inode->i_op->setxattr (dp, + rc = inode->i_op->setxattr (dp, inode,XATTR_NAME_SMACKTRANSMUTE ,TRANS_TRUE ,TRANS_TRUE_SIZE ,0 );
Signature · 1 line
1.7.4.1
Quoted 40 lines · Seung-Woo Kim
Quoted 39 lines · Al Viro
Quoted 37 lines · Linus Torvalds
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);Quoted 1 line
__d_instantiate(entry, inode);Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit
b296821a7c42("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Al - comments? This is all because of commit
1e2e547a93a0("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases ofsecurity_d_instantiate()calling down to getxattr. Which used to not get the inode at all, so those older kernels used_inode(dentry), which doesn't work in this path sincedentry->d_inodehasn't been instantiated yet..
Quoted 9 lines
Quoted 1 line
You also want
b96809173e94andce23e6401334there...For above two commits, also
b296821a7c42is required. And after backport, smack still crashed because setxattr. To fix it,5930122683dfand3767e255b390are also required.By the way, does no one have met this kind getxattr crash issue with selinux from 3.18.y?
I have checked with selinux, and it is confirmed that there is no crash because selinux_d_instantiate() has null check for inode. So, it is only security smack issue.
Signature · 3 lines
Seung-Woo Kim Samsung Research --
Greg Kroah-Hartman
maintainerQuoted 47 lines · Seung-Woo Kim
Quoted 46 lines · Seung-Woo Kim
Quoted 32 lines · Al Viro
Quoted 31 lines · Linus Torvalds
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);Quoted 1 line
__d_instantiate(entry, inode);Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit
b296821a7c42("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Quoted 8 lines
Quoted 6 lines
Al - comments? This is all because of commit
1e2e547a93a0("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases ofsecurity_d_instantiate()calling down to getxattr. Which used to not get the inode at all, so those older kernels used_inode(dentry), which doesn't work in this path sincedentry->d_inodehasn't been instantiated yet..You also want
b96809173e94andce23e6401334there...For above two commits, also
b296821a7c42is required. And after backport, smack still crashed because setxattr. To fix it,5930122683dfand3767e255b390are also required.
Quoted 7 lines
Quoted 3 lines
By the way, does no one have met this kind getxattr crash issue with selinux from 3.18.y?
I have checked with selinux, and it is confirmed that there is no crash because
selinux_d_instantiate()has null check for inode. So, it is only security smack issue.
So are the 5 patches you sent ok to apply to the 3.18-stable tree? Or do we need to do something else?
thanks,
greg k-h
Quoted 52 lines · Greg Kroah-Hartman
Quoted 51 lines · Seung-Woo Kim
Quoted 49 lines · Seung-Woo Kim
Quoted 32 lines · Al Viro
Quoted 31 lines · Linus Torvalds
Quoted 17 lines · Seung-Woo Kim
I think the commit itself is required. Simple, but not reliable, workaround fix is like below:
fs/dcache.c +2
-0@@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode) BUG_ON(!hlist_unhashed(&entry->d_u.d_alias));BUG_ON (!inode);lockdep_annotate_inode_mutex_key (inode); +/* WORKAROUND for calling security_d_instantiate() */ + entry->d_inode = inode;security_d_instantiate (entry, inode);spin_lock (&inode->i_lock);Quoted 1 line
__d_instantiate(entry, inode);Ugh. That looks horrible even if it might avoid the oops.
I think a much better solution is to back-port commit
b296821a7c42("xattr_handler: pass dentry and inode as separate arguments of ->get()") to older kernels. Then the inode is passed down all the way, and you don't have people try to get it from the (not yet initialized) dentry.But there might be other parts missing too, and I didn't look at how easy/painful that backport would be.
Quoted 8 lines
Quoted 6 lines
Al - comments? This is all because of commit
1e2e547a93a0("do d_instantiate/unlock_new_inode combinations safely") being marked for stable, and various cases ofsecurity_d_instantiate()calling down to getxattr. Which used to not get the inode at all, so those older kernels used_inode(dentry), which doesn't work in this path sincedentry->d_inodehasn't been instantiated yet..You also want
b96809173e94andce23e6401334there...For above two commits, also
b296821a7c42is required. And after backport, smack still crashed because setxattr. To fix it,5930122683dfand3767e255b390are also required.By the way, does no one have met this kind getxattr crash issue with selinux from 3.18.y?
Quoted 7 lines
Quoted 3 lines
I have checked with selinux, and it is confirmed that there is no crash because
selinux_d_instantiate()has null check for inode. So, it is only security smack issue.So are the 5 patches you sent ok to apply to the 3.18-stable tree? Or do we need to do something else?
Those 5 patches are fine in my smack environment. I have not tested all the file systems in run-time except ext2/4 and I only tested build for those file systems.
Best Regards,
- Seung-Woo Kim
Quoted 5 lines
thanks,
greg k-h