3.2.102-rc1 review
Subsystems (7)
cover 3.2.102-rc1 review
This is the start of the stable review cycle for the 3.2.102 release. There are 153 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu May 31 23:00:00 UTC 2018. Anything received after that time might be too late.
All the patches have also been committed to the linux-3.2.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git . A shortlog and diffstat can be found below.
Ben.
-------------
Adam Goode (1):
ALSA: seq: correctly detect input buffer overflow
[21fd3e956ee8a307a06bc6e095f5767a00eb2a7e]
Alan Stern (1):
USB: OHCI: Fix race between ED unlink and URB submission
[7d8021c967648accd1b78e5e1ddaad655cd2c61f]
Alex Chen (1):
ocfs2: subsystem.su_mutex is required while accessing the item->ci_parent
[853bc26a7ea39e354b9f8889ae7ad1492ffa28d2]Alexander Potapenko (1):
netlink: make sure nladdr has correct size in netlink_connect()
[7880287981b60a6808f39f297bb66936e8bdf57a]
Alexey Kodanev (2):
dccp: check sk for closed state in dccp_sendmsg()
[67f93df79aeefc3add4e4b31a752600f834236e2]
sctp: verify size of a new chunk in _sctp_make_chunk()
[07f2c7ab6f8d0a7e7c5764c4e6cc9c52951b9d9c]
Aman Deep (1):
usb: ohci: Proper handling of ed_rm_list to handle race condition between usb_kill_urb() and finish_unlinks()
[46408ea558df13b110e0866b99624384a33bdeba]
Andy Lutomirski (1):
x86/entry/64: Don't use IST entry for #BP stack
[d8ba61ba58c88d5207c1ba2f7d9a2280e7d03be9]
Anna-Maria Gleixner (1):
hrtimer: Ensure POSIX compliance (relative CLOCK_REALTIME hrtimers)
[48d0c9becc7f3c66874c100c126459a9da0fdced]
Arnd Bergmann (1):
scsi: fas216: fix sense buffer initialization
[96d5eaa9bb74d299508d811d865c2c41b38b0301]
Bart Van Assche (1):
pktcdvd: Fix pkt_setup_dev() error path
[5a0ec388ef0f6e33841aeb810d7fa23f049ec4cd]
Bastian Stender (1):
mmc: block: fix updating ext_csd caches on ioctl call
[e74ef2194b41ba5e511fab29fe5ff00e72d2f42a]
Ben Crocker (1):
drm/radeon: insist on 32-bit DMA for Cedar on PPC64/PPC64LE
[2c83029cda55a5e7665c7c6326909427d6a01350]
Benjamin Poirier (1):
e1000e: Fix check_for_link return value with autoneg off
[4e7dc08e57c95673d2edaba8983c3de4dd1f65f5]
Chenjie (1):
mm/madvise.c: fix madvise() infinite loop under special circumstances
[6ea8d958a2c95a1d514015d4e29ba21a8c0a1a91]
Chien Tin Tung (1):
RDMA/ucma: Correct option size check using optlen
[5f3e3b85cc0a5eae1c46d72e47d3de7bf208d9e2]
Christophe JAILLET (1):
media: bt8xx: Fix err 'bt878_probe()'
[45392ff6881dbe56d41ef0b17c2e576065f8ffa1]Clay McClure (1):
ubi: Fix race condition between ubi volume creation and udev
[a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6]
Colin Ian King (1):
scsi: aacraid: remove redundant setting of variable c
[91814744646351a470f256fbcb853fb5a7229a9f]
Cong Wang (2):
netfilter: ipt_CLUSTERIP: fix a refcount bug in clusterip_config_find_get()
[db93a3632b0f8773a3899e04a3a3e0aa7a26eb46]
netfilter: xt_RATEEST: acquire xt_rateest_mutex for hash insert
[7dc68e98757a8eccf8ca7a53a29b896f1eef1f76]
Corentin Labbe (1):
powerpc/pseries: Add empty update_numa_cpu_lookup_table() for NUMA=n
[c1e150ceb61e4a585bad156da15c33bfe89f5858]
Dan Carpenter (8):
ALSA: pcm: potential uninitialized return values
[5607dddbfca774fb38bffadcb077fe03aa4ac5c6]
ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
[123af9043e93cb6f235207d260d50f832cdb5439]
ASoC: nuc900: Fix a loop timeout test
[65a12b3aafed5fc59f4ce41b22b752b1729e6701]
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
[7ad81482cad67cbe1ec808490d1ddfc420c42008]
ath9k_htc: Add a sanity check in ath9k_htc_ampdu_action()
[413fd2f5c0233d3cde391679b967c1f14cd2cb27]
cdrom: information leak in cdrom_ioctl_media_changed()
[9de4ee40547fd315d4a0ed1dd15a2fa3559ad707]
media: cpia2: Fix a couple off by one bugs
[d5ac225c7d64c9c3ef821239edc035634e594ec9]
staging: ncpfs: memory corruption in ncp_read_kernel()
[4c41aa24baa4ed338241d05494f2c595c885af8f]
Danilo Krummrich (1):
usb: quirks: add control message delay for 1b1c:1b20
[cb88a0588717ba6c756cb5972d75766b273a6817]
Darrick J. Wong (1):
ext4: fix block bitmap validation when bigalloc, ^flex_bg
[e674e5cbd0942b42a12106ac0be8330f4301bef4]
David Rientjes (1):
kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
[88913bd8ea2a75d7e460a4bed5f75e1c32660d7e]
Dmitry Vyukov (1):
netfilter: ipt_CLUSTERIP: fix out-of-bounds accesses in clusterip_tg_check()
[1a38956cce5eabd7b74f94bab70265e4df83165e]
Eran Ben Elisha (1):
net/mlx4_en: Fix mixed PFC and Global pause user control requests
[6e8814ceb7e8f468659ef9253bd212c07ae19584]
Eric Biggers (6):
crypto: cryptd - pass through absence of ->setkey()
[841a3ff329713f796a63356fef6e2f72e4a3f6a3]
crypto: hash - annotate algorithms taking optional key
[a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e]
crypto: hash - introduce crypto_hash_alg_has_setkey()
[cd6ed77ad5d223dc6299fb58f62e0f5267f7e2ba]
crypto: hash - prevent using keyed hashes without setting key
[9fa68f620041be04720d0cbfb1bd3ddfc6310b24]
libata: fix length validation of ATAPI-relayed SCSI commands
[058f58e235cbe03e923b30ea7c49995a46a8725f]
libata: remove WARN() for DMA or PIO command without data
[9173e5e80729c8434b8d27531527c5245f4a5594]Eric Dumazet (3):
l2tp: do not accept arbitrary sockets
[17cfe79a65f98abe535261856c5aef14f306dff7]
net: igmp: add a missing rcu locking section
[e7aadb27a5415e8125834b84a74477bfbee4eff5]
netfilter: IDLETIMER: be syzkaller friendly
[cfc2c740533368b96e2be5e0a4e8c3cace7d9814]
Eric W. Biederman (4):
fs: Teach path_connected to handle nfs filesystems with multiple roots.
[95dd77580ccd66a0da96e6d4696945b8cea39431]
mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy
[6ac1dc736b323011a55ecd1fc5897c24c4f77cbd]
signal/openrisc: Fix do_unaligned_access to send the proper signal
[500d58300571b6602341b041f97c082a461ef994]
signal/sh: Ensure si_signo is initialized in do_divide_error
[0e88bb002a9b2ee8cc3cc9478ce2dc126f849696]
Erik Veijola (1):
ALSA: usb-audio: Add a quirck for B&W PX headphones
[240a8af929c7c57dcde28682725b29cf8474e8e5]
Ernesto A . Fernández (1):
ext4: correct documentation for grpid mount option
[9f0372488cc9243018a812e8cfbf27de650b187b]
Eugene Syromiatnikov (1):
s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
[6dd0d2d22aa363fec075cb2577ba273ac8462e94]
Felix Kuehling (1):
drm/ttm: Don't add swapped BOs to swap-LRU list
[fd5002d6a3c602664b07668a24df4ef7a43bf078]
Florian Fainelli (1):
MIPS: TXX9: use IS_ENABLED() macro
[b33b44073734842ec0c75d376c40d0471d6113ff]
Florian Westphal (5):
netfilter: bridge: ebt_among: add missing match size checks
[c4585a2823edf4d1326da44d1524ecbfda26bb37]
netfilter: bridge: ebt_among: add more missing match size checks
[c8d70a700a5b486bfa8e5a7d33d805389f6e59f9]
netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
[b71812168571fa55e44cdd0254471331b9c4c4c6]
netfilter: ebtables: fix erroneous reject of last rule
[932909d9b28d27e807ff8eecb68c7748f6701628]
xfrm_user: uncoditionally validate esn replay attribute struct
[d97ca5d714a5334aecadadf696875da40f1fbf3e]
Greg Kroah-Hartman (1):
USB: serial: pl2303: new device id for Chilitag
[d08dd3f3dd2ae351b793fc5b76abdbf0fd317b12]
Greg Kurz (1):
9p/trans_virtio: discard zero-length reply
[26d99834f89e76514076d9cd06f61e56e6a509b8]
Hangbin Liu (1):
l2tp: fix missing print session offset info
[820da5357572715c6235ba3b3daa2d5b43a1198f]
Hans de Goede (5):
USB: cdc-acm: Do not log urb submission errors on disconnect
[f0386c083c2ce85284dc0b419d7b89c8e567c09f]
ahci: Add PCI-id for the Highpoint Rocketraid 644L card
[28b2182dad43f6f8fcbd167539a26714fd12bd64]
libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs
[62ac3f7305470e3f52f159de448bc1a771717e88]
libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs
[9c7be59fc519af9081c46c48f06f2b8fadf55ad8]
libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions
[3bf7b5d6d017c27e0d3b160aafb35a8e7cfeda1f]
Ivan Vecera (1):
net/mlx4_en: do not ignore autoneg in mlx4_en_set_pauseparam()
[278d436a476f69fc95d5c82bf61b6c2d02f4d44e]
Jack Stocker (1):
Add delay-init quirk for Corsair K70 RGB keyboards
[7a1646d922577b5b48c0d222e03831141664bb59]
Jake Daryll Obina (1):
jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
[5bdd0c6f89fba430e18d636493398389dadc3b17]
Jakub Kicinski (1):
net: fix race on decreasing number of TX queues
[ac5b70198adc25c73fba28de4f78adcee8f6be0b]
James Chapman (2):
l2tp: don't use inet_shutdown on ppp session destroy
[225eb26489d05c679a4c4197ffcb81c81e9dcaf4]
l2tp: fix race in pppol2tp_release with session object destroy
[d02ba2a6110c530a32926af8ad441111774d2893]
James Hogan (1):
MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}
[5f2483eb2423152445b39f2db59d372f523e664e]Jan Beulich (1):
x86/mm: Fix {pmd,pud}_{set,clear}_flags()
[842cef9113c2120f74f645111ded1e020193d84c]Jason Gunthorpe (1):
sctp: Fix mangled IPv4 addresses on a IPv6 listening socket
[9302d7bb0c5cd46be5706859301f18c137b2439f]
Jason Yan (2):
scsi: libsas: fix error when getting phy events
[2b23d9509fd7174b362482cf5f3b5f9a2265bc33]
scsi: libsas: fix memory leak in sas_smp_get_phy_events()
[4a491b1ab11ca0556d2fda1ff1301e862a2d44c4]
Jean Delvare (2):
firmware/dmi_scan: constify strings
[ffbbb96dd7570b9aafd426cd77a7ee03d224cabf]
firmware: dmi_scan: Fix handling of empty DMI strings
[a7770ae194569e96a93c48aceb304edded9cc648]
Jeremy Boone (1):
tpm_tis: fix potential buffer overruns caused by bit glitches on the bus
[6bb320ca4a4a7b5b3db8c8d7250cc40002046878]
Jia-Ju Bai (1):
USB: serial: io_edgeport: fix possible sleep-in-atomic
[c7b8f77872c73f69a16528a9eb87afefcccdc18b]
Johannes Berg (1):
regulatory: add NUL to request alpha2
[657308f73e674e86b60509a430a46e569bf02846]
Julia Lawall (1):
USB: usbmon: remove assignment from IS_ERR argument
[46c236dc7d1212d7417e6fb0317f91c44c719322]
Julian Wiedmann (2):
s390/qeth: fix SETIP command handling
[1c5b2216fbb973a9410e0b06389740b5c1289171]
s390/qeth: free netdevice when removing a card
[6be687395b3124f002a653c1a50b3260222b3cd7]
K.Prasad (1):
perf/hwpb: Invoke __perf_event_disable() if interrupts are already disabled
[500ad2d8b01390c98bc6dce068bccfa9534b8212]
Kai-Heng Feng (2):
libata: disable LPM for Crucial BX100 SSD 500GB drive
[b17e5729a630d8326a48ec34ef02e6b4464a6aef]
xhci: Fix front USB ports on ASUS PRIME B350M-A
[191edc5e2e515aab1075a3f0ef23599e80be5f59]
Kirill Marinushkin (1):
ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit
[a6618f4aedb2b60932d766bd82ae7ce866e842aa]
Leon Romanovsky (7):
RDMA/ucma: Check that device exists prior to accessing it
[c8d3bcbfc5eab3f01cf373d039af725f3b488813]
RDMA/ucma: Check that device is connected prior to access it
[4b658d1bbc16605330694bb3ef2570c465ef383d]
RDMA/ucma: Check that user doesn't overflow QP state
[a5880b84430316e3e1c1f5d23aa32ec6000cc717]
RDMA/ucma: Ensure that CM_ID exists prior to access it
[e8980d67d6017c8eee8f9c35f782c4bd68e004c9]
RDMA/ucma: Fix access to non-initialized CM_ID object
[7688f2c3bbf55e52388e37ac5d63ca471a7712e1]
RDMA/ucma: Fix use-after-free access in ucma_close
[ed65a4dc22083e73bac599ded6a262318cad7baf]
RDMA/ucma: Limit possible option size
[6a21dfc0d0db7b7e0acedce67ca533a6eb19283c]
Linus Torvalds (2):
perf/hwbp: Simplify the perf-hwbp code, fix documentation
[f67b15037a7a50c57f72e69a6d59941ad90a0f0f]
tty: vt: fix up tabstops properly
[f1869a890cdedb92a3fab969db5d0fd982850273]
Linus Walleij (1):
mtd: jedec_probe: Fix crash in jedec_read_mfr()
[87a73eb5b56fd6e07c8e499fe8608ef2d8912b82]
Liu Bo (1):
Btrfs: fix extent state leak from tree log
[55237a5f2431a72435e3ed39e4306e973c0446b7]
Lukas Czerner (1):
ext4: fix bitmap position validation
[22be37acce25d66ecf6403fc8f44df9c5ded2372]
Marc Kleine-Budde (1):
slip: sl_alloc(): remove unused parameter "dev_t line"
[936e5d8bdfa72577e28ea671d9e2ee4fef0d6b3e]
Masami Hiramatsu (1):
tracing: probeevent: Fix to support minus offset from symbol
[c5d343b6b7badd1f5fe0873eff2e8d63a193e732]
Matt Redfearn (1):
MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
[0cde5b44a30f1daaef1c34e08191239dc63271c4]
Matthew Wilcox (1):
cifs: Fix missing put_xid in cifs_file_strict_mmap
[f04a703c3d613845ae3141bfaf223489de8ab3eb]
Matthias Schiffer (1):
batman-adv: fix packet checksum in receive path
[abd6360591d3f8259f41c34e31ac4826dfe621b8]
Mauro Carvalho Chehab (1):
media: cxusb, dib0700: ignore XC2028_I2C_FLUSH
[9893b905e743ded332575ca04486bd586c0772f7]Mel Gorman (1):
mm: pin address_space before dereferencing it while isolating an LRU page
[69d763fc6d3aee787a3e8c8c35092b4f4960fa5d]
Michel Dänzer (1):
drm/radeon: Don't turn off DP sink when disconnected
[2681bc79eeb640562c932007bfebbbdc55bf6a7d]
Mike Kravetz (2):
hugetlbfs: check for pgoff value overflow
[63489f8e821144000e0bdca7e65a8d1cc23a7ee7]
hugetlbfs: fix offset overflow in hugetlbfs mmap
[045c7a3f53d9403b62d396b6d051c4be5044cdb4]
Mikulas Patocka (2):
alpha: fix crash if pthread_create races with signal delivery
[21ffceda1c8b3807615c40d440d7815e0c85d366]
alpha: fix reboot on Avanti platform
[55fc633c41a08ce9244ff5f528f420b16b1e04d6]
Mulhern (1):
dm thin: fix documentation relative to low water mark threshold
[9b28a1102efc75d81298198166ead87d643a29ce]
Nathan Fontenot (1):
powerpc/numa: Invalidate numa_cpu_lookup_table on cpu remove
[1d9a090783bef19fe8cdec878620d22f05191316]
Nicolas Dichtel (2):
netlink: avoid a double skb free in genlmsg_mcast()
[02a2385f37a7c6594c9d89b64c4a1451276f08eb]
netlink: ensure to loop over all netns in genlmsg_multicast_allns()
[cb9f7a9a5c96a773bbc9c70660dc600cfff82f82]
Nicolas Pitre (1):
console/dummy: leave .con_font_get set to NULL
[724ba8b30b044aa0d94b1cd374fc15806cdd6f18]
Oliver Neukum (1):
CDC-ACM: apply quirk for card reader
[df1cc78a52491f71d8170d513d0f6f114faa1bda]
Paolo Abeni (5):
dn_getsockoptdecnet: move nf_{get/set}sockopt outside sock lock
[dfec091439bb2acf763497cfc58f2bdfc67c56b7]
netfilter: drop outermost socket lock in getsockopt()
[01ea306f2ac2baff98d472da719193e738759d93]
netfilter: nat: cope with negative port range
[db57ccf0f2f4624b4c4758379f8165277504fbd7]
netfilter: on sockopt() acquire sock lock only in the required scope
[3f34cfae1238848fd53f25e5c8fd59da57901f4b]
netfilter: x_tables: fix missing timer initialization in xt_LED
[10414014bc085aac9f787a5890b33b5605fbcfc4]
Pete Zaitcev (1):
usb: usbmon: Read text within supplied buffer size
[a5f596830e27e15f7a0ecd6be55e433d776986d8]
Peter Malone (1):
fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
[250c6c49e3b68756b14983c076183568636e2bde]
Raghava Aditya Renukunta (1):
scsi: aacraid: Fix udev inquiry race condition
[f4e8708d3104437fd7716e957f38c265b0c509ef]
Rasmus Villemoes (1):
nospec: Allow index argument to have const-qualified type
[b98c6a160a057d5686a8c54c79cc6c8c94a7d0c8]
Seunghun Han (1):
x86/MCE: Serialize sysfs changes
[b3b7c4795ccab5be71f080774c45bbbcc75c2aaf]
Stefan Roese (1):
ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()
[9066ae7ff5d89c0b5daa271e2d573540097a94fa]
Stephan Mueller (1):
crypto: af_alg - whitelist mask and type
[bb30b8848c85e18ca7e371d0a869e94b3e383bdf]
Takashi Iwai (7):
ALSA: aloop: Fix access to not-yet-ready substream via cable
[8e6b1a72a75bb5067ccb6b56d8ca4aa3a300a64e]
ALSA: aloop: Sync stale timer before release
[67a01afaf3d34893cf7d2ea19b34555d6abb7cb0]
ALSA: seq: Clear client entry before deleting else at closing
[a2ff19f7b70118ced291a28d5313469914de451b]
ALSA: seq: Don't allow resizing pool in use
[d85739367c6d56e475c281945c68fdb05ca74b4c]
ALSA: seq: Fix possible UAF in snd_seq_check_queue()
[d0f833065221cbfcbadf19fd4102bcfa9330006a]
ALSA: seq: Fix racy pool initializations
[d15d662e89fc667b90cd294b0eb45694e33144da]
ALSA: seq: More protection for concurrent write and ioctl races
[7bd80091567789f1c0cb70eb4737aac8bcd2b6b9]
Tejun Heo (1):
tty: make n_tty_read() always abort if hangup is in progress
[28b0f8a6962a24ed21737578f3b1b07424635c9e]
Theodore Ts'o (2):
ext4: add validity checks for bitmap block numbers
[7dac4a1726a9c64a517d595c40e95e2d0d135f6f]
ext4: fail ext4_iget for root directory if unallocated
[8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44]
Thinh Nguyen (1):
usb: dwc3: gadget: Set maxpacket size for ep0 IN
[6180026341e852a250e1f97ebdcf71684a3c81b9]
Thomas Gleixner (1):
posix-timers: Protect posix clock array access against speculation
[19b558db12f9f4e45a22012bae7b4783e62224da]
Tony Luck (1):
x86/MCE: Save microcode revision in machine check records
[fa94d0c6e0f3431523f5701084d799c77c7d4a4f]
Tyrel Datwyler (1):
scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info
[c39813652700f3df552b6557530f1e5f782dbe2f]
Ulrich Hecht (1):
serial: sh-sci: prevent lockup on full TTY buffers
[7842055bfce4bf0170d0f61df8b2add8399697be]
Vinicius Costa Gomes (1):
skbuff: Fix not waking applications when errors are enqueued
[6e5d58fdc9bedd0255a8781b258f10bbdc63e975]
Wang Nan (1):
x86/traps: Enable DEBUG_STACK after cpu_init() for TRAP_DB/BP
[b4d8327024637cb2a1f7910dcb5d0ad7a096f473]
Xin Long (2):
bonding: process the err returned by dev_set_allmulti properly in bond_enslave
[9f5a90c107741b864398f4ac0014711a8c1d8474]
bridge: check brport attr show in brport_show
[1b12580af1d0677c3c3a19e35bfe5d59b03f737f]
Yisheng Xie (1):
mm/mempolicy.c: avoid use uninitialized preferred_node
[8970a63e965b43288c4f5f40efbc2bbf80de7f16]
Zhang Bo (1):
Input: matrix_keypad - fix race when disabling interrupts
[ea4f7bd2aca9f68470e9aac0fc9432fd180b1fe7]
Zhouyi Zhou (1):
ext4: save error to disk in __ext4_grp_locked_error()
[06f29cc81f0350261f59643a505010531130eea0]
Documentation/device-mapper/thin-provisioning.txt | 8 +- Documentation/filesystems/ext4.txt | 2 +- Makefile | 4 +- arch/alpha/kernel/pci_impl.h | 3 +- arch/alpha/kernel/process.c | 12 +-- arch/mips/boot/compressed/Makefile | 6 +- arch/mips/txx9/generic/setup.c | 12 +-- arch/mips/txx9/generic/setup_tx4939.c | 2 +- arch/mips/txx9/rbtx4939/setup.c | 11 +- arch/mn10300/mm/misalignment.c | 2 +- arch/openrisc/kernel/traps.c | 10 +- arch/powerpc/include/asm/topology.h | 8 ++ arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 + arch/s390/kernel/compat_linux.c | 8 +- arch/sh/kernel/traps_32.c | 3 +- arch/x86/crypto/crc32c-intel.c | 1 + arch/x86/include/asm/mce.h | 4 + arch/x86/include/asm/pgtable.h | 4 +- arch/x86/include/asm/pgtable_types.h | 5 + arch/x86/kernel/cpu/mcheck/mce.c | 26 ++++- arch/x86/kernel/entry_64.S | 2 +- arch/x86/kernel/traps.c | 20 +++- crypto/af_alg.c | 5 + crypto/ahash.c | 33 +++++- crypto/algif_hash.c | 54 +++------- crypto/crc32c.c | 1 + crypto/cryptd.c | 6 +- crypto/shash.c | 25 ++++- drivers/ata/ahci.c | 4 +- drivers/ata/libata-core.c | 13 ++- drivers/ata/libata-scsi.c | 4 +- drivers/block/pktcdvd.c | 4 +- drivers/cdrom/cdrom.c | 2 +- drivers/char/tpm/tpm_tis.c | 5 +- drivers/firmware/dmi_scan.c | 30 +++--- drivers/gpu/drm/radeon/radeon_connectors.c | 31 +++--- drivers/gpu/drm/radeon/radeon_device.c | 4 + drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/hid/hid-roccat-kovaplus.c | 2 + drivers/infiniband/core/cma.c | 3 + drivers/infiniband/core/ucma.c | 33 ++++-- drivers/input/keyboard/matrix_keypad.c | 4 +- drivers/media/dvb/bt8xx/bt878.c | 3 +- drivers/media/dvb/dvb-usb/cxusb.c | 2 + drivers/media/dvb/dvb-usb/dib0700_devices.c | 1 + drivers/media/video/cpia2/cpia2_v4l.c | 4 +- drivers/mmc/card/block.c | 21 ++++ drivers/mtd/chips/jedec_probe.c | 2 + drivers/mtd/ubi/vmt.c | 15 ++- drivers/net/bonding/bond_main.c | 5 +- drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 +- drivers/net/ethernet/intel/e1000e/lib.c | 6 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 27 +++-- drivers/net/ethernet/mellanox/mlx4/en_main.c | 4 +- drivers/net/slip/slip.c | 4 +- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 + drivers/s390/net/qeth_core.h | 5 + drivers/s390/net/qeth_core_main.c | 16 +-- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- drivers/scsi/aacraid/aachba.c | 22 ++-- drivers/scsi/arm/fas216.c | 2 +- drivers/scsi/ibmvscsi/ibmvfc.h | 2 +- drivers/scsi/libsas/sas_expander.c | 3 +- drivers/tty/n_tty.c | 6 ++ drivers/tty/serial/sh-sci.c | 2 + drivers/tty/vt/vt.c | 8 +- drivers/usb/class/cdc-acm.c | 5 +- drivers/usb/core/message.c | 4 + drivers/usb/core/quirks.c | 6 +- drivers/usb/dwc3/gadget.c | 2 + drivers/usb/host/ohci-q.c | 24 ++--- drivers/usb/host/xhci-pci.c | 3 + drivers/usb/host/xhci.c | 3 + drivers/usb/host/xhci.h | 1 + drivers/usb/mon/mon_text.c | 124 ++++++++++++++-------- drivers/usb/serial/io_edgeport.c | 1 - drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 1 + drivers/video/console/dummycon.c | 1 - drivers/video/sbuslib.c | 4 +- fs/btrfs/tree-log.c | 5 +- fs/cifs/file.c | 26 +++-- fs/ext4/balloc.c | 25 ++++- fs/ext4/ialloc.c | 7 ++ fs/ext4/inode.c | 7 ++ fs/ext4/super.c | 1 + fs/hugetlbfs/inode.c | 26 ++++- fs/jffs2/fs.c | 1 - fs/namei.c | 5 +- fs/ncpfs/ncplib_kernel.c | 4 + fs/nfs/super.c | 2 + fs/ocfs2/cluster/nodemanager.c | 63 +++++++++-- include/crypto/hash.h | 34 ++++-- include/crypto/internal/hash.h | 2 + include/linux/crypto.h | 8 ++ include/linux/fs.h | 4 + include/linux/nospec.h | 3 +- include/linux/perf_event.h | 2 + include/linux/usb/audio.h | 4 +- include/linux/usb/quirks.h | 3 + include/net/regulatory.h | 2 +- include/net/sctp/sctp.h | 7 +- kernel/events/core.c | 2 +- kernel/events/hw_breakpoint.c | 41 +++---- kernel/hrtimer.c | 7 +- kernel/posix-timers.c | 15 ++- kernel/relay.c | 2 +- kernel/trace/trace_kprobe.c | 11 +- mm/hugetlb.c | 9 ++ mm/madvise.c | 2 +- mm/mempolicy.c | 3 + mm/vmscan.c | 14 ++- net/9p/trans_virtio.c | 3 +- net/batman-adv/soft-interface.c | 7 +- net/bridge/br_sysfs_if.c | 3 + net/bridge/netfilter/ebt_among.c | 55 +++++++++- net/bridge/netfilter/ebtables.c | 17 ++- net/core/dev.c | 12 ++- net/core/skbuff.c | 4 +- net/dccp/proto.c | 5 + net/decnet/af_decnet.c | 62 ++++++----- net/ipv4/igmp.c | 4 + net/ipv4/ip_sockglue.c | 21 +--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 24 ++++- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 6 +- net/ipv4/netfilter/nf_nat_proto_common.c | 7 +- net/ipv6/ipv6_sockglue.c | 27 ++--- net/l2tp/l2tp_core.c | 8 +- net/l2tp/l2tp_netlink.c | 2 + net/l2tp/l2tp_ppp.c | 62 +++++------ net/netfilter/xt_IDLETIMER.c | 9 +- net/netfilter/xt_LED.c | 12 +-- net/netfilter/xt_RATEEST.c | 22 +++- net/netlink/af_netlink.c | 3 + net/netlink/genetlink.c | 12 ++- net/sctp/sm_make_chunk.c | 8 +- net/xfrm/xfrm_user.c | 21 ++-- sound/core/oss/pcm_oss.c | 4 +- sound/core/pcm_native.c | 2 +- sound/core/seq/seq_clientmgr.c | 29 +++-- sound/core/seq/seq_fifo.c | 4 +- sound/core/seq/seq_memory.c | 14 ++- sound/core/seq/seq_memory.h | 3 +- sound/core/seq/seq_prioq.c | 27 ++--- sound/core/seq/seq_prioq.h | 6 +- sound/core/seq/seq_queue.c | 28 ++--- sound/drivers/aloop.c | 17 ++- sound/soc/au1x/ac97c.c | 6 +- sound/soc/nuc900/nuc900-ac97.c | 4 +- sound/usb/quirks-table.h | 47 ++++++++ 151 files changed, 1140 insertions(+), 584 deletions(-)
Signature · 2 lines
Ben Hutchings The program is absolutely right; therefore, the computer must be wrong.
PATCH 1/153 sctp: Fix mangled IPv4 addresses on a IPv6 listening socket
3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
commit 9302d7bb0c5cd46be5706859301f18c137b2439f upstream.
sctp_v4_map_v6 was subtly writing and reading from members of a union in a way the clobbered data it needed to read before it read it.
Zeroing the v6 flowinfo overwrites the v4 sin_addr with 0, meaning that every place that calls sctp_v4_map_v6 gets ::ffff:0.0.0.0 as the result.
Reorder things to guarantee correct behaviour no matter what the union layout is.
This impacts user space clients that open an IPv6 SCTP socket and receive IPv4 connections. Prior to 299ee user space would see a sockaddr with AF_INET and a correct address, after 299ee the sockaddr is AF_INET6, but the address is wrong.
--- include/net/sctp/sctp.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
include/net/sctp/sctp.h +5 -2
@@ -704,11 +704,14 @@ static inline void sctp_v6_map_v4(union/* Map v4 address to v4-mapped v6 address */ static inline void sctp_v4_map_v6 (union sctp_addr *addr) { +__be16 port; + + port = addr->v4.sin_port; + addr->v6.sin6_addr.s6_addr32[3 ] = addr->v4.sin_addr.s_addr; + addr->v6.sin6_port = port; addr->v6.sin6_family =AF_INET6 ; addr->v6.sin6_flowinfo =0 ; addr->v6.sin6_scope_id =0 ; - addr->v6.sin6_port = addr->v4.sin_port; - addr->v6.sin6_addr.s6_addr32[3 ] = addr->v4.sin_addr.s_addr; addr->v6.sin6_addr.s6_addr32[0 ] =0 ; addr->v6.sin6_addr.s6_addr32[1 ] =0 ; addr->v6.sin6_addr.s6_addr32[2 ] =htonl (0x0000ffff );
PATCH 2/153 mm/madvise.c: fix madvise() infinite loop under special circumstances
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: chenjie <[email protected]>
commit 6ea8d958a2c95a1d514015d4e29ba21a8c0a1a91 upstream.
MADVISE_WILLNEED has always been a noop for DAX (formerly XIP) mappings. Unfortunately madvise_willneed() doesn't communicate this information properly to the generic madvise syscall implementation. The calling convention is quite subtle there. madvise_vma() is supposed to either return an error or update &prev otherwise the main loop will never advance to the next vma and it will keep looping for ever without a way to get out of the kernel.
It seems this has been broken since introduction. Nobody has noticed because nobody seems to be using MADVISE_WILLNEED on these DAX mappings.
---
mm/madvise.c +1 -1
@@ -128,6 +128,7 @@ static long madvise_willneed(struct vm_a {struct file *file = vma->vm_file; + *prev = vma;if (!file)return -EBADF ;
@@ -136,7 +137,6 @@ static long madvise_willneed(struct vm_areturn 0 ; } - *prev = vma; start = ((start - vma->vm_start) >>PAGE_SHIFT ) + vma->vm_pgoff;if (end > vma->vm_end) end = vma->vm_end;
PATCH 3/153 ocfs2: subsystem.su_mutex is required while accessing the item->ci_parent
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: alex chen <[email protected]>
commit 853bc26a7ea39e354b9f8889ae7ad1492ffa28d2 upstream.
The subsystem.su_mutex is required while accessing the item->ci_parent, otherwise, NULL pointer dereference to the item->ci_parent will be triggered in the following situation:
add node delete nodesys_write
vfs_write
configfs_write_file
o2nm_node_store
o2nm_node_local_write
do_rmdir
vfs_rmdir
configfs_rmdir
mutex_lock(&subsys->su_mutex);
unlink_obj
item->ci_group = NULL;
item->ci_parent = NULL;
to_o2nm_cluster_from_node
node->nd_item.ci_parent->ci_parent
BUG since of NULL pointer dereference to nd_item.ci_parentMoreover, the o2nm_cluster also should be protected by the subsystem.su_mutex.
--- fs/ocfs2/cluster/nodemanager.c | 63 +++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-)
fs/ocfs2/cluster/nodemanager.c +55 -8
@@ -41,6 +41,9 @@ char *o2nm_fence_method_desc[O2NM_FENCE_ "panic", /* O2NM_FENCE_PANIC */ }; +static inline void o2nm_lock_subsystem (void ); +static inline void o2nm_unlock_subsystem (void ); +struct o2nm_node *o2nm_get_node_by_num (u8 node_num) {struct o2nm_node *node =NULL ;
@@ -182,7 +185,10 @@ static struct o2nm_cluster *to_o2nm_clus {/* through the first node_set .parent * mycluster/nodes/mynode == o2nm_cluster->o2nm_node_group->o2nm_node */ -return to_o2nm_cluster (node->nd_item.ci_parent->ci_parent); +if (node->nd_item.ci_parent) +return to_o2nm_cluster (node->nd_item.ci_parent->ci_parent); +else +return NULL ; }enum {
@@ -195,7 +201,7 @@ enum {static ssize_t o2nm_node_num_write (struct o2nm_node *node,const char *page,size_t count) { -struct o2nm_cluster *cluster =to_o2nm_cluster_from_node (node); +struct o2nm_cluster *cluster;unsigned long tmp;char *p = (char *)page;
@@ -214,6 +220,13 @@ static ssize_t o2nm_node_num_write(struc !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes))return -EINVAL ;/* XXX */ +o2nm_lock_subsystem (); + cluster =to_o2nm_cluster_from_node (node); +if (!cluster) { +o2nm_unlock_subsystem (); +return -EINVAL ; + } +write_lock (&cluster->cl_nodes_lock);if (cluster->cl_nodes[tmp]) p =NULL ;
@@ -223,6 +236,8 @@ static ssize_t o2nm_node_num_write(strucset_bit (tmp, cluster->cl_nodes_bitmap); }write_unlock (&cluster->cl_nodes_lock); +o2nm_unlock_subsystem (); +if (p ==NULL )return -EEXIST ;
@@ -262,7 +277,7 @@ static ssize_t o2nm_node_ipv4_address_wr const char *page, size_t count) { -struct o2nm_cluster *cluster =to_o2nm_cluster_from_node (node); +struct o2nm_cluster *cluster;int ret, i;struct rb_node **p, *parent;unsigned int octets[4 ];
@@ -279,6 +294,13 @@ static ssize_t o2nm_node_ipv4_address_wrbe32_add_cpu (&ipv4_addr, octets[i] << (i *8 )); } +o2nm_lock_subsystem (); + cluster =to_o2nm_cluster_from_node (node); +if (!cluster) { +o2nm_unlock_subsystem (); +return -EINVAL ; + } + ret =0 ;write_lock (&cluster->cl_nodes_lock);if (o2nm_node_ip_tree_lookup (cluster, ipv4_addr, &p, &parent))
@@ -288,6 +310,8 @@ static ssize_t o2nm_node_ipv4_address_wrrb_insert_color (&node->nd_ip_node, &cluster->cl_node_ip_tree); }write_unlock (&cluster->cl_nodes_lock); +o2nm_unlock_subsystem (); +if (ret)return ret;
@@ -304,7 +328,7 @@ static ssize_t o2nm_node_local_read(strustatic ssize_t o2nm_node_local_write (struct o2nm_node *node,const char *page,size_t count) { -struct o2nm_cluster *cluster =to_o2nm_cluster_from_node (node); +struct o2nm_cluster *cluster;unsigned long tmp;char *p = (char *)page;ssize_t ret;
@@ -322,17 +346,26 @@ static ssize_t o2nm_node_local_write(str !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes))return -EINVAL ;/* XXX */ +o2nm_lock_subsystem (); + cluster =to_o2nm_cluster_from_node (node); +if (!cluster) { + ret = -EINVAL ; + goto out; + } +/* the only failure case is trying to set a new local node * when a different one is already set */ if (tmp && tmp == cluster->cl_has_local && - cluster->cl_local_node != node->nd_num) -return -EBUSY ; + cluster->cl_local_node != node->nd_num) { + ret = -EBUSY ; + goto out; + }/* bring up the rx thread if we're setting the new local node. */ if (tmp && !cluster->cl_has_local) { ret =o2net_start_listening (node);if (ret) -return ret; + goto out; } if (!tmp && cluster->cl_has_local &&
@@ -347,7 +380,11 @@ static ssize_t o2nm_node_local_write(str cluster->cl_local_node = node->nd_num; } -return count; + ret = count; + +out: +o2nm_unlock_subsystem (); +return ret; }struct o2nm_node_attribute {
@@ -890,6 +927,16 @@ static struct o2nm_cluster_group o2nm_cl }, }; +static inline void o2nm_lock_subsystem (void ) +{ +mutex_lock (&o2nm_cluster_group.cs_subsys.su_mutex); +} + +static inline void o2nm_unlock_subsystem (void ) +{ +mutex_unlock (&o2nm_cluster_group.cs_subsys.su_mutex); +} +int o2nm_depend_item (struct config_item *item) {return configfs_depend_item (&o2nm_cluster_group.cs_subsys, item);
PATCH 4/153 netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit b71812168571fa55e44cdd0254471331b9c4c4c6 upstream.
We need to make sure the offsets are not out of range of the total size.
Also check that they are in ascending order.
The WARN_ON triggered by syzkaller (it sets panic_on_warn) is changed to also bail out, no point in continuing parsing.
Briefly tested with simple ruleset of
-A INPUT --limit 1/s' --log
plus jump to custom chains using 32bit ebtables binary.
--- net/bridge/netfilter/ebtables.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +12 -1
@@ -2004,7 +2004,9 @@ static int ebt_size_mwt(struct compat_ebif (match_kern) match_kern->match_size = ret; -WARN_ON (type ==EBT_COMPAT_TARGET && size_left); +if (WARN_ON (type ==EBT_COMPAT_TARGET && size_left)) +return -EINVAL ; + match32 = (struct compat_ebt_entry_mwt *) buf; }
@@ -2061,6 +2063,15 @@ static int size_entry_mwt(struct ebt_ent* * offsets are relative to beginning of struct ebt_entry (i.e., 0). */ +for (i =0 ; i <4 ; ++i) { +if (offsets[i] >= *total) +return -EINVAL ; +if (i ==0 ) +continue ; +if (offsets[i-1 ] > offsets[i]) +return -EINVAL ; + } +for (i =0 , j =1 ; j <4 ; j++, i++) {struct compat_ebt_entry_mwt *match32;unsigned int size;
PATCH 5/153 netfilter: ebtables: fix erroneous reject of last rule
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 932909d9b28d27e807ff8eecb68c7748f6701628 upstream.
The last rule in the blob has next_entry offset that is same as total size. This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel.
--- net/bridge/netfilter/ebtables.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +5 -1
@@ -2064,8 +2064,12 @@ static int size_entry_mwt(struct ebt_ent* offsets are relative to beginning of struct ebt_entry (i.e., 0). */ for (i =0 ; i <4 ; ++i) { -if (offsets[i] >= *total) +if (offsets[i] > *total)return -EINVAL ; + +if (i <3 && offsets[i] == *total) +return -EINVAL ; +if (i ==0 )continue ;if (offsets[i-1 ] > offsets[i])
PATCH 6/153 ext4: fail ext4_iget for root directory if unallocated
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44 upstream.
If the root directory has an i_links_count of zero, then when the file system is mounted, then when ext4_fill_super() notices the problem and tries to call iput() the root directory in the error return path, ext4_evict_inode() will try to free the inode on disk, before all of the file system structures are set up, and this will result in an OOPS caused by a NULL pointer dereference.
This issue has been assigned CVE-2018-1092.
https://bugzilla.kernel.org/show_bug.cgi?id=199179
https://bugzilla.redhat.com/show_bug.cgi?id=1560777
[bwh: Backported to 3.2:
- Use EIO instead of EFSCORRUPTED
- Adjust context]
---
fs/ext4/inode.c +7 -0
@@ -3902,6 +3902,13 @@ struct inode *ext4_iget(struct super_bloif (ret <0 ) goto bad_inode; raw_inode =ext4_raw_inode (&iloc); + +if ((ino ==EXT4_ROOT_INO ) && (raw_inode->i_links_count ==0 )) { +EXT4_ERROR_INODE (inode,"root inode unallocated" ); + ret = -EIO ; + goto bad_inode; + } + inode->i_mode =le16_to_cpu (raw_inode->i_mode); inode->i_uid = (uid_t )le16_to_cpu (raw_inode->i_uid_low); inode->i_gid = (gid_t )le16_to_cpu (raw_inode->i_gid_low);
PATCH 7/153 ext4: fix block bitmap validation when bigalloc, ^flex_bg
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
commit e674e5cbd0942b42a12106ac0be8330f4301bef4 upstream.
On a bigalloc,^flex_bg filesystem, the ext4_valid_block_bitmap function fails to convert from blocks to clusters when spot-checking the validity of the bitmap block that we've just read from disk. This causes ext4 to think that the bitmap is garbage, which results in the block group being taken offline when it's not necessary. Add in the necessary EXT4_B2C() calls to perform the conversions.
--- fs/ext4/balloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/ext4/balloc.c +7 -5
@@ -278,6 +278,7 @@ static int ext4_valid_block_bitmap(strucunsigned int block_group, struct buffer_head *bh) { + struct ext4_sb_info *sbi = EXT4_SB(sb);ext4_grpblk_t offset;ext4_grpblk_t next_zero_bit;ext4_fsblk_t bitmap_blk;
@@ -297,14 +298,14 @@ static int ext4_valid_block_bitmap(struc/* check whether block bitmap block number is set */ bitmap_blk =ext4_block_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (!ext4_test_bit (offset, bh->b_data)) +if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;/* check whether the inode bitmap block number is set */ bitmap_blk =ext4_inode_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (!ext4_test_bit (offset, bh->b_data)) +if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;
@@ -312,9 +313,10 @@ static int ext4_valid_block_bitmap(struc bitmap_blk =ext4_inode_table (sb, desc); offset = bitmap_blk - group_first_block; next_zero_bit =ext4_find_next_zero_bit (bh->b_data, - offset +EXT4_SB (sb)->s_itb_per_group, - offset); -if (next_zero_bit >= offset +EXT4_SB (sb)->s_itb_per_group) +EXT4_B2C (sbi, offset +EXT4_SB (sb)->s_itb_per_group), +EXT4_B2C (sbi, offset)); +if (next_zero_bit >= +EXT4_B2C (sbi, offset +EXT4_SB (sb)->s_itb_per_group))/* good bitmap for inode tables */ return 1 ;
PATCH 8/153 ext4: add validity checks for bitmap block numbers
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 7dac4a1726a9c64a517d595c40e95e2d0d135f6f upstream.
An privileged attacker can cause a crash by mounting a crafted ext4 image which triggers a out-of-bounds read in the function ext4_valid_block_bitmap() in fs/ext4/balloc.c.
This issue has been assigned CVE-2018-1093.
[bwh: Backported to 3.2:
- In ext4_valid_block_bitmap(), goto err_out on error
- In ext4_read_{block,inode}_bitmap(), return NULL on error
- Adjust context]
---
fs/ext4/balloc.c +14 -2
@@ -298,20 +298,25 @@ static int ext4_valid_block_bitmap(struc/* check whether block bitmap block number is set */ bitmap_blk =ext4_block_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data)) +if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || + !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;/* check whether the inode bitmap block number is set */ bitmap_blk =ext4_inode_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data)) +if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || + !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;/* check whether the inode table block number is set */ bitmap_blk =ext4_inode_table (sb, desc); offset = bitmap_blk - group_first_block; +if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || +EXT4_B2C (sbi, offset + sbi->s_itb_per_group) >= sb->s_blocksize) + goto err_out; next_zero_bit =ext4_find_next_zero_bit (bh->b_data,EXT4_B2C (sbi, offset +EXT4_SB (sb)->s_itb_per_group),EXT4_B2C (sbi, offset));
@@ -339,6 +344,7 @@ struct buffer_head * ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) {struct ext4_group_desc *desc; +struct ext4_sb_info *sbi =EXT4_SB (sb);struct buffer_head *bh =NULL ;ext4_fsblk_t bitmap_blk;
@@ -346,6 +352,12 @@ ext4_read_block_bitmap(struct super_blocif (!desc)return NULL ; bitmap_blk =ext4_block_bitmap (sb, desc); +if ((bitmap_blk <=le32_to_cpu (sbi->s_es->s_first_data_block)) || + (bitmap_blk >=ext4_blocks_count (sbi->s_es))) { +ext4_error (sb,"Invalid block bitmap block %llu in " +"block_group %u" , bitmap_blk, block_group); +return NULL ; + } bh =sb_getblk (sb, bitmap_blk);if (unlikely (!bh)) { ext4_error(sb, "Cannot read block bitmap - "
fs/ext4/ialloc.c +7 -0
@@ -102,6 +102,7 @@ static struct buffer_head * ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) {struct ext4_group_desc *desc; +struct ext4_sb_info *sbi =EXT4_SB (sb);struct buffer_head *bh =NULL ;ext4_fsblk_t bitmap_blk;
@@ -110,6 +111,12 @@ ext4_read_inode_bitmap(struct super_blocreturn NULL ; bitmap_blk =ext4_inode_bitmap (sb, desc); +if ((bitmap_blk <=le32_to_cpu (sbi->s_es->s_first_data_block)) || + (bitmap_blk >=ext4_blocks_count (sbi->s_es))) { +ext4_error (sb,"Invalid inode bitmap blk %llu in " +"block_group %u" , bitmap_blk, block_group); +return NULL ; + } bh =sb_getblk (sb, bitmap_blk);if (unlikely (!bh)) { ext4_error(sb, "Cannot read inode bitmap - "
PATCH 9/153 ext4: fix bitmap position validation
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 22be37acce25d66ecf6403fc8f44df9c5ded2372 upstream.
Currently in ext4_valid_block_bitmap() we expect the bitmap to be positioned anywhere between 0 and s_blocksize clusters, but that's wrong because the bitmap can be placed anywhere in the block group. This causes false positives when validating bitmaps on perfectly valid file system layouts. Fix it by checking whether the bitmap is within the group boundary.
The problem can be reproduced using the following
mkfs -t ext3 -E stride=256 /dev/vdb1
mount /dev/vdb1 /mnt/test
cd /mnt/test
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz
tar xf linux-4.16.3.tar.xz
This will result in the warnings in the logs
EXT4-fs error (device vdb1): ext4_validate_block_bitmap:399: comm tar: bg 84: block 2774529: invalid block bitmap
[ Changed slightly for clarity and to not drop a overflow test -- TYT ]
--- fs/ext4/balloc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/ext4/balloc.c +5 -4
@@ -281,6 +281,7 @@ static int ext4_valid_block_bitmap(strucstruct ext4_sb_info *sbi =EXT4_SB (sb);ext4_grpblk_t offset;ext4_grpblk_t next_zero_bit; +ext4_grpblk_t max_bit =EXT4_CLUSTERS_PER_GROUP (sb);ext4_fsblk_t bitmap_blk;ext4_fsblk_t group_first_block;
@@ -298,7 +299,7 @@ static int ext4_valid_block_bitmap(struc/* check whether block bitmap block number is set */ bitmap_blk =ext4_block_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;
@@ -306,7 +307,7 @@ static int ext4_valid_block_bitmap(struc/* check whether the inode bitmap block number is set */ bitmap_blk =ext4_inode_bitmap (sb, desc); offset = bitmap_blk - group_first_block; -if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ goto err_out;
@@ -314,8 +315,8 @@ static int ext4_valid_block_bitmap(struc/* check whether the inode table block number is set */ bitmap_blk =ext4_inode_table (sb, desc); offset = bitmap_blk - group_first_block; -if (offset <0 ||EXT4_B2C (sbi, offset) >= sb->s_blocksize || -EXT4_B2C (sbi, offset + sbi->s_itb_per_group) >= sb->s_blocksize) +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || +EXT4_B2C (sbi, offset + sbi->s_itb_per_group) >= max_bit) goto err_out; next_zero_bit = ext4_find_next_zero_bit(bh->b_data, EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group),
PATCH 10/153 dccp: check sk for closed state in dccp_sendmsg()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
commit 67f93df79aeefc3add4e4b31a752600f834236e2 upstream.
dccp_disconnect() sets 'dp->dccps_hc_tx_ccid' tx handler to NULL, therefore if DCCP socket is disconnected and dccp_sendmsg() is called after it, it will cause a NULL pointer dereference in dccp_write_xmit().
This crash and the reproducer was reported by syzbot. Looks like it is reproduced if commit 69c64866ce07 ("dccp: CVE-2017-8824:
use-after-free in DCCP code") is applied.
--- net/dccp/proto.c | 5 +++++ 1 file changed, 5 insertions(+)
net/dccp/proto.c +5 -0
@@ -785,6 +785,11 @@ int dccp_sendmsg(struct kiocb *iocb, strif (skb ==NULL ) goto out_release; +if (sk->sk_state ==DCCP_CLOSED ) { + rc = -ENOTCONN ; + goto out_discard; + } +skb_reserve (skb, sk->sk_prot->max_header); rc =memcpy_fromiovec (skb_put (skb, len), msg->msg_iov, len);if (rc !=0 )
PATCH 11/153 sctp: verify size of a new chunk in _sctp_make_chunk()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
commit 07f2c7ab6f8d0a7e7c5764c4e6cc9c52951b9d9c upstream.
When SCTP makes INIT or INIT_ACK packet the total chunk length can exceed SCTP_MAX_CHUNK_LEN which leads to kernel panic when transmitting these packets, e.g. the crash on sending INIT_ACK:
[ 597.804948] skbuff: skb_over_panic: text:00000000ffae06e4 len:120168
put:120156 head:000000007aa47635 data:00000000d991c2de
tail:0x1d640 end:0xfec0 dev:<NULL>
...
[ 597.976970] ------------[ cut here ]------------
[ 598.033408] kernel BUG at net/core/skbuff.c:104!
[ 600.314841] Call Trace:
[ 600.345829] <IRQ>
[ 600.371639] ? sctp_packet_transmit+0x2095/0x26d0 [sctp]
[ 600.436934] skb_put+0x16c/0x200
[ 600.477295] sctp_packet_transmit+0x2095/0x26d0 [sctp]
[ 600.540630] ? sctp_packet_config+0x890/0x890 [sctp]
[ 600.601781] ? __sctp_packet_append_chunk+0x3b4/0xd00 [sctp]
[ 600.671356] ? sctp_cmp_addr_exact+0x3f/0x90 [sctp]
[ 600.731482] sctp_outq_flush+0x663/0x30d0 [sctp]
[ 600.788565] ? sctp_make_init+0xbf0/0xbf0 [sctp]
[ 600.845555] ? sctp_check_transmitted+0x18f0/0x18f0 [sctp]
[ 600.912945] ? sctp_outq_tail+0x631/0x9d0 [sctp]
[ 600.969936] sctp_cmd_interpreter.isra.22+0x3be1/0x5cb0 [sctp]
[ 601.041593] ? sctp_sf_do_5_1B_init+0x85f/0xc30 [sctp]
[ 601.104837] ? sctp_generate_t1_cookie_event+0x20/0x20 [sctp]
[ 601.175436] ? sctp_eat_data+0x1710/0x1710 [sctp]
[ 601.233575] sctp_do_sm+0x182/0x560 [sctp]
[ 601.284328] ? sctp_has_association+0x70/0x70 [sctp]
[ 601.345586] ? sctp_rcv+0xef4/0x32f0 [sctp]
[ 601.397478] ? sctp6_rcv+0xa/0x20 [sctp]...
Here the chunk size for INIT_ACK packet becomes too big, mostly because of the state cookie (INIT packet has large size with many address parameters), plus additional server parameters.
Later this chunk causes the panic in skb_put_data():
skb_packet_transmit()
sctp_packet_pack()
skb_put_data(nskb, chunk->skb->data, chunk->skb->len);'nskb' (head skb) was previously allocated with packet->size from u16 'chunk->chunk_hdr->length'.
As suggested by Marcelo we should check the chunk's length in _sctp_make_chunk() before trying to allocate skb for it and discard a chunk if its size bigger than SCTP_MAX_CHUNK_LEN.
[bwh: Backported to 3.2:
- Keep using WORD_ROUND() instead of SCTP_PAD4()
- Adjust context]
--- net/sctp/sm_make_chunk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/sctp/sm_make_chunk.c +6 -2
@@ -1324,10 +1324,14 @@ struct sctp_chunk *sctp_make_chunk(constsctp_chunkhdr_t *chunk_hdr;struct sk_buff *skb;struct sock *sk; +int chunklen; + + chunklen =WORD_ROUND (sizeof (*chunk_hdr) + paylen); +if (chunklen >SCTP_MAX_CHUNK_LEN ) + goto nodata;/* No need to allocate LL here, as this is only a chunk. */ - skb =alloc_skb (WORD_ROUND (sizeof (sctp_chunkhdr_t) + paylen), -GFP_ATOMIC ); + skb =alloc_skb (chunklen,GFP_ATOMIC );if (!skb) goto nodata;
PATCH 12/153 fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peter Malone <[email protected]>
commit 250c6c49e3b68756b14983c076183568636e2bde upstream.
Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
'index' is defined as an int in sbusfb_ioctl_helper(). We retrieve this from the user:
if (get_user(index, &c->index) ||
__get_user(count, &c->count) ||
__get_user(ured, &c->red) ||
__get_user(ugreen, &c->green) ||
__get_user(ublue, &c->blue))
return -EFAULT;and then we use 'index' in the following way:
red = cmap->red[index + i] >> 8;
green = cmap->green[index + i] >> 8;
blue = cmap->blue[index + i] >> 8;
This is a classic information leak vulnerability. 'index' should be an unsigned int, given its usage above.
This patch is straight-forward; it changes 'index' to unsigned int in two switch-cases: FBIOGETCMAP_SPARC && FBIOPUTCMAP_SPARC.
This patch fixes CVE-2018-6412.
--- drivers/video/sbuslib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/sbuslib.c +2 -2
@@ -122,7 +122,7 @@ int sbusfb_ioctl_helper(unsigned long cmunsigned 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) ||
@@ -161,7 +161,7 @@ int sbusfb_ioctl_helper(unsigned long cmunsigned 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) ||
PATCH 13/153 ALSA: seq: Fix racy pool initializations
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d15d662e89fc667b90cd294b0eb45694e33144da upstream.
ALSA sequencer core initializes the event pool on demand by invoking snd_seq_pool_init() when the first write happens and the pool is empty. Meanwhile user can reset the pool size manually via ioctl concurrently, and this may lead to UAF or out-of-bound accesses since the function tries to vmalloc / vfree the buffer.
A simple fix is to just wrap the snd_seq_pool_init() call with the recently introduced client->ioctl_mutex; as the calls for snd_seq_pool_init() from other side are always protected with this mutex, we can avoid the race.
--- sound/core/seq/seq_clientmgr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/seq/seq_clientmgr.c +6 -2
@@ -1000,7 +1000,7 @@ static ssize_t snd_seq_write(struct file {struct snd_seq_client *client = file->private_data;int written =0 , len; -int err = -EINVAL ; +int err;struct snd_seq_event event;if (!(snd_seq_file_flags (file) &SNDRV_SEQ_LFLG_OUTPUT ))
@@ -1015,11 +1015,15 @@ static ssize_t snd_seq_write(struct file/* allocate the pool now if the pool is not allocated yet */ if (client->pool->size >0 && !snd_seq_write_pool_allocated (client)) { -if (snd_seq_pool_init (client->pool) <0 ) +mutex_lock (&client->ioctl_mutex); + err =snd_seq_pool_init (client->pool); +mutex_unlock (&client->ioctl_mutex); +if (err <0 )return -ENOMEM ; }/* only process whole events */ + err = -EINVAL ;while (count >=sizeof (struct snd_seq_event )) {/* Read in the event header from the user */ len =sizeof (event);
PATCH 14/153 ALSA: seq: Don't allow resizing pool in use
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d85739367c6d56e475c281945c68fdb05ca74b4c upstream.
This is a fix for a (sort of) fallout in the recent commit d15d662e89fc ("ALSA: seq: Fix racy pool initializations") for CVE-2018-1000004.
As the pool resize deletes the existing cells, it may lead to a race when another thread is writing concurrently, eventually resulting a UAF.
A simple workaround is not to allow the pool resizing when the pool is in use. It's an invalid behavior in anyway.
--- sound/core/seq/seq_clientmgr.c | 3 +++ 1 file changed, 3 insertions(+)
sound/core/seq/seq_clientmgr.c +3 -0
@@ -1917,6 +1917,9 @@ static int snd_seq_ioctl_set_client_pool (! snd_seq_write_pool_allocated(client) || info.output_pool != client->pool->size)) {if (snd_seq_write_pool_allocated (client)) { +/* is the pool in use? */ +if (atomic_read (&client->pool->counter)) +return -EBUSY ;/* remove all existing cells */ snd_seq_pool_mark_closing (client->pool);snd_seq_queue_client_leave_cells (client->number);
PATCH 15/153 ALSA: seq: correctly detect input buffer overflow
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Adam Goode <[email protected]>
commit 21fd3e956ee8a307a06bc6e095f5767a00eb2a7e upstream.
snd_seq_event_dup returns -ENOMEM in some buffer-full conditions, but usually returns -EAGAIN. Make -EAGAIN trigger the overflow condition in snd_seq_fifo_event_in so that the fifo is cleared and -ENOSPC is returned to userspace as stated in the alsa-lib docs.
--- sound/core/seq/seq_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/seq/seq_fifo.c +1 -1
@@ -127,7 +127,7 @@ int snd_seq_fifo_event_in(struct snd_seqsnd_use_lock_use (&f->use_lock); err =snd_seq_event_dup (f->pool, event, &cell,1 ,NULL );/* always non-blocking */ if (err <0 ) { -if (err == -ENOMEM ) +if ((err == -ENOMEM ) || (err == -EAGAIN ))atomic_inc (&f->overflow);snd_use_lock_free (&f->use_lock);return err;
PATCH 16/153 ALSA: seq: More protection for concurrent write and ioctl races
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 7bd80091567789f1c0cb70eb4737aac8bcd2b6b9 upstream.
This patch is an attempt for further hardening against races between the concurrent write and ioctls. The previous fix d15d662e89fc ("ALSA: seq: Fix racy pool initializations") covered the race of the pool initialization at writer and the pool resize ioctl by the client->ioctl_mutex (CVE-2018-1000004). However, basically this mutex should be applied more widely to the whole write operation for avoiding the unexpected pool operations by another thread.
The only change outside snd_seq_write() is the additional mutex argument to helper functions, so that we can unlock / relock the given mutex temporarily during schedule() call for blocking write.
--- sound/core/seq/seq_clientmgr.c | 18 +++++++++++------- sound/core/seq/seq_fifo.c | 2 +- sound/core/seq/seq_memory.c | 14 ++++++++++---- sound/core/seq/seq_memory.h | 3 ++- 4 files changed, 24 insertions(+), 13 deletions(-)
sound/core/seq/seq_clientmgr.c +11 -7
@@ -907,7 +907,8 @@ int snd_seq_dispatch_event(struct snd_sestatic int snd_seq_client_enqueue_event (struct snd_seq_client *client,struct snd_seq_event *event,struct file *file,int blocking, -int atomic,int hop) +int atomic,int hop, +struct mutex *mutexp) {struct snd_seq_event_cell *cell;int err;
@@ -945,7 +946,8 @@ static int snd_seq_client_enqueue_event(return -ENXIO ;/* queue is not allocated */ /* allocate an event cell */ - err =snd_seq_event_dup (client->pool, event, &cell, !blocking || atomic, file); + err =snd_seq_event_dup (client->pool, event, &cell, !blocking || atomic, + file, mutexp);if (err <0 )return err;
@@ -1014,12 +1016,11 @@ static ssize_t snd_seq_write(struct filereturn -ENXIO ;/* allocate the pool now if the pool is not allocated yet */ +mutex_lock (&client->ioctl_mutex);if (client->pool->size >0 && !snd_seq_write_pool_allocated (client)) { -mutex_lock (&client->ioctl_mutex); err =snd_seq_pool_init (client->pool); -mutex_unlock (&client->ioctl_mutex);if (err <0 ) -return -ENOMEM ; + goto out; }/* only process whole events */
@@ -1070,7 +1071,7 @@ static ssize_t snd_seq_write(struct file/* ok, enqueue it */ err =snd_seq_client_enqueue_event (client, &event, file, !(file->f_flags &O_NONBLOCK ), -0 ,0 ); +0 ,0 , &client->ioctl_mutex);if (err <0 )break ;
@@ -1081,6 +1082,8 @@ static ssize_t snd_seq_write(struct file written += len; } + out: +mutex_unlock (&client->ioctl_mutex);return written ? written : err; }
@@ -2343,7 +2346,8 @@ static int kernel_client_enqueue(int cliif (! cptr->accept_output) result = -EPERM ;else /* send it */ - result =snd_seq_client_enqueue_event (cptr, ev, file, blocking, atomic, hop); + result =snd_seq_client_enqueue_event (cptr, ev, file, blocking, + atomic, hop,NULL );snd_seq_client_unlock (cptr);return result;
sound/core/seq/seq_fifo.c +1 -1
@@ -125,7 +125,7 @@ int snd_seq_fifo_event_in(struct snd_seqreturn -EINVAL ;snd_use_lock_use (&f->use_lock); - err =snd_seq_event_dup (f->pool, event, &cell,1 ,NULL );/* always non-blocking */ + err =snd_seq_event_dup (f->pool, event, &cell,1 ,NULL ,NULL );/* always non-blocking */ if (err <0 ) {if ((err == -ENOMEM ) || (err == -EAGAIN ))atomic_inc (&f->overflow);
sound/core/seq/seq_memory.c +10 -4
@@ -221,7 +221,8 @@ void snd_seq_cell_free(struct snd_seq_ev*/ static int snd_seq_cell_alloc (struct snd_seq_pool *pool,struct snd_seq_event_cell **cellp, -int nonblock,struct file *file) +int nonblock,struct file *file, +struct mutex *mutexp) {struct snd_seq_event_cell *cell;unsigned long flags;
@@ -245,7 +246,11 @@ static int snd_seq_cell_alloc(struct sndset_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&pool->output_sleep, &wait);spin_unlock_irq (&pool->lock); +if (mutexp) +mutex_unlock (mutexp);schedule (); +if (mutexp) +mutex_lock (mutexp);spin_lock_irq (&pool->lock);remove_wait_queue (&pool->output_sleep, &wait);/* interrupted? */
@@ -288,7 +293,7 @@ __error:*/ int snd_seq_event_dup (struct snd_seq_pool *pool,struct snd_seq_event *event,struct snd_seq_event_cell **cellp,int nonblock, -struct file *file) +struct file *file,struct mutex *mutexp) {int ncells, err;unsigned int extlen;
@@ -305,7 +310,7 @@ int snd_seq_event_dup(struct snd_seq_pooif (ncells >= pool->total_elements)return -ENOMEM ; - err =snd_seq_cell_alloc (pool, &cell, nonblock, file); + err =snd_seq_cell_alloc (pool, &cell, nonblock, file, mutexp);if (err <0 )return err;
@@ -331,7 +336,8 @@ int snd_seq_event_dup(struct snd_seq_pooint size =sizeof (struct snd_seq_event );if (len < size) size = len; - err =snd_seq_cell_alloc (pool, &tmp, nonblock, file); + err =snd_seq_cell_alloc (pool, &tmp, nonblock, file, + mutexp);if (err <0 ) goto __error;if (cell->event.data.ext.ptr ==NULL )
sound/core/seq/seq_memory.h +2 -1
@@ -66,7 +66,8 @@ struct snd_seq_pool {void snd_seq_cell_free (struct snd_seq_event_cell *cell);int snd_seq_event_dup (struct snd_seq_pool *pool,struct snd_seq_event *event, -struct snd_seq_event_cell **cellp,int nonblock,struct file *file); +struct snd_seq_event_cell **cellp,int nonblock, +struct file *file,struct mutex *mutexp);/* return number of unused (free) cells */ static inline int snd_seq_unused_cells (struct snd_seq_pool *pool)
PATCH 17/153 hugetlbfs: fix offset overflow in hugetlbfs mmap
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit 045c7a3f53d9403b62d396b6d051c4be5044cdb4 upstream.
If mmap() maps a file, it can be passed an offset into the file at which the mapping is to start. Offset could be a negative value when represented as a loff_t. The offset plus length will be used to update the file size (i_size) which is also a loff_t.
Validate the value of offset and offset + length to make sure they do not overflow and appear as negative.
Found by syzcaller with commit ff8c0c53c475 ("mm/hugetlb.c: don't call region_abort if region_chg fails") applied. Prior to this commit, the overflow would still occur but we would luckily return ENOMEM.
To reproduce:
mmap(0, 0x2000, 0, 0x40021, 0xffffffffffffffffULL, 0x8000000000000000ULL);
Resulted in,
kernel BUG at mm/hugetlb.c:742!
Call Trace: hugetlbfs_evict_inode+0x80/0xa0 evict+0x24a/0x620 iput+0x48f/0x8c0 dentry_unlink_inode+0x31f/0x4d0 __dentry_kill+0x292/0x5e0 dput+0x730/0x830 __fput+0x438/0x720 ____fput+0x1a/0x20 task_work_run+0xfe/0x180 exit_to_usermode_loop+0x133/0x150 syscall_return_slowpath+0x184/0x1c0 entry_SYSCALL_64_fastpath+0xab/0xad
--- fs/hugetlbfs/inode.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +12 -3
@@ -94,17 +94,26 @@ static int hugetlbfs_file_mmap(struct fi vma->vm_flags |=VM_HUGETLB |VM_RESERVED ; vma->vm_ops = &hugetlb_vm_ops; +/* +* Offset passed to mmap (before page shift) could have been +* negative when represented as a (l)off_t. +*/ +if (((loff_t )vma->vm_pgoff <<PAGE_SHIFT ) <0 ) +return -EINVAL ; +if (vma->vm_pgoff & (~huge_page_mask (h) >>PAGE_SHIFT ))return -EINVAL ; vma_len = (loff_t)(vma->vm_end - vma->vm_start); + len = vma_len + ((loff_t )vma->vm_pgoff <<PAGE_SHIFT ); +/* check for overflow */ +if (len < vma_len) +return -EINVAL ;mutex_lock (&inode->i_mutex);file_accessed (file); ret = -ENOMEM ; - len = vma_len + ((loff_t )vma->vm_pgoff <<PAGE_SHIFT ); - if (hugetlb_reserve_pages(inode, vma->vm_pgoff >> huge_page_order(h), len >> huge_page_shift(h), vma,
@@ -114,7 +123,7 @@ static int hugetlbfs_file_mmap(struct fi ret =0 ;hugetlb_prefault_arch_hook (vma->vm_mm);if (vma->vm_flags &VM_WRITE && inode->i_size < len) - inode->i_size = len; +i_size_write (inode, len); out:mutex_unlock (&inode->i_mutex);
PATCH 18/153 hugetlbfs: check for pgoff value overflow
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit 63489f8e821144000e0bdca7e65a8d1cc23a7ee7 upstream.
A vma with vm_pgoff large enough to overflow a loff_t type when converted to a byte offset can be passed via the remap_file_pages system call. The hugetlbfs mmap routine uses the byte offset to calculate reservations and file size.
A sequence such as:
mmap(0x20a00000, 0x600000, 0, 0x66033, -1, 0); remap_file_pages(0x20a00000, 0x600000, 0, 0x20000000000000, 0);
will result in the following when task exits/file closed,
kernel BUG at mm/hugetlb.c:749!
Call Trace:
hugetlbfs_evict_inode+0x2f/0x40
evict+0xcb/0x190
__dentry_kill+0xcb/0x150
__fput+0x164/0x1e0
task_work_run+0x84/0xa0
exit_to_usermode_loop+0x7d/0x80
do_syscall_64+0x18b/0x190
entry_SYSCALL_64_after_hwframe+0x3d/0xa2The overflowed pgoff value causes hugetlbfs to try to set up a mapping with a negative range (end < start) that leaves invalid state which causes the BUG.
The previous overflow fix to this code was incomplete and did not take the remap_file_pages system call into account.
[bwh: Backported to 3.2:
- Use a conditional WARN() instead of VM_WARN()
- Adjust context]
--- fs/hugetlbfs/inode.c | 17 ++++++++++++++--- mm/hugetlb.c | 7 +++++++ 2 files changed, 21 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +14 -3
@@ -76,6 +76,16 @@ static void huge_pagevec_release(structpagevec_reinit (pvec); } +/* +* Mask used when checking the page offset value passed in via system +* calls. This value will be converted to a loff_t which is signed. +* Therefore, we want to check the upper PAGE_SHIFT + 1 bits of the +* value. The extra bit (- 1 in the shift value) is to take the sign +* bit into account. +*/ +#define PGOFF_LOFFT_MAX \ + (((1UL << (PAGE_SHIFT + 1)) - 1) << (BITS_PER_LONG - (PAGE_SHIFT + 1))) +static int hugetlbfs_file_mmap (struct file *file,struct vm_area_struct *vma) {struct inode *inode = file->f_path.dentry->d_inode;
@@ -95,12 +105,13 @@ static int hugetlbfs_file_mmap(struct fi vma->vm_ops = &hugetlb_vm_ops;/* -* Offset passed to mmap (before page shift) could have been -* negative when represented as a (l)off_t. +* page based offset in vm_pgoff could be sufficiently large to +* overflow a (l)off_t when converted to byte offset. */ -if (((loff_t )vma->vm_pgoff <<PAGE_SHIFT ) <0 ) +if (vma->vm_pgoff &PGOFF_LOFFT_MAX )return -EINVAL ; +/* must be huge page aligned */ if (vma->vm_pgoff & (~huge_page_mask (h) >>PAGE_SHIFT ))return -EINVAL ;
mm/hugetlb.c +9 -0
@@ -18,6 +18,7 @@#include <linux/bootmem.h> #include <linux/sysfs.h> #include <linux/slab.h> +#include <linux/mmdebug.h> #include <linux/rmap.h> #include <linux/swap.h> #include <linux/swapops.h>
@@ -3097,6 +3098,14 @@ int hugetlb_reserve_pages(struct inode *struct hstate *h =hstate_inode (inode);struct hugepage_subpool *spool =subpool_inode (inode); +/* This should never happen */ +if (from > to) { +#ifdef CONFIG_DEBUG_VM +WARN (1 ,"%s called with a negative range\n" , __func__); +#endif +return -EINVAL ; + } +/* * Only apply hugepage reservation if asked. At fault time, an * attempt will be made for VM_NORESERVE to allocate a page
PATCH 19/153 scsi: libsas: fix memory leak in sas_smp_get_phy_events()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <[email protected]>
commit 4a491b1ab11ca0556d2fda1ff1301e862a2d44c4 upstream.
We've got a memory leak with the following producer:
while true;
do cat /sys/class/sas_phy/phy-1:0:12/invalid_dword_count >/dev/null; done
The buffer req is allocated and not freed after we return. Fix it.
--- drivers/scsi/libsas/sas_expander.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/libsas/sas_expander.c +1 -0
@@ -566,6 +566,7 @@ int sas_smp_get_phy_events(struct sas_ph phy->phy_reset_problem_count =scsi_to_u32 (&resp[24 ]); out: +kfree (req);kfree (resp);return res;
PATCH 20/153 x86/MCE: Serialize sysfs changes
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
commit b3b7c4795ccab5be71f080774c45bbbcc75c2aaf upstream.
The check_interval file in
/sys/devices/system/machinecheck/machinecheck<cpu number>
directory is a global timer value for MCE polling. If it is changed by one CPU, mce_restart() broadcasts the event to other CPUs to delete and restart the MCE polling timer and __mcheck_cpu_init_timer() reinitializes the mce_timer variable.
If more than one CPU writes a specific value to the check_interval file concurrently, mce_timer is not protected from such concurrent accesses and all kinds of explosions happen. Since only root can write to those sysfs variables, the issue is not a big deal security-wise.
However, concurrent writes to these configuration variables is void of reason so the proper thing to do is to serialize the access with a mutex.
Boris:
- Make store_int_with_restart() use device_store_ulong() to filter out negative intervals
- Limit min interval to 1 second
- Correct locking
- Massage commit message
[bwh: Backported to 3.2:
- MCE device is a sysdev here
- Adjust context]
--- arch/x86/kernel/cpu/mcheck/mce.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
arch/x86/kernel/cpu/mcheck/mce.c +21 -1
@@ -52,6 +52,9 @@ static DEFINE_MUTEX(mce_chrdev_read_mute rcu_read_lock_sched_held() || \ lockdep_is_held(&mce_chrdev_read_mutex)) +/* sysfs synchronization */ +static DEFINE_MUTEX (mce_sysfs_mutex); +#define CREATE_TRACE_POINTS #include <trace/events/mce.h>
@@ -1883,6 +1886,7 @@ static ssize_t set_ignore_ce(struct sys_if (strict_strtoull (buf,0 , &new) <0 )return -EINVAL ; +mutex_lock (&mce_sysfs_mutex);if (mce_ignore_ce ^ !!new) {if (new) {/* disable ce features */
@@ -1895,6 +1899,8 @@ static ssize_t set_ignore_ce(struct sys_on_each_cpu (mce_enable_ce, (void *)1 ,1 ); } } +mutex_unlock (&mce_sysfs_mutex); +return size; }
@@ -1907,6 +1913,7 @@ static ssize_t set_cmci_disabled(structif (strict_strtoull (buf,0 , &new) <0 )return -EINVAL ; +mutex_lock (&mce_sysfs_mutex);if (mce_cmci_disabled ^ !!new) {if (new) {/* disable cmci */
@@ -1918,6 +1925,8 @@ static ssize_t set_cmci_disabled(structon_each_cpu (mce_enable_ce,NULL ,1 ); } } +mutex_unlock (&mce_sysfs_mutex); +return size; }
@@ -1925,8 +1934,19 @@ static ssize_t store_int_with_restart(ststruct sysdev_attribute *attr, const char *buf, size_t size) { - ssize_t ret = sysdev_store_int(s, attr, buf, size); + unsigned long old_check_interval = check_interval; +ssize_t ret =sysdev_store_ulong (s, attr, buf, size); + +if (check_interval == old_check_interval) +return ret; + +if (check_interval <1 ) + check_interval =1 ; + +mutex_lock (&mce_sysfs_mutex);mce_restart (); +mutex_unlock (&mce_sysfs_mutex); +return ret; }
PATCH 22/153 x86/traps: Enable DEBUG_STACK after cpu_init() for TRAP_DB/BP
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wang Nan <[email protected]>
commit b4d8327024637cb2a1f7910dcb5d0ad7a096f473 upstream.
Before this patch early_trap_init() installs DEBUG_STACK for X86_TRAP_BP and X86_TRAP_DB. However, DEBUG_STACK doesn't work correctly until cpu_init() <-- trap_init().
This patch passes 0 to set_intr_gate_ist() and set_system_intr_gate_ist() instead of DEBUG_STACK to let it use same stack as kernel, and installs DEBUG_STACK for them in trap_init().
As core runs at ring 0 between early_trap_init() and trap_init(), there is no chance to get a bad stack before trap_init().
As NMI is also enabled in trap_init(), we don't need to care about is_debug_stack() and related things used in arch/x86/kernel/nmi.c.
--- arch/x86/kernel/traps.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
arch/x86/kernel/traps.c +19 -2
@@ -718,9 +718,17 @@ dotraplinkage void do_iret_error(struct/* Set of traps needed for early debugging. */ void __init early_trap_init (void ) { -set_intr_gate_ist (X86_TRAP_DB , &debug,DEBUG_STACK ); +/* +* Don't set ist to DEBUG_STACK as it doesn't work until TSS is +* ready in cpu_init() <-- trap_init(). Before trap_init(), CPU +* runs at ring 0 so it is impossible to hit an invalid stack. +* Using the original stack works well enough at this early +* stage. DEBUG_STACK will be equipped after cpu_init() in +* trap_init(). +*/ +set_intr_gate_ist (X86_TRAP_DB , &debug,0 );/* int3 can be called from all */ -set_system_intr_gate_ist (X86_TRAP_BP , &int3,DEBUG_STACK ); +set_system_intr_gate_ist (X86_TRAP_BP , &int3,0 );set_intr_gate (X86_TRAP_PF , &page_fault);load_idt (&idt_descr); }
@@ -781,5 +789,14 @@ void __init trap_init(void)*/ cpu_init (); +/* +* X86_TRAP_DB and X86_TRAP_BP have been set +* in early_trap_init(). However, DEBUG_STACK works only after +* cpu_init() loads TSS. See comments in early_trap_init(). +*/ +set_intr_gate_ist (X86_TRAP_DB , &debug,DEBUG_STACK ); +/* int3 can be called from all */ +set_system_intr_gate_ist (X86_TRAP_BP , &int3,DEBUG_STACK ); + x86_init.irqs.trap_init (); }
PATCH 23/153 x86/entry/64: Don't use IST entry for #BP stack
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit d8ba61ba58c88d5207c1ba2f7d9a2280e7d03be9 upstream.
There's nothing IST-worthy about #BP/int3. We don't allow kprobes in the small handful of places in the kernel that run at CPL0 with an invalid stack, and 32-bit kernels have used normal interrupt gates for #BP forever.
Furthermore, we don't allow kprobes in places that have usergs while in kernel mode, so "paranoid" is also unnecessary.
[carnil: Backport to 3.16:
- Adjust finename change: arch/x86/kernel/entry_64.S
- Context changes
]
[bwh: Rebase on top of "x86/traps: Enable DEBUG_STACK after cpu_init() for
TRAP_DB/BP", and restore change in trap_init() instead of early_trap_init(). Backport to 3.2:
- Use zeroentry macro in entry_64.S
- Drop changes related to breakpoint-in-NMI support
- Adjust context]
---
arch/x86/kernel/entry_64.S +1 -1
@@ -1401,7 +1401,7 @@ apicinterrupt XEN_HVM_EVTCHN_CALLBACK \ .pushsection .kprobes.text, "ax" paranoidzeroentry_ist debug do_debug DEBUG_STACK -paranoidzeroentry_ist int3 do_int3 DEBUG_STACK +zeroentry int3 do_int3 errorentry stack_segment do_stack_segment #ifdef CONFIG_XEN zeroentry xen_debug do_debug
arch/x86/kernel/traps.c +3 -6
@@ -314,7 +314,6 @@ gp_in_kernel:die ("general protection fault" , regs, error_code); } -/* May run on IST stack. */ dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) {#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
@@ -790,13 +789,11 @@ void __init trap_init(void)cpu_init ();/* -* X86_TRAP_DB and X86_TRAP_BP have been set -* in early_trap_init(). However, DEBUG_STACK works only after -* cpu_init() loads TSS. See comments in early_trap_init(). +* X86_TRAP_DB was installed in early_trap_init(). However, +* DEBUG_STACK works only after cpu_init() loads TSS. See comments +* in early_trap_init(). */ set_intr_gate_ist (X86_TRAP_DB , &debug,DEBUG_STACK ); -/* int3 can be called from all */ -set_system_intr_gate_ist (X86_TRAP_BP , &int3,DEBUG_STACK ); x86_init.irqs.trap_init (); }
PATCH 24/153 cdrom: information leak in cdrom_ioctl_media_changed()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9de4ee40547fd315d4a0ed1dd15a2fa3559ad707 upstream.
This cast is wrong. "cdi->capacity" is an int and "arg" is an unsigned long. The way the check is written now, if one of the high 32 bits is set then we could read outside the info->slots[] array.
This bug is pretty old and it predates git.
--- drivers/cdrom/cdrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cdrom/cdrom.c +1 -1
@@ -2342,7 +2342,7 @@ static int cdrom_ioctl_media_changed(strif (!CDROM_CAN (CDC_SELECT_DISC ) || arg ==CDSL_CURRENT )return media_changed (cdi,1 ); -if ((unsigned int )arg >= cdi->capacity) +if (arg >= cdi->capacity)return -EINVAL ; info =kmalloc (sizeof (*info),GFP_KERNEL );
PATCH 25/153 perf/hwpb: Invoke __perf_event_disable() if interrupts are already disabled
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "K.Prasad" <[email protected]>
commit 500ad2d8b01390c98bc6dce068bccfa9534b8212 upstream.
While debugging a warning message on PowerPC while using hardware breakpoints, it was discovered that when perf_event_disable is invoked through hw_breakpoint_handler function with interrupts disabled, a subsequent IPI in the code path would trigger a WARN_ON_ONCE message in smp_call_function_single function.
This patch calls __perf_event_disable() when interrupts are already disabled, instead of perf_event_disable().
--- include/linux/perf_event.h | 2 ++ kernel/events/core.c | 2 +- kernel/events/hw_breakpoint.c | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-)
include/linux/perf_event.h +2 -0
@@ -1140,6 +1140,7 @@ extern int perf_swevent_get_recursion_coextern void perf_swevent_put_recursion_context (int rctx);extern void perf_event_enable (struct perf_event *event);extern void perf_event_disable (struct perf_event *event); +extern int __perf_event_disable (void *info);extern void perf_event_task_tick (void );#else static inline void
@@ -1178,6 +1179,7 @@ static inline int perf_swevent_get_recustatic inline void perf_swevent_put_recursion_context (int rctx) { }static inline void perf_event_enable (struct perf_event *event) { }static inline void perf_event_disable (struct perf_event *event) { } +static inline int __perf_event_disable (void *info) {return -1 ; }static inline void perf_event_task_tick (void ) { }#endif
kernel/events/core.c +1 -1
@@ -1344,7 +1344,7 @@ retry:/* * Cross CPU call to disable a performance event */ -static int __perf_event_disable (void *info) +int __perf_event_disable (void *info) {struct perf_event *event = info;struct perf_event_context *ctx = event->ctx;
kernel/events/hw_breakpoint.c +10 -1
@@ -453,7 +453,16 @@ int modify_user_hw_breakpoint(struct perint old_type = bp->attr.bp_type;int err =0 ; -perf_event_disable (bp); +/* +* modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it +* will not be possible to raise IPIs that invoke __perf_event_disable. +* So call the function directly after making sure we are targeting the +* current task. +*/ +if (irqs_disabled () && bp->ctx && bp->ctx->task == current) +__perf_event_disable (bp); +else +perf_event_disable (bp); bp->attr.bp_addr = attr->bp_addr; bp->attr.bp_type = attr->bp_type;
PATCH 26/153 perf/hwbp: Simplify the perf-hwbp code, fix documentation
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit f67b15037a7a50c57f72e69a6d59941ad90a0f0f upstream.
Annoyingly, modify_user_hw_breakpoint() unnecessarily complicates the modification of a breakpoint - simplify it and remove the pointless local variables.
Also update the stale Docbook while at it.
--- kernel/events/hw_breakpoint.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-)
kernel/events/hw_breakpoint.c +7 -23
@@ -443,16 +443,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_break* modify_user_hw_breakpoint - modify a user-space hardware breakpoint * @bp: the breakpoint structure to modify * @attr: new breakpoint attributes -* @triggered: callback to trigger when we hit the breakpoint -* @tsk: pointer to 'task_struct' of the process to which the address belongs */ int modify_user_hw_breakpoint (struct perf_event *bp,struct perf_event_attr *attr) { -u64 old_addr = bp->attr.bp_addr; -u64 old_len = bp->attr.bp_len; -int old_type = bp->attr.bp_type; -int err =0 ; -/* * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it * will not be possible to raise IPIs that invoke __perf_event_disable.
@@ -467,27 +460,18 @@ int modify_user_hw_breakpoint(struct per bp->attr.bp_addr = attr->bp_addr; bp->attr.bp_type = attr->bp_type; bp->attr.bp_len = attr->bp_len; + bp->attr.disabled =1 ; -if (attr->disabled) - goto end; - - err =validate_hw_breakpoint (bp); -if (!err) -perf_event_enable (bp); +if (!attr->disabled) { +int err =validate_hw_breakpoint (bp); -if (err) { - bp->attr.bp_addr = old_addr; - bp->attr.bp_type = old_type; - bp->attr.bp_len = old_len; -if (!bp->attr.disabled) -perf_event_enable (bp); +if (err) +return err; -return err; +perf_event_enable (bp); + bp->attr.disabled =0 ; } -end: - bp->attr.disabled = attr->disabled; -return 0 ; }EXPORT_SYMBOL_GPL (modify_user_hw_breakpoint);
PATCH 27/153 media: cpia2: Fix a couple off by one bugs
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit d5ac225c7d64c9c3ef821239edc035634e594ec9 upstream.
The cam->buffers[] array has cam->num_frames elements so the > needs to be changed to >= to avoid going beyond the end of the array. The ->buffers[] array is allocated in cpia2_allocate_buffers() if you want to confirm.
--- drivers/media/video/cpia2/cpia2_v4l.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/video/cpia2/cpia2_v4l.c +2 -2
@@ -1152,7 +1152,7 @@ static int cpia2_querybuf(struct file *fstruct camera_data *cam =video_drvdata (file);if (buf->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE || - buf->index > cam->num_frames) + buf->index >= cam->num_frames)return -EINVAL ; buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer;
@@ -1201,7 +1201,7 @@ static int cpia2_qbuf(struct file *file,if (buf->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE || buf->memory !=V4L2_MEMORY_MMAP || - buf->index > cam->num_frames) + buf->index >= cam->num_frames)return -EINVAL ;DBG ("QBUF #%d\n" , buf->index);
PATCH 28/153 slip: sl_alloc(): remove unused parameter "dev_t line"
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
commit 936e5d8bdfa72577e28ea671d9e2ee4fef0d6b3e upstream.
The first and only parameter of sl_alloc() is unused, so remove it.
--- drivers/net/slip/slip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/slip/slip.c +2 -2
@@ -719,7 +719,7 @@ static void sl_sync(void)/* Find a free SLIP channel, and link in this `tty' line. */ -static struct slip *sl_alloc (dev_t line) +static struct slip *sl_alloc (void ) {int i;char name[IFNAMSIZ ];
@@ -800,7 +800,7 @@ static int slip_open(struct tty_struct */* OK. Find a free SLIP channel to use. */ err = -ENFILE ; - sl =sl_alloc (tty_devnum (tty)); + sl =sl_alloc ();if (sl ==NULL ) goto err_exit;
PATCH 29/153 ASoC: nuc900: Fix a loop timeout test
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 65a12b3aafed5fc59f4ce41b22b752b1729e6701 upstream.
We should be finishing the loop with timeout set to zero but because this is a post-op we finish with timeout == -1.
--- sound/soc/nuc900/nuc900-ac97.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/nuc900/nuc900-ac97.c +2 -2
@@ -66,7 +66,7 @@ static unsigned short nuc900_ac97_read(s/* polling the AC_R_FINISH */ while (!(AUDIO_READ (nuc900_audio->mmio +ACTL_ACCON ) &AC_R_FINISH ) - && timeout--) + && --timeout)mdelay (1 );if (!timeout) {
@@ -120,7 +120,7 @@ static void nuc900_ac97_write(struct snd/* polling the AC_W_FINISH */ while ((AUDIO_READ (nuc900_audio->mmio +ACTL_ACCON ) &AC_W_FINISH ) - && timeout--) + && --timeout)mdelay (1 );if (!timeout)
PATCH 30/153 USB: serial: io_edgeport: fix possible sleep-in-atomic
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jia-Ju Bai <[email protected]>
commit c7b8f77872c73f69a16528a9eb87afefcccdc18b upstream.
According to drivers/usb/serial/io_edgeport.c, the driver may sleep under a spinlock.
The function call path is:edge_bulk_in_callback (acquire the spinlock)
process_rcvd_data
process_rcvd_status
change_port_settings
send_iosp_ext_cmd
write_cmd_usb
usb_kill_urb --> may sleepTo fix it, the redundant usb_kill_urb() is removed from the error path after usb_submit_urb() fails.
This possible bug is found by my static analysis tool (DSAC) and checked by my code review.
--- drivers/usb/serial/io_edgeport.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/io_edgeport.c +0 -1
@@ -2387,7 +2387,6 @@ static int write_cmd_usb(struct edgeportdev_err (&edge_port->port->dev,"%s - usb_submit_urb(write command) failed, status = %d\n" , __func__, status); -usb_kill_urb (urb);usb_free_urb (urb);atomic_dec (&CmdUrbs);return status;
PATCH 31/153 media: bt8xx: Fix err 'bt878_probe()'
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
commit 45392ff6881dbe56d41ef0b17c2e576065f8ffa1 upstream.
This is odd to call 'pci_disable_device()' in an error path before a coresponding successful 'pci_enable_device()'.
Return directly instead.
--- drivers/media/dvb/bt8xx/bt878.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/dvb/bt8xx/bt878.c +1 -2
@@ -434,8 +434,7 @@ static int __devinit bt878_probe(struct bt878_num);if (bt878_num >=BT878_MAX ) {printk (KERN_ERR "bt878: Too many devices inserted\n" ); - result = -ENOMEM ; - goto fail0; +return -ENOMEM ; }if (pci_enable_device (dev))return -EIO ;
PATCH 32/153 ath9k_htc: Add a sanity check in ath9k_htc_ampdu_action()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 413fd2f5c0233d3cde391679b967c1f14cd2cb27 upstream.
Smatch generates a warning here:
drivers/net/wireless/ath/ath9k/htc_drv_main.c:1688 ath9k_htc_ampdu_action()
error: buffer overflow 'ista->tid_state' 8 <= 15I don't know if it's a real bug or not but the other paths through this function all ensure that "tid" is less than ATH9K_HTC_MAX_TID (8) so checking here makes things more consistent.
--- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +4 -0
@@ -1640,6 +1640,10 @@ static int ath9k_htc_ampdu_action(structieee80211_stop_tx_ba_cb_irqsafe (vif, sta->addr, tid);break ;case IEEE80211_AMPDU_TX_OPERATIONAL : +if (tid >=ATH9K_HTC_MAX_TID ) { + ret = -EINVAL ; +break ; + } ista = (struct ath9k_htc_sta *) sta->drv_priv;spin_lock_bh (&priv->tx.tx_lock); ista->tid_state[tid] =AGGR_OPERATIONAL ;
PATCH 33/153 l2tp: fix missing print session offset info
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
commit 820da5357572715c6235ba3b3daa2d5b43a1198f upstream.
Report offset parameter in L2TP_CMD_SESSION_GET command if it has been configured by userspace
[bwh: Backported to 3.2:
- Use NLA_PUT_U16, consistent with the rest of the function
- Adjust context]
--- net/l2tp/l2tp_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/l2tp/l2tp_netlink.c +2 -0
@@ -589,6 +589,8 @@ static int l2tp_nl_session_send(struct sif (session->ifname && session->ifname[0 ])NLA_PUT_STRING (skb,L2TP_ATTR_IFNAME , session->ifname); +if (session->offset) +NLA_PUT_U16 (skb,L2TP_ATTR_OFFSET , session->offset);if (session->cookie_len)NLA_PUT (skb,L2TP_ATTR_COOKIE , session->cookie_len, &session->cookie[0 ]);if (session->peer_cookie_len)
PATCH 34/153 scsi: aacraid: Fix udev inquiry race condition
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Raghava Aditya Renukunta <[email protected]>
commit f4e8708d3104437fd7716e957f38c265b0c509ef upstream.
When udev requests for a devices inquiry string, it might create multiple threads causing a race condition on the shared inquiry resource string.
Created a buffer with the string for each thread.
[bwh: Backported to 3.2:
- s/sup_adap_info->adapter_type_text/dev->supplement_adapter_info.AdapterTypeText/
- Adjust context]
---
drivers/scsi/aacraid/aachba.c +12 -5
@@ -758,8 +758,16 @@ static void setinqstr(struct aac_dev *dememset (str,' ' ,sizeof (*str));if (dev->supplement_adapter_info.AdapterTypeText[0 ]) { -char * cp = dev->supplement_adapter_info.AdapterTypeText;int c; +char *cp; +char *cname =kmemdup (dev->supplement_adapter_info.AdapterTypeText, +sizeof (dev->supplement_adapter_info.AdapterTypeText), +GFP_ATOMIC ); + +if (!cname) +return ; + + cp = cname;if ((cp[0 ] =='A' ) && (cp[1 ] =='O' ) && (cp[2 ] =='C' ))inqstrcpy ("SMC" , str->vid);else {
@@ -768,8 +776,7 @@ static void setinqstr(struct aac_dev *de ++cp; c = *cp; *cp ='\0' ; -inqstrcpy (dev->supplement_adapter_info.AdapterTypeText, - str->vid); +inqstrcpy (cname, str->vid); *cp = c;while (*cp && *cp !=' ' ) ++cp;
@@ -783,8 +790,8 @@ static void setinqstr(struct aac_dev *de cp[sizeof (str->pid)] ='\0' ; }inqstrcpy (cp, str->pid); -if (c) - cp[sizeof (str->pid)] = c; + +kfree (cname); }else {struct aac_driver_ident *mp =aac_get_driver_ident (dev->cardtype);
PATCH 35/153 pktcdvd: Fix pkt_setup_dev() error path
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 5a0ec388ef0f6e33841aeb810d7fa23f049ec4cd upstream.
Commit 523e1d399ce0 ("block: make gendisk hold a reference to its queue") modified add_disk() and disk_release() but did not update any of the error paths that trigger a put_disk() call after disk->queue has been assigned. That introduced the following behavior in the pktcdvd driver if pkt_new_dev() fails:
Kernel BUG at 00000000e98fd882 [verbose debug info unavailable]
Since disk_release() calls blk_put_queue() anyway if disk->queue != NULL, fix this by removing the blk_cleanup_queue() call from the pkt_setup_dev() error path.
--- drivers/block/pktcdvd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/block/pktcdvd.c +1 -3
@@ -2885,7 +2885,7 @@ static int pkt_setup_dev(dev_t dev, dev_ pd->pkt_dev =MKDEV (pktdev_major, idx); ret =pkt_new_dev (pd, dev);if (ret) - goto out_new_dev; + goto out_mem2;/* inherit events of the host device */ disk->events = pd->bdev->bd_disk->events;
@@ -2903,8 +2903,6 @@ static int pkt_setup_dev(dev_t dev, dev_mutex_unlock (&ctl_mutex);return 0 ; -out_new_dev: -blk_cleanup_queue (disk->queue); out_mem2:put_disk (disk); out_mem:
PATCH 36/153 signal/sh: Ensure si_signo is initialized in do_divide_error
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 0e88bb002a9b2ee8cc3cc9478ce2dc126f849696 upstream.
Set si_signo.
--- arch/sh/kernel/traps_32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/sh/kernel/traps_32.c +2 -1
@@ -706,7 +706,8 @@ asmlinkage void do_divide_error(unsigned break; } -force_sig_info (SIGFPE , &info, current); + info.si_signo =SIGFPE ; +force_sig_info (info.si_signo, &info, current); }#endif
PATCH 37/153 scsi: libsas: fix error when getting phy events
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <[email protected]>
commit 2b23d9509fd7174b362482cf5f3b5f9a2265bc33 upstream.
The intend purpose here was to goto out if smp_execute_task() returned error. Obviously something got screwed up. We will never get these link error statistics below:
~:/sys/class/sas_phy/phy-1:0:12 # cat invalid_dword_count 0
~:/sys/class/sas_phy/phy-1:0:12 # cat running_disparity_error_count 0
~:/sys/class/sas_phy/phy-1:0:12 # cat loss_of_dword_sync_count 0
~:/sys/class/sas_phy/phy-1:0:12 # cat phy_reset_problem_count 0
Obviously we should goto error handler if smp_execute_task() returns non-zero.
--- drivers/scsi/libsas/sas_expander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +1 -1
@@ -557,7 +557,7 @@ int sas_smp_get_phy_events(struct sas_ph res =smp_execute_task (dev, req,RPEL_REQ_SIZE , resp,RPEL_RESP_SIZE ); -if (!res) +if (res) goto out; phy->invalid_dword_count =scsi_to_u32 (&resp[12 ]);
PATCH 38/153 scsi: aacraid: remove redundant setting of variable c
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 91814744646351a470f256fbcb853fb5a7229a9f upstream.
A previous commit no longer stores the contents of c, so we now have a situation where c is being updated but the value is never read. Clean up the code by removing the now redundant setting of variable c.
Cleans up clang warning:drivers/scsi/aacraid/aachba.c:943:3: warning: Value stored to 'c' is never read
--- drivers/scsi/aacraid/aachba.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/aacraid/aachba.c +1 -4
@@ -784,11 +784,8 @@ static void setinqstr(struct aac_dev *dewhile (*cp ==' ' ) ++cp;/* last six chars reserved for vol type */ - c =0 ; -if (strlen (cp) >sizeof (str->pid)) { - c = cp[sizeof (str->pid)]; +if (strlen (cp) >sizeof (str->pid)) cp[sizeof (str->pid)] ='\0' ; - }inqstrcpy (cp, str->pid);kfree (cname);
PATCH 39/153 ext4: save error to disk in __ext4_grp_locked_error()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zhouyi Zhou <[email protected]>
commit 06f29cc81f0350261f59643a505010531130eea0 upstream.
In the function __ext4_grp_locked_error(), __save_error_info() is called to save error info in super block block, but does not sync that information to disk to info the subsequence fsck after reboot.
This patch writes the error information to disk. After this patch, I think there is no obvious EXT4 error handle branches which leads to "Remounting filesystem read-only" will leave the disk partition miss the subsequence fsck.
--- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/super.c +1 -0
@@ -700,6 +700,7 @@ __acquires(bitlock) }ext4_unlock_group (sb, grp); +ext4_commit_super (sb,1 );ext4_handle_error (sb);/* * We only get here in the ERRORS_RO case; relocking the group
PATCH 40/153 ext4: correct documentation for grpid mount option
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ernesto A. Fernández
<[email protected]>
commit 9f0372488cc9243018a812e8cfbf27de650b187b upstream.
The grpid option is currently described as being the same as nogrpid.
--- Documentation/filesystems/ext4.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/filesystems/ext4.txt +1 -1
@@ -238,7 +238,7 @@ data_err=ignore(*) Just print an error m data_err=abort Abort the journal if an error occurs in a file data buffer in ordered mode. -grpid Give objects the same group ID as their creator. +grpid New objects have the group ID of their parent. bsdgroups nogrpid (*) New objects have the group ID of their creator.
PATCH 41/153 crypto: af_alg - whitelist mask and type
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Mueller <[email protected]>
commit bb30b8848c85e18ca7e371d0a869e94b3e383bdf upstream.
The user space interface allows specifying the type and mask field used to allocate the cipher. Only a subset of the possible flags are intended for user space. Therefore, white-list the allowed flags.
In case the user space caller uses at least one non-allowed flag, EINVAL is returned.
[bwh: Backported to 3.2: The CRYPTO_ALG_KERN_DRIVER_ONLY flag is not supported,
so set allowed to 0]
---
crypto/af_alg.c +5 -0
@@ -149,6 +149,7 @@ EXPORT_SYMBOL_GPL(af_alg_release_parent)static int alg_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) { +const u32 allowed =0 ;struct sock *sk = sock->sk;struct alg_sock *ask =alg_sk (sk);struct sockaddr_alg *sa = (void *)uaddr;
@@ -156,6 +157,10 @@ static int alg_bind(struct socket *sock,void *private;int err; +/* If caller uses non-allowed flag, return error. */ +if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) +return -EINVAL ; +if (sock->state ==SS_CONNECTED )return -EINVAL ;
PATCH 42/153 crypto: hash - introduce crypto_hash_alg_has_setkey()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit cd6ed77ad5d223dc6299fb58f62e0f5267f7e2ba upstream.
Templates that use an shash spawn can use crypto_shash_alg_has_setkey() to determine whether the underlying algorithm requires a key or not. But there was no corresponding function for ahash spawns. Add it.
Note that the new function actually has to support both shash and ahash algorithms, since the ahash API can be used with either.
--- crypto/ahash.c | 11 +++++++++++ include/crypto/internal/hash.h | 2 ++ 2 files changed, 13 insertions(+)
crypto/ahash.c +11 -0
@@ -599,5 +599,16 @@ struct hash_alg_common *ahash_attr_alg(s }EXPORT_SYMBOL_GPL (ahash_attr_alg); +bool crypto_hash_alg_has_setkey (struct hash_alg_common *halg) +{ +struct crypto_alg *alg = &halg->base; + +if (alg->cra_type != &crypto_ahash_type) +return crypto_shash_alg_has_setkey (__crypto_shash_alg (alg)); + +return __crypto_ahash_alg (alg)->setkey !=NULL ; +} +EXPORT_SYMBOL_GPL (crypto_hash_alg_has_setkey); +MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Asynchronous cryptographic hash type" );
include/crypto/internal/hash.h +2 -0
@@ -78,6 +78,8 @@ static inline bool crypto_shash_alg_has_return alg->setkey != shash_no_setkey; } +bool crypto_hash_alg_has_setkey (struct hash_alg_common *halg); +int crypto_init_ahash_spawn (struct crypto_ahash_spawn *spawn,struct hash_alg_common *alg,struct crypto_instance *inst);
PATCH 43/153 crypto: cryptd - pass through absence of ->setkey()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 841a3ff329713f796a63356fef6e2f72e4a3f6a3 upstream.
When the cryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the cryptd instance. This change is necessary for cryptd to keep working with unkeyed hash algorithms once we start enforcing that ->setkey() is called when present.
--- crypto/cryptd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/cryptd.c +2 -1
@@ -617,7 +617,8 @@ static int cryptd_create_hash(struct cry inst->alg.finup = cryptd_hash_finup_enqueue; inst->alg.export = cryptd_hash_export; inst->alg.import = cryptd_hash_import; - inst->alg.setkey = cryptd_hash_setkey; +if (crypto_shash_alg_has_setkey (salg)) + inst->alg.setkey = cryptd_hash_setkey; inst->alg.digest = cryptd_hash_digest_enqueue; err =ahash_register_instance (tmpl, inst);
PATCH 44/153 crypto: hash - annotate algorithms taking optional key
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e upstream.
We need to consistently enforce that keyed hashes cannot be used without setting the key. To do this we need a reliable way to determine whether a given hash algorithm is keyed or not. AF_ALG currently does this by checking for the presence of a ->setkey() method. However, this is actually slightly broken because the CRC-32 algorithms implement ->setkey() but can also be used without a key. (The CRC-32 "key" is not actually a cryptographic key but rather represents the initial state. If not overridden, then a default initial state is used.)
Prepare to fix this by introducing a flag CRYPTO_ALG_OPTIONAL_KEY which indicates that the algorithm has a ->setkey() method, but it is not required to be called. Then set it on all the CRC-32 algorithms.
The same also applies to the Adler-32 implementation in Lustre.
Also, the cryptd and mcryptd templates have to pass through the flag from their underlying algorithm.
[bwh: Backported to 3.2:
- Drop changes to nonexistent drivers
- There's no CRYPTO_ALG_INTERNAL flag
- Adjust filenames]
---
arch/x86/crypto/crc32c-intel.c +1 -0
@@ -166,6 +166,7 @@ static struct shash_alg alg = { .cra_name = "crc32c", .cra_driver_name = "crc32c-intel", .cra_priority = 200, + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize = CHKSUM_BLOCK_SIZE, .cra_ctxsize = sizeof(u32), .cra_module = THIS_MODULE,
crypto/crc32c.c +1 -0
@@ -234,6 +234,7 @@ static struct shash_alg alg = { .cra_name = "crc32c", .cra_driver_name = "crc32c-generic", .cra_priority = 100, + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, .cra_blocksize = CHKSUM_BLOCK_SIZE, .cra_alignmask = 3, .cra_ctxsize = sizeof(struct chksum_ctx),
crypto/cryptd.c +2 -1
@@ -603,7 +603,8 @@ static int cryptd_create_hash(struct cryif (err) goto out_free_inst; - inst->alg.halg.base.cra_flags =CRYPTO_ALG_ASYNC ; + inst->alg.halg.base.cra_flags =CRYPTO_ALG_ASYNC | + (alg->cra_flags &CRYPTO_ALG_OPTIONAL_KEY ); inst->alg.halg.digestsize = salg->digestsize; inst->alg.halg.base.cra_ctxsize =sizeof (struct cryptd_hash_ctx );
include/linux/crypto.h +6 -0
@@ -89,6 +89,12 @@#define CRYPTO_ALG_INSTANCE 0x00000800/* +* Set if the algorithm has a ->setkey() method but can be used without +* calling it first, i.e. there is a default key. +*/ +#define CRYPTO_ALG_OPTIONAL_KEY 0x00004000 + +/* * Transform masks and values (for crt_flags). */ #define CRYPTO_TFM_REQ_MASK 0x000fff00
PATCH 45/153 crypto: hash - prevent using keyed hashes without setting key
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 9fa68f620041be04720d0cbfb1bd3ddfc6310b24 upstream.
Currently, almost none of the keyed hash algorithms check whether a key has been set before proceeding. Some algorithms are okay with this and will effectively just use a key of all 0's or some other bogus default. However, others will severely break, as demonstrated using "hmac(sha3-512-generic)", the unkeyed use of which causes a kernel crash via a (potentially exploitable) stack buffer overflow.
A while ago, this problem was solved for AF_ALG by pairing each hash transform with a 'has_key' bool. However, there are still other places in the kernel where userspace can specify an arbitrary hash algorithm by name, and the kernel uses it as unkeyed hash without checking whether it is really unkeyed. Examples of this include:
- KEYCTL_DH_COMPUTE, via the KDF extension
- dm-verity
- dm-crypt, via the ESSIV support
- dm-integrity, via the "internal hash" mode with no key given
- drbd (Distributed Replicated Block Device)
This bug is especially bad for KEYCTL_DH_COMPUTE as that requires no privileges to call.
Fix the bug for all users by adding a flag CRYPTO_TFM_NEED_KEY to the ->crt_flags of each hash transform that indicates whether the transform still needs to be keyed or not. Then, make the hash init, import, and digest functions return -ENOKEY if the key is still needed.
The new flag also replaces the 'has_key' bool which algif_hash was previously using, thereby simplifying the algif_hash implementation.
[bwh: Backported to 3.2:
- In hash_accept_parent_nokey(), update initialisation of ds to use tfm
- Adjust context]
---
crypto/ahash.c +17 -5
@@ -172,11 +172,18 @@ int crypto_ahash_setkey(struct crypto_ah unsigned int keylen) {unsigned long alignmask =crypto_ahash_alignmask (tfm); +int err;if ((unsigned long )key & alignmask) -return ahash_setkey_unaligned (tfm, key, keylen); + err =ahash_setkey_unaligned (tfm, key, keylen); +else + err = tfm->setkey (tfm, key, keylen); + +if (err) +return err; -return tfm->setkey (tfm, key, keylen); +crypto_ahash_clear_flags (tfm,CRYPTO_TFM_NEED_KEY ); +return 0 ; }EXPORT_SYMBOL_GPL (crypto_ahash_setkey);
@@ -349,7 +356,12 @@ EXPORT_SYMBOL_GPL(crypto_ahash_finup);int crypto_ahash_digest (struct ahash_request *req) { -return crypto_ahash_op (req,crypto_ahash_reqtfm (req)->digest); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (req); + +if (crypto_ahash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; + +return crypto_ahash_op (req, tfm->digest); }EXPORT_SYMBOL_GPL (crypto_ahash_digest);
@@ -435,7 +447,6 @@ static int crypto_ahash_init_tfm(structstruct ahash_alg *alg =crypto_ahash_alg (hash); hash->setkey = ahash_nosetkey; - hash->has_setkey = false; hash->export = ahash_no_export; hash->import = ahash_no_import;
@@ -450,7 +461,8 @@ static int crypto_ahash_init_tfm(structif (alg->setkey) { hash->setkey = alg->setkey; - hash->has_setkey = true; +if (!(alg->halg.base.cra_flags &CRYPTO_ALG_OPTIONAL_KEY )) +crypto_ahash_set_flags (hash,CRYPTO_TFM_NEED_KEY ); }if (alg->export) hash->export = alg->export;
crypto/algif_hash.c +12 -42
106 lines not on this page · raw message
crypto/shash.c +21 -4
@@ -57,11 +57,18 @@ int crypto_shash_setkey(struct crypto_sh {struct shash_alg *shash =crypto_shash_alg (tfm);unsigned long alignmask =crypto_shash_alignmask (tfm); +int err;if ((unsigned long )key & alignmask) -return shash_setkey_unaligned (tfm, key, keylen); + err =shash_setkey_unaligned (tfm, key, keylen); +else + err = shash->setkey (tfm, key, keylen); + +if (err) +return err; -return shash->setkey (tfm, key, keylen); +crypto_shash_clear_flags (tfm,CRYPTO_TFM_NEED_KEY ); +return 0 ; }EXPORT_SYMBOL_GPL (crypto_shash_setkey);
@@ -179,6 +186,9 @@ int crypto_shash_digest(struct shash_desstruct shash_alg *shash =crypto_shash_alg (tfm);unsigned long alignmask =crypto_shash_alignmask (tfm); +if (crypto_shash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; +if (((unsigned long )data | (unsigned long )out) & alignmask)return shash_digest_unaligned (desc, data, len, out);
@@ -358,7 +368,8 @@ int crypto_init_shash_ops_async(struct c crt->digest = shash_async_digest; crt->setkey = shash_async_setkey; - crt->has_setkey = alg->setkey != shash_no_setkey; +crypto_ahash_set_flags (crt,crypto_shash_get_flags (shash) & +CRYPTO_TFM_NEED_KEY );if (alg->export) crt->export = shash_async_export;
@@ -518,8 +529,14 @@ static unsigned int crypto_shash_ctxsizestatic int crypto_shash_init_tfm (struct crypto_tfm *tfm) {struct crypto_shash *hash =__crypto_shash_cast (tfm); +struct shash_alg *alg =crypto_shash_alg (hash); + + hash->descsize = alg->descsize; + +if (crypto_shash_alg_has_setkey (alg) && + !(alg->base.cra_flags &CRYPTO_ALG_OPTIONAL_KEY )) +crypto_shash_set_flags (hash,CRYPTO_TFM_NEED_KEY ); - hash->descsize =crypto_shash_alg (hash)->descsize;return 0 ; }
include/crypto/hash.h +24 -10
@@ -94,7 +94,6 @@ struct crypto_ahash { unsigned int keylen);unsigned int reqsize; -bool has_setkey;struct crypto_tfm base; };
@@ -182,11 +181,6 @@ static inline void *ahash_request_ctx(stint crypto_ahash_setkey (struct crypto_ahash *tfm,const u8 *key,unsigned int keylen); -static inline bool crypto_ahash_has_setkey (struct crypto_ahash *tfm) -{ -return tfm->has_setkey; -} -int crypto_ahash_finup (struct ahash_request *req);int crypto_ahash_final (struct ahash_request *req);int crypto_ahash_digest (struct ahash_request *req);
@@ -198,12 +192,22 @@ static inline int crypto_ahash_export(ststatic inline int crypto_ahash_import (struct ahash_request *req,const void *in) { -return crypto_ahash_reqtfm (req)->import (req, in); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (req); + +if (crypto_ahash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; + +return tfm->import (req, in); }static inline int crypto_ahash_init (struct ahash_request *req) { -return crypto_ahash_reqtfm (req)->init (req); +struct crypto_ahash *tfm =crypto_ahash_reqtfm (req); + +if (crypto_ahash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; + +return tfm->init (req); }static inline int crypto_ahash_update (struct ahash_request *req)
@@ -342,12 +346,22 @@ static inline int crypto_shash_export(ststatic inline int crypto_shash_import (struct shash_desc *desc,const void *in) { -return crypto_shash_alg (desc->tfm)->import (desc, in); +struct crypto_shash *tfm = desc->tfm; + +if (crypto_shash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; + +return crypto_shash_alg (tfm)->import (desc, in); }static inline int crypto_shash_init (struct shash_desc *desc) { -return crypto_shash_alg (desc->tfm)->init (desc); +struct crypto_shash *tfm = desc->tfm; + +if (crypto_shash_get_flags (tfm) &CRYPTO_TFM_NEED_KEY ) +return -ENOKEY ; + +return crypto_shash_alg (tfm)->init (desc); } int crypto_shash_update(struct shash_desc *desc, const u8 *data,
include/linux/crypto.h +2 -0
@@ -97,6 +97,8 @@/* * Transform masks and values (for crt_flags). */ +#define CRYPTO_TFM_NEED_KEY 0x00000001 +#define CRYPTO_TFM_REQ_MASK 0x000fff00#define CRYPTO_TFM_RES_MASK 0xfff00000
PATCH 46/153 signal/openrisc: Fix do_unaligned_access to send the proper signal
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 500d58300571b6602341b041f97c082a461ef994 upstream.
While reviewing the signal sending on openrisc the do_unaligned_access function stood out because it is obviously wrong. A comment about an si_code set above when actually si_code is never set. Leading to a random si_code being sent to userspace in the event of an unaligned access.
Looking further SIGBUS BUS_ADRALN is the proper pair of signal and si_code to send for an unaligned access. That is what other architectures do and what is required by posix.
Given that do_unaligned_access is broken in a way that no one can be relying on it on openrisc fix the code to just do the right thing.
--- arch/openrisc/kernel/traps.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/openrisc/kernel/traps.c +5 -5
@@ -313,12 +313,12 @@ asmlinkage void do_unaligned_access(strusiginfo_t info;if (user_mode (regs)) { -/* Send a SIGSEGV */ - info.si_signo =SIGSEGV ; +/* Send a SIGBUS */ + info.si_signo =SIGBUS ; info.si_errno =0 ; -/* info.si_code has been set above */ - info.si_addr = (void *)address; -force_sig_info (SIGSEGV , &info, current); + info.si_code =BUS_ADRALN ; + info.si_addr = (void __user *)address; +force_sig_info (SIGBUS , &info, current); }else {printk ("KERNEL: Unaligned Access 0x%.8lx\n" , address);show_registers (regs);
PATCH 47/153 mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 6ac1dc736b323011a55ecd1fc5897c24c4f77cbd upstream.
Setting si_code to 0 is the same a setting si_code to SI_USER which is definitely not correct. With si_code set to SI_USER si_pid and si_uid will be copied to userspace instead of si_addr. Which is very wrong.
So fix this by using a sensible si_code (SEGV_MAPERR) for this failure.
--- arch/mn10300/mm/misalignment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mn10300/mm/misalignment.c +1 -1
@@ -438,7 +438,7 @@ transfer_failed: info.si_signo =SIGSEGV ; info.si_errno =0 ; - info.si_code =0 ; + info.si_code =SEGV_MAPERR ; info.si_addr = (void *) regs->pc;force_sig_info (SIGSEGV , &info, current);return ;
PATCH 48/153 console/dummy: leave .con_font_get set to NULL
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit 724ba8b30b044aa0d94b1cd374fc15806cdd6f18 upstream.
When this method is set, the caller expects struct console_font fields to be properly initialized when it returns. Leave it unset otherwise nonsensical (leaked kernel stack) values are returned to user space.
--- drivers/video/console/dummycon.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/console/dummycon.c +0 -1
@@ -71,7 +71,6 @@ const struct consw dummy_con = { .con_switch = DUMMY, .con_blank = DUMMY, .con_font_set = DUMMY, - .con_font_get = DUMMY, .con_font_default = DUMMY, .con_font_copy = DUMMY, .con_set_palette = DUMMY,
PATCH 49/153 ASoC: au1x: Fix timeout tests in au1xac97c_ac97_read()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 123af9043e93cb6f235207d260d50f832cdb5439 upstream.
The loop timeout doesn't work because it's a post op and ends with "tmo" set to -1. I changed it from a post-op to a pre-op and I changed the initial the starting value from 5 to 6 so we still iterate 5 times. I left the other as it was because it's a large number.
--- sound/soc/au1x/ac97c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/au1x/ac97c.c +3 -3
@@ -91,8 +91,8 @@ static unsigned short au1xac97c_ac97_rea do { mutex_lock(&ctx->lock); - tmo = 5; - while ((RD(ctx, AC97_STATUS) & STAT_CP) && tmo--) + tmo = 6; + while ((RD(ctx, AC97_STATUS) & STAT_CP) && --tmo) udelay(21); /* wait an ac97 frame time */ if (!tmo) { pr_debug("ac97rd timeout #1\n");
@@ -105,7 +105,7 @@ static unsigned short au1xac97c_ac97_rea* poll, Forrest, poll... */ tmo =0x10000 ; -while ((RD (ctx,AC97_STATUS ) &STAT_CP ) && tmo--) +while ((RD (ctx,AC97_STATUS ) &STAT_CP ) && --tmo) asmvolatile ("nop" ); data =RD (ctx,AC97_CMDRESP );
PATCH 50/153 hrtimer: Ensure POSIX compliance (relative CLOCK_REALTIME hrtimers)
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anna-Maria Gleixner <[email protected]>
commit 48d0c9becc7f3c66874c100c126459a9da0fdced upstream.
The POSIX specification defines that relative CLOCK_REALTIME timers are not affected by clock modifications. Those timers have to use CLOCK_MONOTONIC to ensure POSIX compliance.
The introduction of the additional HRTIMER_MODE_PINNED mode broke this requirement for pinned timers.
There is no user space visible impact because user space timers are not using pinned mode, but for consistency reasons this needs to be fixed.
Check whether the mode has the HRTIMER_MODE_REL bit set instead of comparing with HRTIMER_MODE_ABS.
--- kernel/hrtimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/hrtimer.c +6 -1
@@ -1200,7 +1200,12 @@ static void __hrtimer_init(struct hrtime cpu_base = &__raw_get_cpu_var (hrtimer_bases); -if (clock_id ==CLOCK_REALTIME && mode !=HRTIMER_MODE_ABS ) +/* +* POSIX magic: Relative CLOCK_REALTIME timers are not affected by +* clock modifications, so they needs to become CLOCK_MONOTONIC to +* ensure POSIX compliance. +*/ +if (clock_id ==CLOCK_REALTIME && mode &HRTIMER_MODE_REL ) clock_id =CLOCK_MONOTONIC ; base =hrtimer_clockid_to_base (clock_id);
PATCH 51/153 USB: cdc-acm: Do not log urb submission errors on disconnect
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit f0386c083c2ce85284dc0b419d7b89c8e567c09f upstream.
When disconnected sometimes the cdc-acm driver logs errors like these:
[20278.039417] cdc_acm 2-2:2.1: urb 9 failed submission with -19 [20278.042924] cdc_acm 2-2:2.1: urb 10 failed submission with -19 [20278.046449] cdc_acm 2-2:2.1: urb 11 failed submission with -19 [20278.049920] cdc_acm 2-2:2.1: urb 12 failed submission with -19 [20278.053442] cdc_acm 2-2:2.1: urb 13 failed submission with -19 [20278.056915] cdc_acm 2-2:2.1: urb 14 failed submission with -19 [20278.060418] cdc_acm 2-2:2.1: urb 15 failed submission with -19
Silence these by not logging errors when the result is -ENODEV.
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -353,7 +353,7 @@ static int acm_submit_read_urb(struct ac res =usb_submit_urb (acm->read_urbs[index], mem_flags);if (res) { -if (res != -EPERM ) { +if (res != -EPERM && res != -ENODEV ) {dev_err (&acm->data->dev,"%s - usb_submit_urb failed: %d\n" , __func__, res);
PATCH 52/153 dm thin: fix documentation relative to low water mark threshold
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: mulhern <[email protected]>
commit 9b28a1102efc75d81298198166ead87d643a29ce upstream.
Fixes:
1. The use of "exceeds" when the opposite of exceeds, falls below, was meant.
2. Properly speaking, a table can not exceed a threshold.
It emphasizes the important point, which is that it is the userspace daemon's responsibility to check for low free space when a device is resumed, since it won't get a special event indicating low free space in that situation.
--- Documentation/device-mapper/thin-provisioning.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Documentation/device-mapper/thin-provisioning.txt +5 -3
@@ -109,9 +109,11 @@ $low_water_mark is expressed in blocks o 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. Thin provisioning -----------------
PATCH 53/153 ubi: Fix race condition between ubi volume creation and udev
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Clay McClure <[email protected]>
commit a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 upstream.
Similar to commit 714fb87e8bc0 ("ubi: Fix race condition between ubi device creation and udev"), we should make the volume active before registering it.
--- drivers/mtd/ubi/vmt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/mtd/ubi/vmt.c +10 -5
@@ -312,6 +312,12 @@ int ubi_create_volume(struct ubi_device vol->last_eb_bytes = vol->usable_leb_size; } +/* Make volume "available" before it becomes accessible via sysfs */ +spin_lock (&ubi->volumes_lock); + ubi->volumes[vol_id] = vol; + ubi->vol_count +=1 ; +spin_unlock (&ubi->volumes_lock); +/* Register character device for the volume */ cdev_init (&vol->cdev, &ubi_vol_cdev_operations); vol->cdev.owner =THIS_MODULE ;
@@ -354,11 +360,6 @@ int ubi_create_volume(struct ubi_deviceif (err) goto out_sysfs; -spin_lock (&ubi->volumes_lock); - ubi->volumes[vol_id] = vol; - ubi->vol_count +=1 ; -spin_unlock (&ubi->volumes_lock); -ubi_volume_notify (ubi, vol,UBI_VOLUME_ADDED );if (paranoid_check_volumes (ubi))dbg_err ("check failed while creating volume %d" , vol_id);
@@ -379,6 +380,10 @@ out_sysfs: out_cdev:cdev_del (&vol->cdev); out_mapping: +spin_lock (&ubi->volumes_lock); + ubi->volumes[vol_id] =NULL ; + ubi->vol_count -=1 ; +spin_unlock (&ubi->volumes_lock);if (do_free)kfree (vol->eba_tbl); out_acc:
PATCH 54/153 drm/ttm: Don't add swapped BOs to swap-LRU list
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
commit fd5002d6a3c602664b07668a24df4ef7a43bf078 upstream.
A BO that's already swapped would be added back to the swap-LRU list for example if its validation failed under high memory pressure. This could later lead to swapping it out again and leaking previous swap storage.
This commit adds a condition to prevent that from happening.
v2: Check page_flags instead of swap_storage
[bwh: Backported to 3.2: We aren't checking for TTM_PAGE_FLAG_SG here as that's
not defined]
---
drivers/gpu/drm/ttm/ttm_bo.c +1 -1
@@ -184,7 +184,7 @@ void ttm_bo_add_to_lru(struct ttm_bufferlist_add_tail (&bo->lru, &man->lru);kref_get (&bo->list_kref); -if (bo->ttm !=NULL ) { +if (bo->ttm && !(bo->ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )) {list_add_tail (&bo->swap, &bo->glob->swap_lru);kref_get (&bo->list_kref); }
PATCH 55/153 MIPS: Fix clean of vmlinuz.{32,ecoff,bin,srec}
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 5f2483eb2423152445b39f2db59d372f523e664e upstream.
Make doesn't expand shell style "vmlinuz.{32,ecoff,bin,srec}" to the 4 separate files, so none of these files get cleaned up by make clean. List the files separately instead.
Patchwork: https://patchwork.linux-mips.org/patch/18491/
--- arch/mips/boot/compressed/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/mips/boot/compressed/Makefile +5 -1
@@ -105,4 +105,8 @@ OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFL vmlinuz.srec: vmlinuz $(call cmd,objcopy) -clean-files := $(objtree)/vmlinuz $(objtree)/vmlinuz.{32,ecoff,bin,srec} +clean-files += $(objtree)/vmlinuz +clean-files += $(objtree)/vmlinuz.32 +clean-files += $(objtree)/vmlinuz.ecoff +clean-files += $(objtree)/vmlinuz.bin +clean-files += $(objtree)/vmlinuz.srec
PATCH 56/153 alpha: fix reboot on Avanti platform
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 55fc633c41a08ce9244ff5f528f420b16b1e04d6 upstream.
We need to define NEED_SRM_SAVE_RESTORE on the Avanti, otherwise we get machine check exception when attempting to reboot the machine.
--- arch/alpha/kernel/pci_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/alpha/kernel/pci_impl.h +2 -1
@@ -143,7 +143,8 @@ struct pci_iommu_arena };#if defined(CONFIG_ALPHA_SRM ) && \ - (defined(CONFIG_ALPHA_CIA ) || defined(CONFIG_ALPHA_LCA )) + (defined(CONFIG_ALPHA_CIA ) || defined(CONFIG_ALPHA_LCA ) || \ + defined(CONFIG_ALPHA_AVANTI ))# define NEED_SRM_SAVE_RESTORE #else # undef NEED_SRM_SAVE_RESTORE
PATCH 57/153 alpha: fix crash if pthread_create races with signal delivery
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 21ffceda1c8b3807615c40d440d7815e0c85d366 upstream.
On alpha, a process will crash if it attempts to start a thread and a signal is delivered at the same time. The crash can be reproduced with this program: https://cygwin.com/ml/cygwin/2014-11/msg00473.html
The reason for the crash is this:
* we call the clone syscall
* we go to the function copy_process
* copy process calls copy_thread_tls, it is a wrapper around copy_thread
* copy_thread sets the tls pointer: childti->pcb.unique = regs->r20
* copy_thread sets regs->r20 to zero
* we go back to copy_process
* copy process checks "if (signal_pending(current))" and returns -ERESTARTNOINTR
* the clone syscall is restarted, but this time, regs->r20 is zero, so the new thread is created with zero tls pointer
* the new thread crashes in start_thread when attempting to access tls
The comment in the code says that setting the register r20 is some compatibility with OSF/1. But OSF/1 doesn't use the CLONE_SETTLS flag, so we don't have to zero r20 if CLONE_SETTLS is set. This patch fixes the bug by zeroing regs->r20 only if CLONE_SETTLS is not set.
[bwh: Backported to 3.2:
- Remove the settls variable, which was done upstream in commit 25906730ec01 "alpha: reorganize copy_process(), prepare to saner fork_idle()"]
- Adjust context]
---
arch/alpha/kernel/process.c +5 -7
@@ -279,7 +279,7 @@ copy_thread(unsigned long clone_flags, ustruct thread_info *childti =task_thread_info (p);struct pt_regs * childregs;struct switch_stack * childstack, *stack; -unsigned long stack_offset, settls; +unsigned long stack_offset; stack_offset =PAGE_SIZE -sizeof (struct pt_regs );if (!(regs->ps &8 ))
@@ -288,11 +288,9 @@ copy_thread(unsigned long clone_flags, u (stack_offset +PAGE_SIZE +task_stack_page (p)); *childregs = *regs; - settls = regs->r20; childregs->r0 =0 ; childregs->r19 =0 ; childregs->r20 =1 ;/* OSF/1 has some strange fork() semantics. */ - regs->r20 =0 ; stack = ((struct switch_stack *) regs) -1 ; childstack = ((struct switch_stack *) childregs) -1 ; *childstack = *stack;
@@ -302,16 +300,16 @@ copy_thread(unsigned long clone_flags, u childti->pcb.flags =1 ;/* set FEN, clear everything else */ /* Set a new TLS for the child thread? Peek back into the -syscall arguments that we saved on syscall entry. Oops, -except we'd have clobbered it with the parent/child set -of r20. Read the saved copy. */ +syscall arguments that we saved on syscall entry. */ /* Note: if CLONE_SETTLS is not set, then we must inherit the value from the parent, which will have been set by the block copy in dup_task_struct. This is non-intuitive, but is required for proper operation in the case of a threaded application calling fork. */ if (clone_flags &CLONE_SETTLS ) - childti->pcb.unique = settls; + childti->pcb.unique = regs->r20; +else + regs->r20 =0 ;/* OSF/1 has some strange fork() semantics. */ return 0 ; }
PATCH 58/153 CDC-ACM: apply quirk for card reader
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit df1cc78a52491f71d8170d513d0f6f114faa1bda upstream.
This devices drops random bytes from messages if you talk to it too fast.
--- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/class/cdc-acm.c +3 -0
@@ -1530,6 +1530,9 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */ .driver_info =SINGLE_RX_URB ,/* firmware bug */ }, + { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */ + .driver_info = SINGLE_RX_URB, + }, { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ },
PATCH 59/153 scsi: fas216: fix sense buffer initialization
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 96d5eaa9bb74d299508d811d865c2c41b38b0301 upstream.
While testing with the ARM specific memset() macro removed, I ran into a compiler warning that shows an old bug:
drivers/scsi/arm/fas216.c: In function 'fas216_rq_sns_done':drivers/scsi/arm/fas216.c:2014:40: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to provide an explicit length? [-Werror=sizeof-pointer-memaccess]
It turns out that the definition of the scsi_cmd structure changed back in linux-2.6.25, so now we clear only four bytes (sizeof(pointer)) instead of 96 (SCSI_SENSE_BUFFERSIZE). I did not check whether we actually need to initialize the buffer here, but it's clear that if we do it, we should use the correct size.
--- drivers/scsi/arm/fas216.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/arm/fas216.c +1 -1
@@ -2009,7 +2009,7 @@ static void fas216_rq_sns_done(FAS216_In* 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"); } /*
PATCH 60/153 s390: fix handling of -1 in set{,fs}[gu]id16 syscalls
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eugene Syromiatnikov <[email protected]>
commit 6dd0d2d22aa363fec075cb2577ba273ac8462e94 upstream.
For some reason, the implementation of some 16-bit ID system calls (namely, setuid16/setgid16 and setfsuid16/setfsgid16) used type cast instead of low2highgid/low2highuid macros for converting [GU]IDs, which led to incorrect handling of value of -1 (which ought to be considered invalid).
Discovered by strace test suite.
--- arch/s390/kernel/compat_linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kernel/compat_linux.c +4 -4
@@ -114,7 +114,7 @@ asmlinkage long sys32_setregid16(u16 rgiasmlinkage long sys32_setgid16 (u16 gid) { -return sys_setgid ((gid_t )gid); +return sys_setgid (low2highgid (gid)); }asmlinkage long sys32_setreuid16 (u16 ruid,u16 euid)
@@ -124,7 +124,7 @@ asmlinkage long sys32_setreuid16(u16 ruiasmlinkage long sys32_setuid16 (u16 uid) { -return sys_setuid ((uid_t )uid); +return sys_setuid (low2highuid (uid)); }asmlinkage long sys32_setresuid16 (u16 ruid,u16 euid,u16 suid)
@@ -163,12 +163,12 @@ asmlinkage long sys32_getresgid16(u16 __asmlinkage long sys32_setfsuid16 (u16 uid) { -return sys_setfsuid ((uid_t )uid); +return sys_setfsuid (low2highuid (uid)); }asmlinkage long sys32_setfsgid16 (u16 gid) { -return sys_setfsgid ((gid_t )gid); +return sys_setfsgid (low2highgid (gid)); }static int groups16_to_user (u16 __user *grouplist,struct group_info *group_info)
PATCH 61/153 HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 upstream.
We get the "new_profile_index" value from the mouse device when we're handling raw events. Smatch taints it as untrusted data and complains that we need a bounds check. This seems like a reasonable warning otherwise there is a small read beyond the end of the array.
--- drivers/hid/hid-roccat-kovaplus.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-roccat-kovaplus.c +2 -0
@@ -37,6 +37,8 @@ static uint kovaplus_convert_event_cpi(ustatic 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;
PATCH 62/153 cifs: Fix missing put_xid in cifs_file_strict_mmap
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox <[email protected]>
commit f04a703c3d613845ae3141bfaf223489de8ab3eb upstream.
If cifs_zap_mapping() returned an error, we would return without putting the xid that we got earlier. Restructure cifs_file_strict_mmap() and cifs_file_mmap() to be more similar to each other and have a single point of return that always puts the xid.
--- fs/cifs/file.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
fs/cifs/file.c +12 -14
@@ -2530,20 +2530,18 @@ static struct vm_operations_struct cifs_int cifs_file_strict_mmap (struct file *file,struct vm_area_struct *vma) { -int rc, xid; +int xid, rc =0 ;struct inode *inode = file->f_path.dentry->d_inode; xid =GetXid (); -if (!CIFS_I (inode)->clientCanCacheRead) { +if (!CIFS_I (inode)->clientCanCacheRead) rc =cifs_invalidate_mapping (inode); -if (rc) -return rc; - } - - rc =generic_file_mmap (file, vma); -if (rc ==0 ) +if (!rc) + rc =generic_file_mmap (file, vma); +if (!rc) vma->vm_ops = &cifs_file_vm_ops; +FreeXid (xid);return rc; }
@@ -2553,15 +2551,15 @@ int cifs_file_mmap(struct file *file, stint rc, xid; xid =GetXid (); + rc =cifs_revalidate_file (file); -if (rc) { +if (rc)cFYI (1 ,"Validation prior to mmap failed, error=%d" , rc); -FreeXid (xid); -return rc; - } - rc =generic_file_mmap (file, vma); -if (rc ==0 ) +if (!rc) + rc =generic_file_mmap (file, vma); +if (!rc) vma->vm_ops = &cifs_file_vm_ops; +FreeXid (xid);return rc; }
PATCH 63/153 USB: serial: pl2303: new device id for Chilitag
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d08dd3f3dd2ae351b793fc5b76abdbf0fd317b12 upstream.
This adds a new device id for Chilitag devices to the pl2303 driver.
--- drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/pl2303.c +1 -0
@@ -45,6 +45,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_CHILITAG) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
drivers/usb/serial/pl2303.h +1 -0
@@ -17,6 +17,7 @@#define PL2303_PRODUCT_ID_DCU11 0x1234#define PL2303_PRODUCT_ID_PHAROS 0xaaa0#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 +#define PL2303_PRODUCT_ID_CHILITAG 0xaaa8#define PL2303_PRODUCT_ID_ALDIGA 0x0611#define PL2303_PRODUCT_ID_MMX 0x0612#define PL2303_PRODUCT_ID_GPRS 0x0609
PATCH 64/153 jffs2: Fix use-after-free bug in jffs2_iget()'s error handling path
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jake Daryll Obina <[email protected]>
commit 5bdd0c6f89fba430e18d636493398389dadc3b17 upstream.
If jffs2_iget() fails for a newly-allocated inode, jffs2_do_clear_inode() can get called twice in the error handling path, the first call in jffs2_iget() itself and the second through iget_failed(). This can result to a use-after-free error in the second jffs2_do_clear_inode() call, such as shown by the oops below wherein the second jffs2_do_clear_inode() call was trying to free node fragments that were already freed in the first jffs2_do_clear_inode() call.
[ 78.178860] jffs2: error: (1904) jffs2_do_read_inode_internal: CRC failed for read_inode of inode 24 at physical location 0x1fc00c [ 78.178914] Unable to handle kernel paging request at virtual address 6b6b6b6b6b6b6b7b [ 78.185871] pgd = ffffffc03a567000 [ 78.188794] [6b6b6b6b6b6b6b7b] *pgd=0000000000000000, *pud=0000000000000000 [ 78.194968] Internal error: Oops: 96000004 [#1] PREEMPT SMP ... [ 78.513147] PC is at rb_first_postorder+0xc/0x28 [ 78.516503] LR is at jffs2_kill_fragtree+0x28/0x90 [jffs2] [ 78.520672] pc : [<ffffff8008323d28>] lr : [<ffffff8000eb1cc8>] pstate: 60000105 [ 78.526757] sp : ffffff800cea38f0 [ 78.528753] x29: ffffff800cea38f0 x28: ffffffc01f3f8e80 [ 78.532754] x27: 0000000000000000 x26: ffffff800cea3c70 [ 78.536756] x25: 00000000dc67c8ae x24: ffffffc033d6945d [ 78.540759] x23: ffffffc036811740 x22: ffffff800891a5b8 [ 78.544760] x21: 0000000000000000 x20: 0000000000000000 [ 78.548762] x19: ffffffc037d48910 x18: ffffff800891a588 [ 78.552764] x17: 0000000000000800 x16: 0000000000000c00 [ 78.556766] x15: 0000000000000010 x14: 6f2065646f6e695f [ 78.560767] x13: 6461657220726f66 x12: 2064656c69616620 [ 78.564769] x11: 435243203a6c616e x10: 7265746e695f6564 [ 78.568771] x9 : 6f6e695f64616572 x8 : ffffffc037974038 [ 78.572774] x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000008 [ 78.576775] x5 : 002f91d85bd44a2f x4 : 0000000000000000 [ 78.580777] x3 : 0000000000000000 x2 : 000000403755e000 [ 78.584779] x1 : 6b6b6b6b6b6b6b6b x0 : 6b6b6b6b6b6b6b6b ... [ 79.038551] [<ffffff8008323d28>] rb_first_postorder+0xc/0x28 [ 79.042962] [<ffffff8000eb5578>] jffs2_do_clear_inode+0x88/0x100 [jffs2] [ 79.048395] [<ffffff8000eb9ddc>] jffs2_evict_inode+0x3c/0x48 [jffs2] [ 79.053443] [<ffffff8008201ca8>] evict+0xb0/0x168 [ 79.056835] [<ffffff8008202650>] iput+0x1c0/0x200 [ 79.060228] [<ffffff800820408c>] iget_failed+0x30/0x3c [ 79.064097] [<ffffff8000eba0c0>] jffs2_iget+0x2d8/0x360 [jffs2] [ 79.068740] [<ffffff8000eb0a60>] jffs2_lookup+0xe8/0x130 [jffs2] [ 79.073434] [<ffffff80081f1a28>] lookup_slow+0x118/0x190 [ 79.077435] [<ffffff80081f4708>] walk_component+0xfc/0x28c [ 79.081610] [<ffffff80081f4dd0>] path_lookupat+0x84/0x108 [ 79.085699] [<ffffff80081f5578>] filename_lookup+0x88/0x100 [ 79.089960] [<ffffff80081f572c>] user_path_at_empty+0x58/0x6c [ 79.094396] [<ffffff80081ebe14>] vfs_statx+0xa4/0x114 [ 79.098138] [<ffffff80081ec44c>] SyS_newfstatat+0x58/0x98 [ 79.102227] [<ffffff800808354c>] __sys_trace_return+0x0/0x4 [ 79.106489] Code: d65f03c0 f9400001 b40000e1 aa0103e0 (f9400821)
The jffs2_do_clear_inode() call in jffs2_iget() is unnecessary since iget_failed() will eventually call jffs2_do_clear_inode() if needed, so just remove it.
--- fs/jffs2/fs.c | 1 - 1 file changed, 1 deletion(-)
fs/jffs2/fs.c +0 -1
@@ -352,7 +352,6 @@ error_io: ret = -EIO ; error:mutex_unlock (&f->sem); -jffs2_do_clear_inode (c, f);iget_failed (inode);return ERR_PTR (ret); }
PATCH 65/153 media: cxusb, dib0700: ignore XC2028_I2C_FLUSH
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 9893b905e743ded332575ca04486bd586c0772f7 upstream.
The XC2028_I2C_FLUSH only needs to be implemented on a few devices. Others can safely ignore it.
That prevents filling the dmesg with lots of messages like:
dib0700: stk7700ph_xc3028_callback: unknown command 2, arg 0
--- drivers/media/dvb/dvb-usb/cxusb.c | 2 ++ drivers/media/dvb/dvb-usb/dib0700_devices.c | 1 + 2 files changed, 3 insertions(+)
drivers/media/dvb/dvb-usb/cxusb.c +2 -0
@@ -772,6 +772,8 @@ static int dvico_bluebird_xc2028_callbaccase XC2028_RESET_CLK :deb_info ("%s: XC2028_RESET_CLK %d\n" , __func__, arg);break ; +case XC2028_I2C_FLUSH : +break ;default :deb_info ("%s: unknown command %d, arg %d\n" , __func__, command, arg);
drivers/media/dvb/dvb-usb/dib0700_devices.c +1 -0
@@ -405,6 +405,7 @@ static int stk7700ph_xc3028_callback(voidib7000p_set_gpio (adap->fe_adap[0 ].fe,8 ,0 ,1 );break ;case XC2028_RESET_CLK : +case XC2028_I2C_FLUSH :break ;default : err("%s: unknown command %d, arg %d\n", __func__,
PATCH 66/153 scsi: ibmvfc: fix misdefined reserved field in ibmvfc_fcp_rsp_info
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tyrel Datwyler <[email protected]>
commit c39813652700f3df552b6557530f1e5f782dbe2f upstream.
The fcp_rsp_info structure as defined in the FC spec has an initial 3 bytes reserved field. The ibmvfc driver mistakenly defined this field as 4 bytes resulting in the rsp_code field being defined in what should be the start of the second reserved field and thus always being reported as zero by the driver.
Ideally, we should wire ibmvfc up with libfc for the sake of code deduplication, and ease of maintaining standardized structures in a single place. However, for now simply fixup the definition in ibmvfc for backporting to distros on older kernels. Wiring up with libfc will be done in a followup patch.
--- drivers/scsi/ibmvscsi/ibmvfc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvfc.h +1 -1
@@ -365,7 +365,7 @@ enum ibmvfc_fcp_rsp_info_codes { };struct ibmvfc_fcp_rsp_info { -u16 reserved; +u8 reserved[3 ];u8 rsp_code;u8 reserved2[4 ]; }__attribute__((packed,aligned (2 )));
PATCH 67/153 netfilter: ipt_CLUSTERIP: fix out-of-bounds accesses in clusterip_tg_check()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Vyukov <[email protected]>
commit 1a38956cce5eabd7b74f94bab70265e4df83165e upstream.
Commit 136e92bbec0a switched local_nodes from an array to a bitmask but did not add proper bounds checks. As the result clusterip_config_init_nodelist() can both over-read ipt_clusterip_tgt_info.local_nodes and over-write clusterip_config.local_nodes.
Add bounds checks for both.
--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/ipv4/netfilter/ipt_CLUSTERIP.c +13 -3
@@ -354,7 +354,7 @@ static int clusterip_tg_check(const strustruct ipt_clusterip_tgt_info *cipinfo = par->targinfo;const struct ipt_entry *e = par->entryinfo;struct clusterip_config *config; -int ret; +int ret, i; if (cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP && cipinfo->hash_mode != CLUSTERIP_HASHMODE_SIP_SPT &&
@@ -368,8 +368,18 @@ static int clusterip_tg_check(const strupr_info ("Please specify destination IP\n" );return -EINVAL ; } - -/* FIXME: further sanity checks */ +if (cipinfo->num_local_nodes >ARRAY_SIZE (cipinfo->local_nodes)) { +pr_info ("bad num_local_nodes %u\n" , cipinfo->num_local_nodes); +return -EINVAL ; + } +for (i =0 ; i < cipinfo->num_local_nodes; i++) { +if (cipinfo->local_nodes[i] -1 >= +sizeof (config->local_nodes) *8 ) { +pr_info ("bad local_nodes[%d] %u\n" , + i, cipinfo->local_nodes[i]); +return -EINVAL ; + } + } config =clusterip_config_find_get (e->ip.dst.s_addr,1 );if (!config) {
PATCH 68/153 netfilter: on sockopt() acquire sock lock only in the required scope
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 3f34cfae1238848fd53f25e5c8fd59da57901f4b upstream.
Syzbot reported several deadlocks in the netfilter area caused by rtnl lock and socket lock being acquired with a different order on different code paths, leading to backtraces like the following one:
======================================================
WARNING: possible circular locking dependency detected 4.15.0-rc9+ #212 Not tainted
------------------------------------------------------
syzkaller041579/3682 is trying to acquire lock:
(sk_lock-AF_INET6){+.+.}, at: [<000000008775e4dd>] lock_sockinclude/net/sock.h:1463 [inline]
(sk_lock-AF_INET6){+.+.}, at: [<000000008775e4dd>]
do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167
but task is already holding lock:
(rtnl_mutex){+.+.}, at: [<000000004342eaa9>] rtnl_lock+0x17/0x20net/core/rtnetlink.c:74
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (rtnl_mutex){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:756 [inline]
__mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
rtnl_lock+0x17/0x20 net/core/rtnetlink.c:74
register_netdevice_notifier+0xad/0x860 net/core/dev.c:1607
tee_tg_check+0x1a0/0x280 net/netfilter/xt_TEE.c:106
xt_check_target+0x22c/0x7d0 net/netfilter/x_tables.c:845
check_target net/ipv6/netfilter/ip6_tables.c:538 [inline]
find_check_entry.isra.7+0x935/0xcf0
net/ipv6/netfilter/ip6_tables.c:580
translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:749
do_replace net/ipv6/netfilter/ip6_tables.c:1165 [inline]
do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1691
nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
ipv6_setsockopt+0x115/0x150 net/ipv6/ipv6_sockglue.c:928
udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422
sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
SYSC_setsockopt net/socket.c:1849 [inline]
SyS_setsockopt+0x189/0x360 net/socket.c:1828
entry_SYSCALL_64_fastpath+0x29/0xa0-> #0 (sk_lock-AF_INET6){+.+.}:
lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914
lock_sock_nested+0xc2/0x110 net/core/sock.c:2780
lock_sock include/net/sock.h:1463 [inline]
do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167
ipv6_setsockopt+0xd7/0x150 net/ipv6/ipv6_sockglue.c:922
udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422
sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978
SYSC_setsockopt net/socket.c:1849 [inline]
SyS_setsockopt+0x189/0x360 net/socket.c:1828
entry_SYSCALL_64_fastpath+0x29/0xa0other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(rtnl_mutex);
lock(sk_lock-AF_INET6);
lock(rtnl_mutex); lock(sk_lock-AF_INET6);
*** DEADLOCK ***
1 lock held by syzkaller041579/3682:
#0: (rtnl_mutex){+.+.}, at: [<000000004342eaa9>] rtnl_lock+0x17/0x20net/core/rtnetlink.c:74
The problem, as Florian noted, is that nf_setsockopt() is always called with the socket held, even if the lock itself is required only for very tight scopes and only for some operation.
This patch addresses the issues moving the lock_sock() call only where really needed, namely in ipv*_getorigdst(), so that nf_setsockopt() does not need anymore to acquire both locks.
---
net/ipv4/ip_sockglue.c +4 -10
@@ -1030,11 +1030,8 @@ int ip_setsockopt(struct sock *sk, int lif (err == -ENOPROTOOPT && optname !=IP_HDRINCL && optname !=IP_IPSEC_POLICY && optname !=IP_XFRM_POLICY && - !ip_mroute_opt (optname)) { -lock_sock (sk); + !ip_mroute_opt (optname)) err =nf_setsockopt (sk,PF_INET , optname, optval, optlen); -release_sock (sk); - }#endif return err; }
@@ -1059,12 +1056,9 @@ int compat_ip_setsockopt(struct sock *skif (err == -ENOPROTOOPT && optname !=IP_HDRINCL && optname !=IP_IPSEC_POLICY && optname !=IP_XFRM_POLICY && - !ip_mroute_opt (optname)) { -lock_sock (sk); - err =compat_nf_setsockopt (sk,PF_INET , optname, - optval, optlen); -release_sock (sk); - } + !ip_mroute_opt (optname)) + err =compat_nf_setsockopt (sk,PF_INET , optname, optval, + optlen);#endif return err; }
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +5 -1
@@ -258,15 +258,19 @@ getorigdst(struct sock *sk, int optval,struct nf_conntrack_tuple tuple;memset (&tuple,0 ,sizeof (tuple)); + +lock_sock (sk); tuple.src.u3.ip = inet->inet_rcv_saddr; tuple.src.u.tcp.port = inet->inet_sport; tuple.dst.u3.ip = inet->inet_daddr; tuple.dst.u.tcp.port = inet->inet_dport; tuple.src.l3num =PF_INET ; tuple.dst.protonum = sk->sk_protocol; +release_sock (sk);/* We only do TCP and SCTP at the moment: is there a better way? */ -if (sk->sk_protocol !=IPPROTO_TCP && sk->sk_protocol !=IPPROTO_SCTP ) { +if (tuple.dst.protonum !=IPPROTO_TCP && + tuple.dst.protonum !=IPPROTO_SCTP ) {pr_debug ("SO_ORIGINAL_DST: Not a TCP/SCTP socket\n" );return -ENOPROTOOPT ; }
net/ipv6/ipv6_sockglue.c +5 -12
@@ -841,12 +841,8 @@ int ipv6_setsockopt(struct sock *sk, int#ifdef CONFIG_NETFILTER /* we need to exclude all possible ENOPROTOOPTs except default case */ if (err == -ENOPROTOOPT && optname !=IPV6_IPSEC_POLICY && - optname !=IPV6_XFRM_POLICY ) { -lock_sock (sk); - err =nf_setsockopt (sk,PF_INET6 , optname, optval, - optlen); -release_sock (sk); - } + optname !=IPV6_XFRM_POLICY ) + err =nf_setsockopt (sk,PF_INET6 , optname, optval, optlen);#endif return err; }
@@ -877,12 +873,9 @@ int compat_ipv6_setsockopt(struct sock *#ifdef CONFIG_NETFILTER /* we need to exclude all possible ENOPROTOOPTs except default case */ if (err == -ENOPROTOOPT && optname !=IPV6_IPSEC_POLICY && - optname !=IPV6_XFRM_POLICY ) { -lock_sock (sk); - err =compat_nf_setsockopt (sk,PF_INET6 , optname, - optval, optlen); -release_sock (sk); - } + optname !=IPV6_XFRM_POLICY ) + err =compat_nf_setsockopt (sk,PF_INET6 , optname, optval, + optlen);#endif return err; }
PATCH 69/153 mm: pin address_space before dereferencing it while isolating an LRU page
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 69d763fc6d3aee787a3e8c8c35092b4f4960fa5d upstream.
Minchan Kim asked the following question -- what locks protects address_space destroying when race happens between inode trauncation and __isolate_lru_page? Jan Kara clarified by describing the race as follows
CPU1 CPU2
truncate(inode) __isolate_lru_page()
...
truncate_inode_page(mapping, page);
delete_from_page_cache(page)
spin_lock_irqsave(&mapping->tree_lock, flags);
__delete_from_page_cache(page, NULL)
page_cache_tree_delete(..)
... mapping = page_mapping(page);
page->mapping = NULL;
...
spin_unlock_irqrestore(&mapping->tree_lock, flags);
page_cache_free_page(mapping, page)
put_page(page)
if (put_page_testzero(page)) -> false- inode now has no pages and can be freed including embedded address_space
if (mapping && !mapping->a_ops->migratepage)
- we've dereferenced mapping which is potentially already free.
The race is theoretically possible but unlikely. Before the delete_from_page_cache, truncate_cleanup_page is called so the page is likely to be !PageDirty or PageWriteback which gets skipped by the only caller that checks the mappping in __isolate_lru_page. Even if the race occurs, a substantial amount of work has to happen during a tiny window with no preemption but it could potentially be done using a virtual machine to artifically slow one CPU or halt it during the critical window.
This patch should eliminate the race with truncation by try-locking the page before derefencing mapping and aborting if the lock was not acquired. There was a suggestion from Huang Ying to use RCU as a side-effect to prevent mapping being freed. However, I do not like the solution as it's an unconventional means of preserving a mapping and it's not a context where rcu_read_lock is obviously protecting rcu data.
--- mm/vmscan.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
mm/vmscan.c +12 -2
@@ -1085,6 +1085,7 @@ int __isolate_lru_page(struct page *pageif (PageDirty (page)) {struct address_space *mapping; +bool migrate_dirty;/* ISOLATE_CLEAN means only clean pages */ if (mode &ISOLATE_CLEAN )
@@ -1093,10 +1094,19 @@ int __isolate_lru_page(struct page *page/* * Only pages without mappings or that have a * ->migratepage callback are possible to migrate -* without blocking +* without blocking. However, we can be racing with +* truncation so it's necessary to lock the page +* to stabilise the mapping as truncation holds +* the page lock until after the page is removed +* from the page cache. */ +if (!trylock_page (page)) +return ret; + mapping =page_mapping (page); -if (mapping && !mapping->a_ops->migratepage) + migrate_dirty = mapping && mapping->a_ops->migratepage; +unlock_page (page); +if (!migrate_dirty)return ret; } }
PATCH 70/153 net: igmp: add a missing rcu locking section
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit e7aadb27a5415e8125834b84a74477bfbee4eff5 upstream.
Newly added igmpv3_get_srcaddr() needs to be called under rcu lock.
Timer callbacks do not ensure this locking.
=============================
WARNING: suspicious RCU usage
4.15.0+ #200 Not tainted
-----------------------------./include/linux/inetdevice.h:216 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by syzkaller616973/4074:
#0: (&mm->mmap_sem){++++}, at: [<00000000bfce669e>] __do_page_fault+0x32d/0xc90 arch/x86/mm/fault.c:1355
#1: ((&im->timer)){+.-.}, at: [<00000000619d2f71>] lockdep_copy_map include/linux/lockdep.h:178 [inline]
#1: ((&im->timer)){+.-.}, at: [<00000000619d2f71>] call_timer_fn+0x1c6/0x820 kernel/time/timer.c:1316
#2: (&(&im->lock)->rlock){+.-.}, at: [<000000005f833c5c>] spin_lock_bh include/linux/spinlock.h:315 [inline]
#2: (&(&im->lock)->rlock){+.-.}, at: [<000000005f833c5c>] igmpv3_send_report+0x98/0x5b0 net/ipv4/igmp.c:600stack backtrace: CPU: 0 PID: 4074 Comm: syzkaller616973 Not tainted 4.15.0+ #200 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 lockdep_rcu_suspicious+0x123/0x170 kernel/locking/lockdep.c:4592 __in_dev_get_rcu include/linux/inetdevice.h:216 [inline] igmpv3_get_srcaddr net/ipv4/igmp.c:329 [inline] igmpv3_newpack+0xeef/0x12e0 net/ipv4/igmp.c:389 add_grhead.isra.27+0x235/0x300 net/ipv4/igmp.c:432 add_grec+0xbd3/0x1170 net/ipv4/igmp.c:565 igmpv3_send_report+0xd5/0x5b0 net/ipv4/igmp.c:605 igmp_send_report+0xc43/0x1050 net/ipv4/igmp.c:722 igmp_timer_expire+0x322/0x5c0 net/ipv4/igmp.c:831 call_timer_fn+0x228/0x820 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers+0x7ee/0xb70 kernel/time/timer.c:1666 run_timer_softirq+0x4c/0x70 kernel/time/timer.c:1692 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285 invoke_softirq kernel/softirq.c:365 [inline] irq_exit+0x1cc/0x200 kernel/softirq.c:405 exiting_irq arch/x86/include/asm/apic.h:541 [inline] smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052 apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:938
--- net/ipv4/igmp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/igmp.c +4 -0
@@ -363,7 +363,11 @@ static struct sk_buff *igmpv3_newpack(st pip->frag_off =htons (IP_DF ); pip->ttl =1 ; pip->daddr = fl4.daddr; + +rcu_read_lock (); pip->saddr =igmpv3_get_srcaddr (dev, &fl4); +rcu_read_unlock (); + pip->protocol =IPPROTO_IGMP ; pip->tot_len =0 ;/* filled in later */ ip_select_ident (skb,NULL );
PATCH 71/153 Btrfs: fix extent state leak from tree log
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 55237a5f2431a72435e3ed39e4306e973c0446b7 upstream.
It's possible that btrfs_sync_log() bails out after one of the two btrfs_write_marked_extents() which convert extent state's state bit into EXTENT_NEED_WAIT from EXTENT_DIRTY/EXTENT_NEW, however only EXTENT_DIRTY and EXTENT_NEW are searched by free_log_tree() so that those extent states with EXTENT_NEED_WAIT lead to memory leak.
--- fs/btrfs/tree-log.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +3 -2
@@ -2216,12 +2216,13 @@ static void free_log_tree(struct btrfs_twhile (1 ) { ret =find_first_extent_bit (&log->dirty_log_pages, -0 , &start, &end,EXTENT_DIRTY |EXTENT_NEW ); +0 , &start, &end, +EXTENT_DIRTY |EXTENT_NEW |EXTENT_NEED_WAIT );if (ret)break ;clear_extent_bits (&log->dirty_log_pages, start, end, -EXTENT_DIRTY |EXTENT_NEW ,GFP_NOFS ); +EXTENT_DIRTY |EXTENT_NEW |EXTENT_NEED_WAIT ,GFP_NOFS ); }free_extent_buffer (log->node);
PATCH 72/153 firmware/dmi_scan: constify strings
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit ffbbb96dd7570b9aafd426cd77a7ee03d224cabf upstream.
Add const to all DMI string pointers where this is possible. This fixes a checkpatch warning.
--- drivers/firmware/dmi_scan.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/firmware/dmi_scan.c +5 -5
@@ -14,7 +14,7 @@* of and an antecedent to, SMBIOS, which stands for System * Management BIOS. See further: http://www.dmtf.org/standards */ -static char dmi_empty_string[] =" " ; +static const char dmi_empty_string[] =" " ;static u16 __initdata dmi_ver;/*
@@ -46,7 +46,7 @@ static const char * __init dmi_string_noreturn "" ; } -static char *__init dmi_string (const struct dmi_header *dm,u8 s) +static const char *__init dmi_string (const struct dmi_header *dm,u8 s) {const char *bp =dmi_string_nosave (dm, s);char *str;
@@ -130,7 +130,7 @@ static int __init dmi_checksum(const u8return sum ==0 ; } -static char *dmi_ident[DMI_STRING_MAX ]; +static const char *dmi_ident[DMI_STRING_MAX ];static LIST_HEAD (dmi_devices);int dmi_available;
@@ -140,7 +140,7 @@ int dmi_available;static void __init dmi_save_ident (const struct dmi_header *dm,int slot,int string) {const char *d = (const char *) dm; -char *p; +const char *p;if (dmi_ident[slot])return ;
@@ -246,7 +246,7 @@ static void __init dmi_save_oem_strings_struct dmi_device *dev;for (i =1 ; i <= count; i++) { -char *devname =dmi_string (dm, i); +const char *devname =dmi_string (dm, i);if (devname == dmi_empty_string)continue ;
PATCH 73/153 firmware: dmi_scan: Fix handling of empty DMI strings
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit a7770ae194569e96a93c48aceb304edded9cc648 upstream.
The handling of empty DMI strings looks quite broken to me:
* Strings from 1 to 7 spaces are not considered empty.
* True empty DMI strings (string index set to 0) are not considered empty, and result in allocating a 0-char string.
* Strings with invalid index also result in allocating a 0-char string.
* Strings starting with 8 spaces are all considered empty, even if non-space characters follow (sounds like a weird thing to do, but I have actually seen occurrences of this in DMI tables before.)
* Strings which are considered empty are reported as 8 spaces, instead of being actually empty.
Some of these issues are the result of an off-by-one error in memcmp, the rest is incorrect by design.
So let's get it square: missing strings and strings made of only spaces, regardless of their length, should be treated as empty and no memory should be allocated for them. All other strings are non-empty and should be allocated.
--- drivers/firmware/dmi_scan.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/firmware/dmi_scan.c +9 -13
@@ -14,7 +14,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;/*
@@ -25,25 +25,21 @@ static int dmi_initialized;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)
PATCH 74/153 MIPS: TXX9: use IS_ENABLED() macro
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit b33b44073734842ec0c75d376c40d0471d6113ff upstream.
Patchwork: https://patchwork.linux-mips.org/patch/3334/
--- arch/mips/txx9/generic/setup.c | 12 +++++------- arch/mips/txx9/generic/setup_tx4939.c | 2 +- arch/mips/txx9/rbtx4939/setup.c | 11 +++++------ 3 files changed, 11 insertions(+), 14 deletions(-)
arch/mips/txx9/generic/setup.c +5 -7
@@ -632,7 +632,7 @@ void __init txx9_physmap_flash_init(intunsigned long size, const struct physmap_flash_data *pdata) { -#if defined(CONFIG_MTD_PHYSMAP ) || defined(CONFIG_MTD_PHYSMAP_MODULE ) +#if IS_ENABLED(CONFIG_MTD_PHYSMAP) struct resource res = { .start = addr, .end = addr + size - 1,
@@ -670,8 +670,7 @@ void __init txx9_physmap_flash_init(intvoid __init txx9_ndfmc_init (unsigned long baseaddr,const struct txx9ndfmc_platform_data *pdata) { -#if defined(CONFIG_MTD_NAND_TXX9NDFMC ) || \ - defined(CONFIG_MTD_NAND_TXX9NDFMC_MODULE ) +#if IS_ENABLED (CONFIG_MTD_NAND_TXX9NDFMC )struct resource res = { .start = baseaddr, .end = baseaddr + 0x1000 - 1,
@@ -687,7 +686,7 @@ void __init txx9_ndfmc_init(unsigned lon#endif } -#if defined(CONFIG_LEDS_GPIO ) || defined(CONFIG_LEDS_GPIO_MODULE ) +#if IS_ENABLED (CONFIG_LEDS_GPIO )static DEFINE_SPINLOCK (txx9_iocled_lock);#define TXX9_IOCLED_MAXLEDS 8
@@ -810,7 +809,7 @@ void __init txx9_iocled_init(unsigned lovoid __init txx9_dmac_init (int id,unsigned long baseaddr,int irq,const struct txx9dmac_platform_data *pdata) { -#if defined(CONFIG_TXX9_DMAC) || defined(CONFIG_TXX9_DMAC_MODULE) +#if IS_ENABLED(CONFIG_TXX9_DMAC) struct resource res[] = { { .start = baseaddr,
@@ -866,8 +865,7 @@ void __init txx9_aclc_init(unsigned longunsigned int dma_chan_out, unsigned int dma_chan_in) { -#if defined(CONFIG_SND_SOC_TXX9ACLC) || \ - defined(CONFIG_SND_SOC_TXX9ACLC_MODULE) +#if IS_ENABLED(CONFIG_SND_SOC_TXX9ACLC) unsigned int dma_base = dmac_id *TXX9_DMA_MAX_NR_CHANNELS ; struct resource res[] = { {
arch/mips/txx9/generic/setup_tx4939.c +1 -1
@@ -317,7 +317,7 @@ void __init tx4939_sio_init(unsigned int } } -#if defined(CONFIG_TC35815 ) || defined(CONFIG_TC35815_MODULE ) +#if IS_ENABLED (CONFIG_TC35815 )static u32 tx4939_get_eth_speed (struct net_device *dev) {struct ethtool_cmd cmd;
arch/mips/txx9/rbtx4939/setup.c +5 -6
@@ -40,8 +40,7 @@ static void __init rbtx4939_time_init(votx4939_time_init (0 ); } -#if defined(__BIG_ENDIAN) && \ - (defined(CONFIG_SMC91X ) || defined(CONFIG_SMC91X_MODULE )) +#if defined(__BIG_ENDIAN) &&IS_ENABLED (CONFIG_SMC91X )#define HAVE_RBTX4939_IOSWAB #define IS_CE1_ADDR (addr) \ ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1))
@@ -187,7 +186,7 @@ static void __init rbtx4939_update_ioc_p#define RBTX4939_MAX_7SEGLEDS 8 -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) +#if IS_ENABLED(CONFIG_LEDS_CLASS) static u8 led_val[RBTX4939_MAX_7SEGLEDS]; struct rbtx4939_led_data { struct led_classdev cdev;
@@ -263,7 +262,7 @@ static inline void rbtx4939_led_setup(vostatic void __rbtx4939_7segled_putc (unsigned int pos,unsigned char val) { -#if defined(CONFIG_LEDS_CLASS ) || defined(CONFIG_LEDS_CLASS_MODULE ) +#if IS_ENABLED (CONFIG_LEDS_CLASS )unsigned long flags;local_irq_save (flags);/* bit7: reserved for LED class */
@@ -287,7 +286,7 @@ static void rbtx4939_7segled_putc(unsign__rbtx4939_7segled_putc (pos, val); } -#if defined(CONFIG_MTD_RBTX4939 ) || defined(CONFIG_MTD_RBTX4939_MODULE ) +#if IS_ENABLED (CONFIG_MTD_RBTX4939 )/* special mapping for boot rom */ static unsigned long rbtx4939_flash_fixup_ofs (unsigned long ofs) {
@@ -463,7 +462,7 @@ static void __init rbtx4939_device_init( .flags = SMC91X_USE_16BIT, };struct platform_device *pdev; -#if defined(CONFIG_TC35815 ) || defined(CONFIG_TC35815_MODULE ) +#if IS_ENABLED (CONFIG_TC35815 )int i, j;unsigned char ethaddr[2 ][6 ];u8 bdipsw =readb (rbtx4939_bdipsw_addr) &0x0f ;
PATCH 75/153 MIPS: TXx9: use IS_BUILTIN() for CONFIG_LEDS_CLASS
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matt Redfearn <[email protected]>
commit 0cde5b44a30f1daaef1c34e08191239dc63271c4 upstream.
When commit b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support") added board support for the RBTX4939, it added a call to led_classdev_register even if the LED class is built as a module. Built-in arch code cannot call module code directly like this. Commit b33b44073734 ("MIPS: TXX9: use IS_ENABLED() macro") subsequently changed the inclusion of this code to a single check that CONFIG_LEDS_CLASS is either builtin or a module, but the same issue remains.
This leads to MIPS allmodconfig builds failing when CONFIG_MACH_TX49XX=y is set:
arch/mips/txx9/rbtx4939/setup.o: In function `rbtx4939_led_probe':
setup.c:(.init.text+0xc0): undefined reference to `of_led_classdev_register'
make: *** [Makefile:999: vmlinux] Error 1
Fix this by using the IS_BUILTIN() macro instead.
Patchwork: https://patchwork.linux-mips.org/patch/18544/
--- arch/mips/txx9/rbtx4939/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/txx9/rbtx4939/setup.c +2 -2
@@ -186,7 +186,7 @@ static void __init rbtx4939_update_ioc_p#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(vostatic 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 */
PATCH 76/153 netfilter: xt_RATEEST: acquire xt_rateest_mutex for hash insert
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
commit 7dc68e98757a8eccf8ca7a53a29b896f1eef1f76 upstream.
rateest_hash is supposed to be protected by xt_rateest_mutex, and, as suggested by Eric, lookup and insert should be atomic, so we should acquire the xt_rateest_mutex once for both.
So introduce a non-locking helper for internal use and keep the locking one for external.
--- net/netfilter/xt_RATEEST.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
net/netfilter/xt_RATEEST.c +17 -5
@@ -40,24 +40,32 @@ static void xt_rateest_hash_insert(struchlist_add_head (&est->list, &rateest_hash[h]); } -struct xt_rateest *xt_rateest_lookup (const char *name) +static struct xt_rateest *__xt_rateest_lookup (const char *name) {struct xt_rateest *est;struct hlist_node *n;unsigned int h; h =xt_rateest_hash (name); -mutex_lock (&xt_rateest_mutex);hlist_for_each_entry (est, n, &rateest_hash[h], list) {if (strcmp (est->name, name) ==0 ) { est->refcnt++; -mutex_unlock (&xt_rateest_mutex);return est; } } -mutex_unlock (&xt_rateest_mutex); +return NULL ; } + +struct xt_rateest *xt_rateest_lookup (const char *name) +{ +struct xt_rateest *est; + +mutex_lock (&xt_rateest_mutex); + est =__xt_rateest_lookup (name); +mutex_unlock (&xt_rateest_mutex); +return est; +}EXPORT_SYMBOL_GPL (xt_rateest_lookup);void xt_rateest_put (struct xt_rateest *est)
@@ -105,8 +113,10 @@ static int xt_rateest_tg_checkentry(cons rnd_inited = true; } - est =xt_rateest_lookup (info->name); +mutex_lock (&xt_rateest_mutex); + est =__xt_rateest_lookup (info->name);if (est) { +mutex_unlock (&xt_rateest_mutex);/* * If estimator parameters are specified, they must match the * existing estimator.
@@ -144,11 +154,13 @@ static int xt_rateest_tg_checkentry(cons info->est = est;xt_rateest_hash_insert (est); +mutex_unlock (&xt_rateest_mutex);return 0 ; err2:kfree (est); err1: +mutex_unlock (&xt_rateest_mutex);return ret; }
PATCH 77/153 powerpc/numa: Invalidate numa_cpu_lookup_table on cpu remove
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Fontenot <[email protected]>
commit 1d9a090783bef19fe8cdec878620d22f05191316 upstream.
When DLPAR removing a CPU, the unmapping of the cpu from a node in unmap_cpu_from_node() should also invalidate the CPUs entry in the numa_cpu_lookup_table. There is not a guarantee that on a subsequent DLPAR add of the CPU the associativity will be the same and thus could be in a different node. Invalidating the entry in the numa_cpu_lookup_table causes the associativity to be read from the device tree at the time of the add.
The current behavior of not invalidating the CPUs entry in the numa_cpu_lookup_table can result in scenarios where the the topology layout of CPUs in the partition does not match the device tree or the topology reported by the HMC.
This bug looks like it was introduced in 2004 in the commit titled "ppc64: cpu hotplug notifier for numa", which is 6b15e4e87e32 in the linux-fullhist tree. Hence tag it for all stable releases.
[bwh: Backported to 3.2:
- update_numa_cpu_lookup_table() wasn't defined anywhere before
- Adjust context]
---
arch/powerpc/include/asm/topology.h +5 -0
@@ -89,6 +89,11 @@ extern void __init dump_numa_cpu_topologextern int sysfs_add_device_to_node (struct sys_device *dev,int nid);extern void sysfs_remove_device_from_node (struct sys_device *dev,int nid); +static inline void update_numa_cpu_lookup_table (unsigned int cpu,int node) +{ + numa_cpu_lookup_table[cpu] = node; +} +#else static inline void dump_numa_cpu_topology (void ) {}
arch/powerpc/platforms/pseries/hotplug-cpu.c +2 -0
@@ -32,6 +32,7 @@#include <asm/pSeries_reconfig.h> #include <asm/xics.h> #include "plpar_wrappers.h" +#include <asm/topology.h> #include "offline_states.h" /* This version can't take the spinlock, because it never returns */
@@ -319,6 +320,7 @@ static void pseries_remove_processor(strBUG_ON (cpu_online (cpu));set_cpu_present (cpu, false);set_hard_smp_processor_id (cpu,-1 ); +update_numa_cpu_lookup_table (cpu,-1 );break ; }if (cpu >= nr_cpu_ids)
PATCH 78/153 netlink: ensure to loop over all netns in genlmsg_multicast_allns()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82 upstream.
Nowadays, nlmsg_multicast() returns only 0 or -ESRCH but this was not the case when commit 134e63756d5f was pushed.
However, there was no reason to stop the loop if a netns does not have listeners.
Returns -ESRCH only if there was no listeners in all netns.
To avoid having the same problem in the future, I didn't take the assumption that nlmsg_multicast() returns only 0 or -ESRCH.
--- net/netlink/genetlink.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/netlink/genetlink.c +10 -2
@@ -917,6 +917,7 @@ static int genlmsg_mcast(struct sk_buff {struct sk_buff *tmp;struct net *net, *prev =NULL ; +bool delivered = false;int err;for_each_net_rcu (net) {
@@ -928,14 +929,21 @@ static int genlmsg_mcast(struct sk_buff } err =nlmsg_multicast (prev->genl_sock, tmp, pid, group, flags); -if (err) +if (!err) + delivered = true; +else if (err != -ESRCH ) goto error; } prev = net; } -return nlmsg_multicast (prev->genl_sock, skb, pid, group, flags); + err =nlmsg_multicast (prev->genl_sock, skb, pid, group, flags); +if (!err) + delivered = true; +else if (err != -ESRCH ) + goto error; +return delivered ?0 : -ESRCH ; error:kfree_skb (skb);return err;
PATCH 79/153 netlink: avoid a double skb free in genlmsg_mcast()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit 02a2385f37a7c6594c9d89b64c4a1451276f08eb upstream.
nlmsg_multicast() consumes always the skb, thus the original skb must be freed only when this function is called with a clone.
--- net/netlink/genetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/genetlink.c +1 -1
@@ -942,7 +942,7 @@ static int genlmsg_mcast(struct sk_buffif (!err) delivered = true;else if (err != -ESRCH ) - goto error; +return err;return delivered ?0 : -ESRCH ; error:kfree_skb (skb);
PATCH 80/153 9p/trans_virtio: discard zero-length reply
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kurz <[email protected]>
commit 26d99834f89e76514076d9cd06f61e56e6a509b8 upstream.
When a 9p request is successfully flushed, the server is expected to just mark it as used without sending a 9p reply (ie, without writing data into the buffer). In this case, virtqueue_get_buf() will return len == 0 and we must not report a REQ_STATUS_RCVD status to the client, otherwise the client will erroneously assume the request has not been flushed.
--- net/9p/trans_virtio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/9p/trans_virtio.c +2 -1
@@ -163,7 +163,8 @@ static void req_done(struct virtqueue *vP9_DPRINTK (P9_DEBUG_TRANS ,": lookup tag %d\n" , rc->tag); req =p9_tag_lookup (chan->client, rc->tag); req->status =REQ_STATUS_RCVD ; -p9_client_cb (chan->client, req); +if (len) +p9_client_cb (chan->client, req); } }
PATCH 81/153 s390/qeth: fix SETIP command handling
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit 1c5b2216fbb973a9410e0b06389740b5c1289171 upstream.
send_control_data() applies some special handling to SETIP v4 IPA commands. But current code parses *all* command types for the SETIP command code. Limit the command code check to IPA commands.
--- drivers/s390/net/qeth_core.h | 5 +++++ drivers/s390/net/qeth_core_main.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/s390/net/qeth_core.h +5 -0
@@ -578,6 +578,11 @@ struct qeth_cmd_buffer {void (*callback) (struct qeth_channel *,struct qeth_cmd_buffer *); }; +static inline struct qeth_ipa_cmd *__ipa_cmd (struct qeth_cmd_buffer *iob) +{ +return (struct qeth_ipa_cmd *)(iob->data +IPA_PDU_HEADER_SIZE ); +} +/** * definition of a qeth channel, used for read and write */
drivers/s390/net/qeth_core_main.c +8 -6
@@ -1932,7 +1932,7 @@ int qeth_send_control_data(struct qeth_cunsigned long flags;struct qeth_reply *reply =NULL ;unsigned long timeout, event_timeout; -struct qeth_ipa_cmd *cmd; +struct qeth_ipa_cmd *cmd =NULL ;QETH_CARD_TEXT (card,2 ,"sendctl" );
@@ -1959,10 +1959,13 @@ int qeth_send_control_data(struct qeth_cwhile (atomic_cmpxchg (&card->write.irq_pending,0 ,1 )) ;qeth_prepare_control_data (card, len, iob); -if (IS_IPA (iob->data)) +if (IS_IPA (iob->data)) { + cmd =__ipa_cmd (iob); event_timeout =QETH_IPA_TIMEOUT ; -else + }else { event_timeout =QETH_TIMEOUT ; + } + timeout = jiffies + event_timeout;QETH_CARD_TEXT (card,6 ,"noirqpnd" );
@@ -1987,9 +1990,8 @@ int qeth_send_control_data(struct qeth_c/* we have only one long running ipassist, since we can ensure process context of this command we can sleep */ - cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE ); -if ((cmd->hdr.command ==IPA_CMD_SETIP ) && - (cmd->hdr.prot_version ==QETH_PROT_IPV4 )) { +if (cmd && cmd->hdr.command ==IPA_CMD_SETIP && + cmd->hdr.prot_version ==QETH_PROT_IPV4 ) {if (!wait_event_timeout (reply->wait_q,atomic_read (&reply->received), event_timeout)) goto time_err;
PATCH 82/153 Input: matrix_keypad - fix race when disabling interrupts
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Bo <[email protected]>
commit ea4f7bd2aca9f68470e9aac0fc9432fd180b1fe7 upstream.
If matrix_keypad_stop() is executing and the keypad interrupt is triggered, disable_row_irqs() may be called by both matrix_keypad_interrupt() and matrix_keypad_stop() at the same time, causing interrupts to be disabled twice and the keypad being "stuck" after resuming.
Take lock when setting keypad->stopped to ensure that ISR will not race with matrix_keypad_stop() disabling interrupts.
--- drivers/input/keyboard/matrix_keypad.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/input/keyboard/matrix_keypad.c +3 -1
@@ -214,8 +214,10 @@ static void matrix_keypad_stop(struct in {struct matrix_keypad *keypad =input_get_drvdata (dev); +spin_lock_irq (&keypad->lock); keypad->stopped = true; -mb (); +spin_unlock_irq (&keypad->lock); +flush_work (&keypad->work.work);/* * matrix_keypad_scan() will leave IRQs enabled;
PATCH 83/153 usb: dwc3: gadget: Set maxpacket size for ep0 IN
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 6180026341e852a250e1f97ebdcf71684a3c81b9 upstream.
There are 2 control endpoint structures for DWC3. However, the driver only updates the OUT direction control endpoint structure during ConnectDone event. DWC3 driver needs to update the endpoint max packet size for control IN endpoint as well. If the max packet size is not properly set, then the driver will incorrectly calculate the data transfer size and fail to send ZLP for HS/FS 3-stage control read transfer.
The fix is simply to update the max packet size for the ep0 IN direction during ConnectDone event.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -1821,6 +1821,8 @@ static void dwc3_gadget_conndone_interrubreak ; } + dwc->eps[1 ]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket; +/* Disable unneded PHY */ dwc3_gadget_disable_phy (dwc, dwc->gadget.speed);
PATCH 84/153 bridge: check brport attr show in brport_show
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 1b12580af1d0677c3c3a19e35bfe5d59b03f737f upstream.
Now br_sysfs_if file flush doesn't have attr show. To read it will cause kernel panic after users chmod u+r this file.
Xiong found this issue when running the commands:
ip link add br0 type bridge
ip link add type veth
ip link set veth0 master br0
chmod u+r /sys/devices/virtual/net/veth0/brport/flush timeout 3 cat /sys/devices/virtual/net/veth0/brport/flush
kernel crashed with NULL a pointer dereference call trace.
This patch is to fix it by return -EINVAL when brport_attr->show is null, just the same as the check for brport_attr->store in brport_store().
--- net/bridge/br_sysfs_if.c | 3 +++ 1 file changed, 3 insertions(+)
net/bridge/br_sysfs_if.c +3 -0
@@ -196,6 +196,9 @@ static ssize_t brport_show(struct kobjecstruct brport_attribute * brport_attr =to_brport_attr (attr);struct net_bridge_port * p =to_brport (kobj); +if (!brport_attr->show) +return -EINVAL ; +return brport_attr->show (p, buf); }
PATCH 85/153 libata: fix length validation of ATAPI-relayed SCSI commands
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 058f58e235cbe03e923b30ea7c49995a46a8725f upstream.
syzkaller reported a crash in ata_bmdma_fill_sg() when writing to /dev/sg1. The immediate cause was that the ATA command's scatterlist was not DMA-mapped, which causes 'pi - 1' to underflow, resulting in a write to 'qc->ap->bmdma_prd[0xffffffff]'.
Strangely though, the flag ATA_QCFLAG_DMAMAP was set in qc->flags. The root cause is that when __ata_scsi_queuecmd() is preparing to relay a SCSI command to an ATAPI device, it doesn't correctly validate the CDB length before copying it into the 16-byte buffer 'cdb' in 'struct ata_queued_cmd'. Namely, it validates the fixed CDB length expected based on the SCSI opcode but not the actual CDB length, which can be larger due to the use of the SG_NEXT_CMD_LEN ioctl. Since 'flags' is the next member in ata_queued_cmd, a buffer overflow corrupts it.
Fix it by requiring that the actual CDB length be <= 16 (ATAPI_CDB_LEN).
[Really it seems the length should be required to be <= dev->cdb_len, but the current behavior seems to have been intentionally introduced by commit 607126c2a21c ("libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs") to work around a userspace bug in mplayer. Probably the workaround is no longer needed (mplayer was fixed in 2007), but continuing to allow lengths to up 16 appears harmless for now.]
Here's a reproducer that works in QEMU when /dev/sg1 refers to the CD-ROM drive that qemu-system-x86_64 creates by default:
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#define SG_NEXT_CMD_LEN 0x2283
int main()
{
char buf[53] = { [36] = 0x7e, [52] = 0x02 };
int fd = open("/dev/sg1", O_RDWR);
ioctl(fd, SG_NEXT_CMD_LEN, &(int){ 17 });
write(fd, buf, sizeof(buf));
}The crash was:
BUG: unable to handle kernel paging request at ffff8cb97db37ffc
IP: ata_bmdma_fill_sg drivers/ata/libata-sff.c:2623 [inline]
IP: ata_bmdma_qc_prep+0xa4/0xc0 drivers/ata/libata-sff.c:2727
PGD fb6c067 P4D fb6c067 PUD 0
Oops: 0002 [#1] SMP
CPU: 1 PID: 150 Comm: syz_ata_bmdma_q Not tainted 4.15.0-next-20180202 #99
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014
[...]
Call Trace:
ata_qc_issue+0x100/0x1d0 drivers/ata/libata-core.c:5421
ata_scsi_translate+0xc9/0x1a0 drivers/ata/libata-scsi.c:2024
__ata_scsi_queuecmd drivers/ata/libata-scsi.c:4326 [inline]
ata_scsi_queuecmd+0x8c/0x210 drivers/ata/libata-scsi.c:4375
scsi_dispatch_cmd+0xa2/0xe0 drivers/scsi/scsi_lib.c:1727
scsi_request_fn+0x24c/0x530 drivers/scsi/scsi_lib.c:1865
__blk_run_queue_uncond block/blk-core.c:412 [inline]
__blk_run_queue+0x3a/0x60 block/blk-core.c:432
blk_execute_rq_nowait+0x93/0xc0 block/blk-exec.c:78
sg_common_write.isra.7+0x272/0x5a0 drivers/scsi/sg.c:806
sg_write+0x1ef/0x340 drivers/scsi/sg.c:677
__vfs_write+0x31/0x160 fs/read_write.c:480
vfs_write+0xa7/0x160 fs/read_write.c:544
SYSC_write fs/read_write.c:589 [inline]
SyS_write+0x4d/0xc0 fs/read_write.c:581
do_syscall_64+0x5e/0x110 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x21/0x86--- drivers/ata/libata-scsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ata/libata-scsi.c +3 -1
@@ -3194,7 +3194,9 @@ static inline int __ata_scsi_queuecmd(stif (likely ((scsi_op !=ATA_16 ) || !atapi_passthru16)) {/* relay SCSI command to ATAPI device */ int len =COMMAND_SIZE (scsi_op); -if (unlikely (len > scmd->cmd_len || len > dev->cdb_len)) +if (unlikely (len > scmd->cmd_len || + len > dev->cdb_len || + scmd->cmd_len >ATAPI_CDB_LEN )) goto bad_cdb_len; xlat_func = atapi_xlat;
PATCH 86/153 libata: remove WARN() for DMA or PIO command without data
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 9173e5e80729c8434b8d27531527c5245f4a5594 upstream.
syzkaller hit a WARN() in ata_qc_issue() when writing to /dev/sg0. This happened because it issued a READ_6 command with no data buffer.
Just remove the WARN(), as it doesn't appear indicate a kernel bug. The expected behavior is to fail the command, which the code does.
Here's a reproducer that works in QEMU when /dev/sg0 refers to a disk of the default type ("82371SB PIIX3 IDE"):
#include <fcntl.h>
#include <unistd.h>
int main()
{
char buf[42] = { [36] = 0x8 /* READ_6 */ };
write(open("/dev/sg0", O_RDWR), buf, sizeof(buf));
}--- drivers/ata/libata-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/libata-core.c +1 -2
@@ -5060,8 +5060,7 @@ void ata_qc_issue(struct ata_queued_cmd* We guarantee to LLDs that they will have at least one * non-zero sg if the command is a data command. */ -if (WARN_ON_ONCE (ata_is_data (prot) && - (!qc->sg || !qc->n_elem || !qc->nbytes))) +if (ata_is_data (prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)) goto sys_err; if (ata_is_dma(prot) || (ata_is_pio(prot) &&
PATCH 87/153 xfrm_user: uncoditionally validate esn replay attribute struct
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit d97ca5d714a5334aecadadf696875da40f1fbf3e upstream.
The sanity test added in ecd7918745234 can be bypassed, validation only occurs if XFRM_STATE_ESN flag is set, but rest of code doesn't care and just checks if the attribute itself is present.
So always validate. Alternative is to reject if we have the attribute without the flag but that would change abi.
--- net/xfrm/xfrm_user.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
net/xfrm/xfrm_user.c +8 -13
@@ -125,22 +125,17 @@ static inline int verify_replay(struct xstruct nlattr *rt = attrs[XFRMA_REPLAY_ESN_VAL ];struct xfrm_replay_state_esn *rs; -if (p->flags &XFRM_STATE_ESN ) { -if (!rt) -return -EINVAL ; - - rs =nla_data (rt); +if (!rt) +return (p->flags &XFRM_STATE_ESN ) ? -EINVAL :0 ; -if (rs->bmp_len >XFRMA_REPLAY_ESN_MAX /sizeof (rs->bmp[0 ]) /8 ) -return -EINVAL ; + rs =nla_data (rt); -if (nla_len (rt) <xfrm_replay_state_esn_len (rs) && -nla_len (rt) !=sizeof (*rs)) -return -EINVAL ; - } +if (rs->bmp_len >XFRMA_REPLAY_ESN_MAX /sizeof (rs->bmp[0 ]) /8 ) +return -EINVAL ; -if (!rt) -return 0 ; +if (nla_len (rt) < (int )xfrm_replay_state_esn_len (rs) && +nla_len (rt) !=sizeof (*rs)) +return -EINVAL ;if (p->id.proto !=IPPROTO_ESP )return -EINVAL ;
PATCH 88/153 net: fix race on decreasing number of TX queues
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit ac5b70198adc25c73fba28de4f78adcee8f6be0b upstream.
netif_set_real_num_tx_queues() can be called when netdev is up. That usually happens when user requests change of number of channels/rings with ethtool -L. The procedure for changing the number of queues involves resetting the qdiscs and setting dev->num_tx_queues to the new value. When the new value is lower than the old one, extra care has to be taken to ensure ordering of accesses to the number of queues vs qdisc reset.
Currently the queues are reset before new dev->num_tx_queues is assigned, leaving a window of time where packets can be enqueued onto the queues going down, leading to a likely crash in the drivers, since most drivers don't check if TX skbs are assigned to an active queue.
---
net/core/dev.c +10 -2
@@ -1750,8 +1750,11 @@ static void netif_setup_tc(struct net_de*/ int netif_set_real_num_tx_queues (struct net_device *dev,unsigned int txq) { +bool disabling;int rc; + disabling = txq < dev->real_num_tx_queues; +if (txq <1 || txq > dev->num_tx_queues)return -EINVAL ;
@@ -1767,11 +1770,16 @@ int netif_set_real_num_tx_queues(structif (dev->num_tc)netif_setup_tc (dev, txq); -if (txq < dev->real_num_tx_queues) + dev->real_num_tx_queues = txq; + +if (disabling) { +synchronize_net ();qdisc_reset_all_tx_gt (dev, txq); + } + }else { + dev->real_num_tx_queues = txq; } - dev->real_num_tx_queues = txq;return 0 ; }EXPORT_SYMBOL (netif_set_real_num_tx_queues);
PATCH 89/153 netfilter: drop outermost socket lock in getsockopt()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 01ea306f2ac2baff98d472da719193e738759d93 upstream.
The Syzbot reported a possible deadlock in the netfilter area caused by rtnl lock, xt lock and socket lock being acquired with a different order on different code paths, leading to the following backtrace:
======================================================
WARNING: possible circular locking dependency detected 4.15.0+ #301 Not tainted
------------------------------------------------------
syzkaller233489/4179 is trying to acquire lock:
(rtnl_mutex){+.+.}, at: [<0000000048e996fd>] rtnl_lock+0x17/0x20net/core/rtnetlink.c:74
but task is already holding lock:
(&xt[i].mutex){+.+.}, at: [<00000000328553a2>]xt_find_table_lock+0x3e/0x3e0 net/netfilter/x_tables.c:1041
which lock already depends on the new lock.
===
Since commit 3f34cfae1230 ("netfilter: on sockopt() acquire sock lock only in the required scope"), we already acquire the socket lock in the innermost scope, where needed. In such commit I forgot to remove the outer-most socket lock from the getsockopt() path, this commit addresses the issues dropping it now.
v1 -> v2: fix bad subj, added relavant 'fixes' tag
--- net/ipv4/ip_sockglue.c | 7 +------ net/ipv6/ipv6_sockglue.c | 10 ++-------- 2 files changed, 3 insertions(+), 14 deletions(-)
net/ipv4/ip_sockglue.c +1 -6
@@ -1308,10 +1308,7 @@ int ip_getsockopt(struct sock *sk, int lif (get_user (len, optlen))return -EFAULT ; -lock_sock (sk); - err =nf_getsockopt (sk,PF_INET , optname, optval, - &len); -release_sock (sk); + err =nf_getsockopt (sk,PF_INET , optname, optval, &len);if (err >=0 ) err =put_user (len, optlen);return err;
@@ -1343,9 +1340,7 @@ int compat_ip_getsockopt(struct sock *skif (get_user (len, optlen))return -EFAULT ; -lock_sock (sk); err =compat_nf_getsockopt (sk,PF_INET , optname, optval, &len); -release_sock (sk);if (err >=0 ) err =put_user (len, optlen);return err;
net/ipv6/ipv6_sockglue.c +2 -8
@@ -1237,10 +1237,7 @@ int ipv6_getsockopt(struct sock *sk, intif (get_user (len, optlen))return -EFAULT ; -lock_sock (sk); - err =nf_getsockopt (sk,PF_INET6 , optname, optval, - &len); -release_sock (sk); + err =nf_getsockopt (sk,PF_INET6 , optname, optval, &len);if (err >=0 ) err =put_user (len, optlen); }
@@ -1280,10 +1277,7 @@ int compat_ipv6_getsockopt(struct sock *if (get_user (len, optlen))return -EFAULT ; -lock_sock (sk); - err =compat_nf_getsockopt (sk,PF_INET6 , - optname, optval, &len); -release_sock (sk); + err =compat_nf_getsockopt (sk,PF_INET6 , optname, optval, &len);if (err >=0 ) err =put_user (len, optlen); }
PATCH 90/153 netfilter: ipt_CLUSTERIP: fix a refcount bug in clusterip_config_find_get()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
commit db93a3632b0f8773a3899e04a3a3e0aa7a26eb46 upstream.
In clusterip_config_find_get() we hold RCU read lock so it could run concurrently with clusterip_config_entry_put(), as a result, the refcnt could go back to 1 from 0, which leads to a double list_del()... Just replace refcount_inc() with refcount_inc_not_zero(), as for c->refcount.
--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/ipv4/netfilter/ipt_CLUSTERIP.c +6 -2
@@ -135,8 +135,12 @@ clusterip_config_find_get(__be32 clusterif (c) {if (unlikely (!atomic_inc_not_zero (&c->refcount))) c =NULL ; -else if (entry) -atomic_inc (&c->entries); +else if (entry) { +if (unlikely (!atomic_inc_not_zero (&c->entries))) { +clusterip_config_put (c); + c =NULL ; + } + } }rcu_read_unlock_bh ();
PATCH 91/153 netfilter: x_tables: fix missing timer initialization in xt_LED
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 10414014bc085aac9f787a5890b33b5605fbcfc4 upstream.
syzbot reported that xt_LED may try to use the ledinternal->timer without previously initializing it:
------------[ cut here ]------------
kernel BUG at kernel/time/timer.c:958!
invalid opcode: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 1826 Comm: kworker/1:2 Not tainted 4.15.0+ #306
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: ipv6_addrconf addrconf_dad_work
RIP: 0010:__mod_timer kernel/time/timer.c:958 [inline]
RIP: 0010:mod_timer+0x7d6/0x13c0 kernel/time/timer.c:1102
RSP: 0018:ffff8801d24fe9f8 EFLAGS: 00010293
RAX: ffff8801d25246c0 RBX: ffff8801aec6cb50 RCX: ffffffff816052c6
RDX: 0000000000000000 RSI: 00000000fffbd14b RDI: ffff8801aec6cb68
RBP: ffff8801d24fec98 R08: 0000000000000000 R09: 1ffff1003a49fd6c
R10: ffff8801d24feb28 R11: 0000000000000005 R12: dffffc0000000000
R13: ffff8801d24fec70 R14: 00000000fffbd14b R15: ffff8801af608f90
FS: 0000000000000000(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000206d6fd0 CR3: 0000000006a22001 CR4: 00000000001606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
led_tg+0x1db/0x2e0 net/netfilter/xt_LED.c:75
ip6t_do_table+0xc2a/0x1a30 net/ipv6/netfilter/ip6_tables.c:365
ip6table_raw_hook+0x65/0x80 net/ipv6/netfilter/ip6table_raw.c:42
nf_hook_entry_hookfn include/linux/netfilter.h:120 [inline]
nf_hook_slow+0xba/0x1a0 net/netfilter/core.c:483
nf_hook.constprop.27+0x3f6/0x830 include/linux/netfilter.h:243
NF_HOOK include/linux/netfilter.h:286 [inline]
ndisc_send_skb+0xa51/0x1370 net/ipv6/ndisc.c:491
ndisc_send_ns+0x38a/0x870 net/ipv6/ndisc.c:633
addrconf_dad_work+0xb9e/0x1320 net/ipv6/addrconf.c:4008
process_one_work+0xbbf/0x1af0 kernel/workqueue.c:2113
worker_thread+0x223/0x1990 kernel/workqueue.c:2247
kthread+0x33c/0x400 kernel/kthread.c:238
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:429
Code: 85 2a 0b 00 00 4d 8b 3c 24 4d 85 ff 75 9f 4c 8b bd 60 fd ff ff e8 bb
57 10 00 65 ff 0d 94 9a a1 7e e9 d9 fc ff ff e8 aa 57 10 00 <0f> 0b e8 a3
57 10 00 e9 14 fb ff ff e8 99 57 10 00 4c 89 bd 70
RIP: __mod_timer kernel/time/timer.c:958 [inline] RSP: ffff8801d24fe9f8
RIP: mod_timer+0x7d6/0x13c0 kernel/time/timer.c:1102 RSP: ffff8801d24fe9f8
---[ end trace f661ab06f5dd8b3d ]---The ledinternal struct can be shared between several different xt_LED targets, but the related timer is currently initialized only if the first target requires it. Fix it by unconditionally initializing the timer struct.
v1 -> v2: call del_timer_sync() unconditionally, too.
---
net/netfilter/xt_LED.c +6 -6
@@ -139,10 +139,11 @@ static int led_tg_check(const struct xt_ goto exit_alloc; } -/* See if we need to set up a timer */ -if (ledinfo->delay >0 ) -setup_timer (&ledinternal->timer, led_timeout_callback, - (unsigned long )ledinternal); +/* Since the letinternal timer can be shared between multiple targets, +* always set it up, even if the current target does not need it +*/ +setup_timer (&ledinternal->timer, led_timeout_callback, + (unsigned long )ledinternal);list_add_tail (&ledinternal->list, &xt_led_triggers);
@@ -179,8 +180,7 @@ static void led_tg_destroy(const structlist_del (&ledinternal->list); -if (ledinfo->delay >0 ) -del_timer_sync (&ledinternal->timer); +del_timer_sync (&ledinternal->timer);led_trigger_unregister (&ledinternal->netfilter_led_trigger);
PATCH 92/153 netfilter: nat: cope with negative port range
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit db57ccf0f2f4624b4c4758379f8165277504fbd7 upstream.
syzbot reported a division by 0 bug in the netfilter nat code:
divide error: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in: CPU: 1 PID: 4168 Comm: syzkaller034710 Not tainted 4.16.0-rc1+ #309 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:nf_nat_l4proto_unique_tuple+0x291/0x530 net/netfilter/nf_nat_proto_common.c:88 RSP: 0018:ffff8801b2466778 EFLAGS: 00010246 RAX: 000000000000f153 RBX: ffff8801b2466dd8 RCX: ffff8801b2466c7c RDX: 0000000000000000 RSI: ffff8801b2466c58 RDI: ffff8801db5293ac RBP: ffff8801b24667d8 R08: ffff8801b8ba6dc0 R09: ffffffff88af5900 R10: ffff8801b24666f0 R11: 0000000000000000 R12: 000000002990f153 R13: 0000000000000001 R14: 0000000000000000 R15: ffff8801b2466c7c FS: 00000000017e3880(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000208fdfe4 CR3: 00000001b5340002 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: dccp_unique_tuple+0x40/0x50 net/netfilter/nf_nat_proto_dccp.c:30 get_unique_tuple+0xc28/0x1c10 net/netfilter/nf_nat_core.c:362 nf_nat_setup_info+0x1c2/0xe00 net/netfilter/nf_nat_core.c:406 nf_nat_redirect_ipv6+0x306/0x730 net/netfilter/nf_nat_redirect.c:124 redirect_tg6+0x7f/0xb0 net/netfilter/xt_REDIRECT.c:34 ip6t_do_table+0xc2a/0x1a30 net/ipv6/netfilter/ip6_tables.c:365 ip6table_nat_do_chain+0x65/0x80 net/ipv6/netfilter/ip6table_nat.c:41 nf_nat_ipv6_fn+0x594/0xa80 net/ipv6/netfilter/nf_nat_l3proto_ipv6.c:302 nf_nat_ipv6_local_fn+0x33/0x5d0 net/ipv6/netfilter/nf_nat_l3proto_ipv6.c:407 ip6table_nat_local_fn+0x2c/0x40 net/ipv6/netfilter/ip6table_nat.c:69 nf_hook_entry_hookfn include/linux/netfilter.h:120 [inline] nf_hook_slow+0xba/0x1a0 net/netfilter/core.c:483 nf_hook include/linux/netfilter.h:243 [inline] NF_HOOK include/linux/netfilter.h:286 [inline] ip6_xmit+0x10ec/0x2260 net/ipv6/ip6_output.c:277 inet6_csk_xmit+0x2fc/0x580 net/ipv6/inet6_connection_sock.c:139 dccp_transmit_skb+0x9ac/0x10f0 net/dccp/output.c:142 dccp_connect+0x369/0x670 net/dccp/output.c:564 dccp_v6_connect+0xe17/0x1bf0 net/dccp/ipv6.c:946 __inet_stream_connect+0x2d4/0xf00 net/ipv4/af_inet.c:620 inet_stream_connect+0x58/0xa0 net/ipv4/af_inet.c:684 SYSC_connect+0x213/0x4a0 net/socket.c:1639 SyS_connect+0x24/0x30 net/socket.c:1620 do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x26/0x9b RIP: 0033:0x441c69 RSP: 002b:00007ffe50cc0be8 EFLAGS: 00000217 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 0000000000441c69 RDX: 000000000000001c RSI: 00000000208fdfe4 RDI: 0000000000000003 RBP: 00000000006cc018 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000538 R11: 0000000000000217 R12: 0000000000403590 R13: 0000000000403620 R14: 0000000000000000 R15: 0000000000000000 Code: 48 89 f0 83 e0 07 83 c0 01 38 d0 7c 08 84 d2 0f 85 46 02 00 00 48 8b 45 c8 44 0f b7 20 e8 88 97 04 fd 31 d2 41 0f b7 c4 4c 89 f9 <41> f7 f6 48 c1 e9 03 48 b8 00 00 00 00 00 fc ff df 0f b6 0c 01 RIP: nf_nat_l4proto_unique_tuple+0x291/0x530
net/netfilter/nf_nat_proto_common.c:88 RSP: ffff8801b2466778
The problem is that currently we don't have any check on the configured port range. A port range == -1 triggers the bug, while other negative values may require a very long time to complete the following loop.
This commit addresses the issue swapping the two ends on negative ranges. The check is performed in nf_nat_l4proto_unique_tuple() since the nft nat loads the port values from nft registers at runtime.
v1 -> v2: use the correct 'Fixes' tag
v2 -> v3: update commit message, drop unneeded READ_ONCE()
--- net/ipv4/netfilter/nf_nat_proto_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/netfilter/nf_nat_proto_common.c +5 -2
@@ -42,7 +42,7 @@ void nf_nat_proto_unique_tuple(struct nfconst struct nf_conn *ct, u_int16_t *rover) { - unsigned int range_size, min, i; + unsigned int range_size, min, max, i;__be16 *portptr;u_int16_t off;
@@ -72,7 +72,10 @@ void nf_nat_proto_unique_tuple(struct nf } }else { min =ntohs (range->min.all); - range_size =ntohs (range->max.all) - min +1 ; + max =ntohs (range->max.all); +if (unlikely (max < min)) +swap (max, min); + range_size = max - min +1 ; }if (range->flags &IP_NAT_RANGE_PROTO_RANDOM )
PATCH 93/153 powerpc/pseries: Add empty update_numa_cpu_lookup_table() for NUMA=n
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Corentin Labbe <[email protected]>
commit c1e150ceb61e4a585bad156da15c33bfe89f5858 upstream.
When CONFIG_NUMA is not set, the build fails with:
arch/powerpc/platforms/pseries/hotplug-cpu.c:335:4:
error: déclaration implicite de la fonction « update_numa_cpu_lookup_table »
So we have to add update_numa_cpu_lookup_table() as an empty function when CONFIG_NUMA is not set.
--- arch/powerpc/include/asm/topology.h | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/include/asm/topology.h +3 -0
@@ -107,6 +107,9 @@ static inline void sysfs_remove_device_f int nid) { } + +static inline void update_numa_cpu_lookup_table (unsigned int cpu,int node) {} +#endif /* CONFIG_NUMA */ #if defined(CONFIG_NUMA ) && defined(CONFIG_PPC_SPLPAR )
PATCH 94/153 USB: OHCI: Fix race between ED unlink and URB submission
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 7d8021c967648accd1b78e5e1ddaad655cd2c61f upstream.
This patch fixes a bug introduced by commit 977dcfdc6031 ("USB: OHCI:
don't lose track of EDs when a controller dies"). The commit changed ed_state from ED_UNLINK to ED_IDLE too early, before finish_urb() had been called. The user-visible consequence is that the driver occasionally crashes or locks up when an URB is submitted while another URB for the same endpoint is being unlinked.
This patch moves the ED state change later, to the right place. The drawback is that now we may unnecessarily execute some instructions multiple times when a controller dies. Since controllers dying is an exceptional occurrence, a little wasted time won't matter.
--- drivers/usb/host/ohci-q.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/usb/host/ohci-q.c +1 -6
@@ -908,10 +908,6 @@ rescan_all:int completed, modified;__hc32 *prev; -/* Is this ED already invisible to the hardware? */ -if (ed->state ==ED_IDLE ) - goto ed_idle; -/* only take off EDs that the HC isn't using, accounting for * frame counter wraps and EDs with partially retired TDs */
@@ -942,14 +938,12 @@ skip_ed: }/* ED's now officially unlinked, hc doesn't see */ - ed->state =ED_IDLE ;if (quirk_zfmicro (ohci) && ed->type ==PIPE_INTERRUPT ) ohci->eds_scheduled--; ed->hwHeadP &= ~cpu_to_hc32 (ohci,ED_H ); ed->hwNextED =0 ;wmb (); ed->hwINFO &= ~cpu_to_hc32 (ohci,ED_SKIP |ED_DEQUEUE ); -ed_idle:/* reentrancy: if we drop the schedule lock, someone might * have modified this list. normally it's just prepending
@@ -1020,6 +1014,7 @@ rescan_this:if (list_empty (&ed->td_list)) { *last = ed->ed_next; ed->ed_next =NULL ; + ed->state =ED_IDLE ; }else if (HC_IS_RUNNING (ohci_to_hcd (ohci)->state)) { *last = ed->ed_next; ed->ed_next =NULL ;
PATCH 95/153 usb: ohci: Proper handling of ed_rm_list to handle race condition between usb_kill_urb() and finish_unlinks()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: AMAN DEEP <[email protected]>
commit 46408ea558df13b110e0866b99624384a33bdeba upstream.
There is a race condition between finish_unlinks->finish_urb() function and usb_kill_urb() in ohci controller case. The finish_urb calls spin_unlock(&ohci->lock) before usb_hcd_giveback_urb() function call, then if during this time, usb_kill_urb is called for another endpoint, then new ed will be added to ed_rm_list at beginning for unlink, and ed_rm_list will point to newly added.
When finish_urb() is completed in finish_unlinks() and ed->td_list becomes empty as in below code (in finish_unlinks() function):
if (list_empty(&ed->td_list)) {
*last = ed->ed_next;
ed->ed_next = NULL;
} else if (ohci->rh_state == OHCI_RH_RUNNING) {
*last = ed->ed_next;
ed->ed_next = NULL;
ed_schedule(ohci, ed);
}The *last = ed->ed_next will make ed_rm_list to point to ed->ed_next and previously added ed by usb_kill_urb will be left unreferenced by ed_rm_list. This causes usb_kill_urb() hang forever waiting for finish_unlink to remove added ed from ed_rm_list.
The main reason for hang in this race condtion is addition and removal of ed from ed_rm_list in the beginning during usb_kill_urb and later last* is modified in finish_unlinks().
As suggested by Alan Stern, the solution for proper handling of ohci->ed_rm_list is to remove ed from the ed_rm_list before finishing any URBs. Then at the end, we can add ed back to the list if necessary.
This properly handle the updated ohci->ed_rm_list in usb_kill_urb().
--- drivers/usb/host/ohci-q.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/usb/host/ohci-q.c +10 -7
@@ -949,6 +949,8 @@ skip_ed:* have modified this list. normally it's just prepending * entries (which we'd ignore), but paranoia won't hurt. */ + *last = ed->ed_next; + ed->ed_next =NULL ; modified =0 ;/* unlink urbs as requested, but rescan the list after
@@ -1007,20 +1009,21 @@ rescan_this: goto rescan_this;/* -* If no TDs are queued, take ED off the ed_rm_list. +* If no TDs are queued, ED is now idle. * Otherwise, if the HC is running, reschedule. -* If not, leave it on the list for further dequeues. +* If the HC isn't running, add ED back to the +* start of the list for later processing. */ if (list_empty (&ed->td_list)) { - *last = ed->ed_next; - ed->ed_next =NULL ; ed->state =ED_IDLE ; }else if (HC_IS_RUNNING (ohci_to_hcd (ohci)->state)) { - *last = ed->ed_next; - ed->ed_next =NULL ;ed_schedule (ohci, ed); }else { - last = &ed->ed_next; + ed->ed_next = ohci->ed_rm_list; + ohci->ed_rm_list = ed; +/* Don't loop on the same ED */ +if (last == &ohci->ed_rm_list) + last = &ed->ed_next; }if (modified)
PATCH 96/153 Add delay-init quirk for Corsair K70 RGB keyboards
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jack Stocker <[email protected]>
commit 7a1646d922577b5b48c0d222e03831141664bb59 upstream.
Following on from this patch: https://lkml.org/lkml/2017/11/3/516,
Corsair K70 RGB keyboards also require the DELAY_INIT quirk to start correctly at boot.
Device ids found here:
usb 3-3: New USB device found, idVendor=1b1c, idProduct=1b13 usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-3: Product: Corsair K70 RGB Gaming Keyboard
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -206,6 +206,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1a0a, 0x0200), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Corsair K70 RGB */ + { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Corsair Strafe RGB */ { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT },
PATCH 97/153 dn_getsockoptdecnet: move nf_{get/set}sockopt outside sock lock
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit dfec091439bb2acf763497cfc58f2bdfc67c56b7 upstream.
After commit 3f34cfae1238 ("netfilter: on sockopt() acquire sock lock only in the required scope"), the caller of nf_{get/set}sockopt() must not hold any lock, but, in such changeset, I forgot to cope with DECnet.
This commit addresses the issue moving the nf call outside the lock, in the dn_{get,set}sockopt() with the same schema currently used by ipv4 and ipv6. Also moves the unhandled sockopts of the end of the main switch statements, to improve code readability.
--- net/decnet/af_decnet.c | 62 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 29 deletions(-)
net/decnet/af_decnet.c +33 -29
@@ -1338,6 +1338,12 @@ static int dn_setsockopt(struct socket *lock_sock (sk); err =__dn_setsockopt (sock, level, optname, optval, optlen,0 );release_sock (sk); +#ifdef CONFIG_NETFILTER +/* we need to exclude all possible ENOPROTOOPTs except default case */ +if (err == -ENOPROTOOPT && optname !=DSO_LINKINFO && + optname !=DSO_STREAM && optname !=DSO_SEQPACKET ) + err =nf_setsockopt (sk, PF_DECnet, optname, optval, optlen); +#endif return err; }
@@ -1445,15 +1451,6 @@ static int __dn_setsockopt(struct socketdn_nsp_send_disc (sk,0x38 ,0 , sk->sk_allocation);break ; -default : -#ifdef CONFIG_NETFILTER -return nf_setsockopt (sk, PF_DECnet, optname, optval, optlen); -#endif -case DSO_LINKINFO : -case DSO_STREAM : -case DSO_SEQPACKET : -return -ENOPROTOOPT ; -case DSO_MAXWINDOW :if (optlen !=sizeof (unsigned long ))return -EINVAL ;
@@ -1501,6 +1498,12 @@ static int __dn_setsockopt(struct socketreturn -EINVAL ; scp->info_loc = u.info;break ; + +case DSO_LINKINFO : +case DSO_STREAM : +case DSO_SEQPACKET : +default : +return -ENOPROTOOPT ; }return 0 ;
@@ -1514,6 +1517,20 @@ static int dn_getsockopt(struct socket *lock_sock (sk); err =__dn_getsockopt (sock, level, optname, optval, optlen,0 );release_sock (sk); +#ifdef CONFIG_NETFILTER +if (err == -ENOPROTOOPT && optname !=DSO_STREAM && + optname !=DSO_SEQPACKET && optname !=DSO_CONACCEPT && + optname !=DSO_CONREJECT ) { +int len; + +if (get_user (len, optlen)) +return -EFAULT ; + + err =nf_getsockopt (sk, PF_DECnet, optname, optval, &len); +if (err >=0 ) + err =put_user (len, optlen); + } +#endif return err; }
@@ -1579,26 +1596,6 @@ static int __dn_getsockopt(struct socket r_data = &link;break ; -default : -#ifdef CONFIG_NETFILTER - { -int ret, len; - -if (get_user (len, optlen)) -return -EFAULT ; - - ret =nf_getsockopt (sk, PF_DECnet, optname, optval, &len); -if (ret >=0 ) - ret =put_user (len, optlen); -return ret; - } -#endif -case DSO_STREAM : -case DSO_SEQPACKET : -case DSO_CONACCEPT : -case DSO_CONREJECT : -return -ENOPROTOOPT ; -case DSO_MAXWINDOW :if (r_len >sizeof (unsigned long )) r_len =sizeof (unsigned long );
@@ -1630,6 +1627,13 @@ static int __dn_getsockopt(struct socket r_len =sizeof (unsigned char ); r_data = &scp->info_rem;break ; + +case DSO_STREAM : +case DSO_SEQPACKET : +case DSO_CONACCEPT : +case DSO_CONREJECT : +default : +return -ENOPROTOOPT ; }if (r_data) {
PATCH 98/153 nospec: Allow index argument to have const-qualified type
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit b98c6a160a057d5686a8c54c79cc6c8c94a7d0c8 upstream.
The last expression in a statement expression need not be a bare variable, quoting gcc docs
The last thing in the compound statement should be an expression followed by a semicolon; the value of this subexpression serves as the value of the entire construct.
and we already use that in e.g. the min/max macros which end with a ternary expression.
This way, we can allow index to have const-qualified type, which will in some cases avoid the need for introducing a local copy of index of non-const qualified type. That, in turn, can prevent readers not familiar with the internals of array_index_nospec from wondering about the seemingly redundant extra variable, and I think that's worthwhile considering how confusing the whole _nospec business is.
The expression _i&_mask has type unsigned long (since that is the type of _mask, and the BUILD_BUG_ONs guarantee that _i will get promoted to that), so in order not to change the type of the whole expression, add a cast back to typeof(_i).
--- include/linux/nospec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/nospec.h +1 -2
@@ -53,7 +53,6 @@ static inline unsigned long array_index_BUILD_BUG_ON (sizeof (_i) >sizeof (long )); \BUILD_BUG_ON (sizeof (_s) >sizeof (long )); \ \ - _i &= _mask; \ - _i; \ + (typeof (_i)) (_i & _mask); \ })#endif /* _LINUX_NOSPEC_H */
PATCH 99/153 libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 9c7be59fc519af9081c46c48f06f2b8fadf55ad8 upstream.
Various people have reported the Crucial MX100 512GB model not working with LPM set to min_power. I've now received a report that it also does not work with the new med_power_with_dipm level.
It does work with medium_power, but that has no measurable power-savings and given the amount of people being bitten by the other levels not working, this commit just disables LPM altogether.
Note all reporters of this have either the 512GB model (max capacity), or are not specifying their SSD's size. So for now this quirk assumes this is a problem with the 512GB model only.
---
drivers/ata/libata-core.c +3 -0
@@ -4155,6 +4155,9 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, +/* The 512GB version of the MX100 has LPM issues */ + { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_NOLPM, }, + /* devices that don't properly handle TRIM commands */ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
PATCH 100/153 netfilter: IDLETIMER: be syzkaller friendly
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit cfc2c740533368b96e2be5e0a4e8c3cace7d9814 upstream.
We had one report from syzkaller [1]
First issue is that INIT_WORK() should be done before mod_timer() or we risk timer being fired too soon, even with a 1 second timer.
Second issue is that we need to reject too big info->timeout to avoid overflows in msecs_to_jiffies(info->timeout * 1000), or risk looping, if result after overflow is 0.
[1]
WARNING: CPU: 1 PID: 5129 at kernel/workqueue.c:1444 __queue_work+0xdf4/0x1230 kernel/workqueue.c:1444 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 5129 Comm: syzkaller159866 Not tainted 4.16.0-rc1+ #230 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 panic+0x1e4/0x41c kernel/panic.c:183 __warn+0x1dc/0x200 kernel/panic.c:547 report_bug+0x211/0x2d0 lib/bug.c:184 fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178 fixup_bug arch/x86/kernel/traps.c:247 [inline] do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315 invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:988 RIP: 0010:__queue_work+0xdf4/0x1230 kernel/workqueue.c:1444 RSP: 0018:ffff8801db507538 EFLAGS: 00010006 RAX: ffff8801aeb46080 RBX: ffff8801db530200 RCX: ffffffff81481404 RDX: 0000000000000100 RSI: ffffffff86b42640 RDI: 0000000000000082 RBP: ffff8801db507758 R08: 1ffff1003b6a0de5 R09: 000000000000000c R10: ffff8801db5073f0 R11: 0000000000000020 R12: 1ffff1003b6a0eb6 R13: ffff8801b1067ae0 R14: 00000000000001f8 R15: dffffc0000000000 queue_work_on+0x16a/0x1c0 kernel/workqueue.c:1488 queue_work include/linux/workqueue.h:488 [inline] schedule_work include/linux/workqueue.h:546 [inline] idletimer_tg_expired+0x44/0x60 net/netfilter/xt_IDLETIMER.c:116 call_timer_fn+0x228/0x820 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers+0x7ee/0xb70 kernel/time/timer.c:1666 run_timer_softirq+0x4c/0x70 kernel/time/timer.c:1692 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285 invoke_softirq kernel/softirq.c:365 [inline] irq_exit+0x1cc/0x200 kernel/softirq.c:405 exiting_irq arch/x86/include/asm/apic.h:541 [inline] smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052 apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:829 </IRQ> RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:777 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x5e/0xba kernel/locking/spinlock.c:184 RSP: 0018:ffff8801c20173c8 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff12 RAX: dffffc0000000000 RBX: 0000000000000282 RCX: 0000000000000006 RDX: 1ffffffff0d592cd RSI: 1ffff10035d68d23 RDI: 0000000000000282 RBP: ffff8801c20173d8 R08: 1ffff10038402e47 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff8820e5c8 R13: ffff8801b1067ad8 R14: ffff8801aea7c268 R15: ffff8801aea7c278 __debug_object_init+0x235/0x1040 lib/debugobjects.c:378 debug_object_init+0x17/0x20 lib/debugobjects.c:391 __init_work+0x2b/0x60 kernel/workqueue.c:506 idletimer_tg_create net/netfilter/xt_IDLETIMER.c:152 [inline] idletimer_tg_checkentry+0x691/0xb00 net/netfilter/xt_IDLETIMER.c:213 xt_check_target+0x22c/0x7d0 net/netfilter/x_tables.c:850 check_target net/ipv6/netfilter/ip6_tables.c:533 [inline] find_check_entry.isra.7+0x935/0xcf0 net/ipv6/netfilter/ip6_tables.c:575 translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:744 do_replace net/ipv6/netfilter/ip6_tables.c:1160 [inline] do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1686 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115 ipv6_setsockopt+0x10b/0x130 net/ipv6/ipv6_sockglue.c:927 udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2976 SYSC_setsockopt net/socket.c:1850 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1829 do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287
--- net/netfilter/xt_IDLETIMER.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/netfilter/xt_IDLETIMER.c +6 -3
@@ -146,11 +146,11 @@ static int idletimer_tg_create(struct id (unsigned long) info->timer); info->timer->refcnt =1 ; +INIT_WORK (&info->timer->work, idletimer_tg_work); +mod_timer (&info->timer->timer,msecs_to_jiffies (info->timeout *1000 ) + jiffies); -INIT_WORK (&info->timer->work, idletimer_tg_work); -return 0 ; out_free_attr:
@@ -191,7 +191,10 @@ static int idletimer_tg_checkentry(constpr_debug ("timeout value is zero\n" );return -EINVAL ; } - +if (info->timeout >=INT_MAX /1000 ) { +pr_debug ("timeout value is too big\n" ); +return -EINVAL ; + }if (info->label[0 ] =='\0' ||strnlen (info->label,MAX_IDLETIMER_LABEL_SIZE ) ==MAX_IDLETIMER_LABEL_SIZE ) {
PATCH 101/153 x86/mm: Fix {pmd,pud}_{set,clear}_flags()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 842cef9113c2120f74f645111ded1e020193d84c upstream.
Just like pte_{set,clear}_flags() their PMD and PUD counterparts should not do any address translation. This was outright wrong under Xen (causing a dead boot with no useful output on "suitable" systems), and produced needlessly more complicated code (even if just slightly) when paravirt was enabled.
[bwh: Backported to 3.2:
- There aren't any pud_{set,clear}_flags() functions
- There's no p4d level]
---
arch/x86/include/asm/pgtable.h +2 -2
@@ -254,14 +254,14 @@ static inline pmd_t pmd_set_flags(pmd_t {pmdval_t v =native_pmd_val (pmd); -return __pmd (v | set); +return native_make_pmd (v | set); }static inline pmd_t pmd_clear_flags (pmd_t pmd,pmdval_t clear) {pmdval_t v =native_pmd_val (pmd); -return __pmd (v & ~clear); +return native_make_pmd (v & ~clear); }static inline pmd_t pmd_mkold (pmd_t pmd)
arch/x86/include/asm/pgtable_types.h +5 -0
@@ -271,6 +271,11 @@ static inline pmdval_t native_pmd_val(pm#else #include <asm-generic/pgtable-nopmd.h> +static inline pmd_t native_make_pmd (pmdval_t val) +{ +return (pmd_t ) { .pud.pgd =native_make_pgd (val) }; +} +static inline pmdval_t native_pmd_val (pmd_t pmd) {return native_pgd_val (pmd.pud.pgd);
PATCH 102/153 libata: disable LPM for Crucial BX100 SSD 500GB drive
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit b17e5729a630d8326a48ec34ef02e6b4464a6aef upstream.
After Laptop Mode Tools starts to use min_power for LPM, a user found out Crucial BX100 SSD can't get mounted.
Crucial BX100 SSD 500GB drive don't work well with min_power. This also happens to med_power_with_dipm.
So let's disable LPM for Crucial BX100 SSD 500GB drive.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -4155,6 +4155,9 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, +/* Crucial BX100 SSD 500GB has broken LPM support */ + { "CT500BX100SSD1", "MU02", ATA_HORKAGE_NOLPM }, +/* The 512GB version of the MX100 has LPM issues */ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_NOLPM, },
PATCH 103/153 kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit 88913bd8ea2a75d7e460a4bed5f75e1c32660d7e upstream.
chan->n_subbufs is set by the user and relay_create_buf() does a kmalloc() of chan->n_subbufs * sizeof(size_t *).
kmalloc_slab() will generate a warning when this fails if chan->subbufs * sizeof(size_t *) > KMALLOC_MAX_SIZE.
Limit chan->n_subbufs to the maximum allowed kmalloc() size.
--- kernel/relay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/relay.c +1 -1
@@ -166,7 +166,7 @@ static struct rchan_buf *relay_create_bu {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 );
PATCH 104/153 regulatory: add NUL to request alpha2
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 657308f73e674e86b60509a430a46e569bf02846 upstream.
Similar to the ancient commit a5fe8e7695dc ("regulatory: add NUL to alpha2"), add another byte to alpha2 in the request struct so that when we use nla_put_string(), we don't overrun anything.
--- include/net/regulatory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/regulatory.h +1 -1
@@ -66,7 +66,7 @@ enum environment_cap {struct regulatory_request {int wiphy_idx;enum nl80211_reg_initiator initiator; -char alpha2[2 ]; +char alpha2[3 ];bool intersect;bool processed;enum environment_cap country_ie_env;
PATCH 105/153 drm/radeon: insist on 32-bit DMA for Cedar on PPC64/PPC64LE
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Crocker <[email protected]>
commit 2c83029cda55a5e7665c7c6326909427d6a01350 upstream.
In radeon_device_init, set the need_dma32 flag for Cedar chips (e.g. FirePro 2270). This fixes, or at least works around, a bug on PowerPC exposed by last year's commits
8e3f1b1d8255105f31556aacf8aeb6071b00d469 (Russell Currey)
and
253fd51e2f533552ae35a0c661705da6c4842c1b (Alistair Popple)
which enabled the 64-bit DMA iommu bypass.
This caused the device to freeze, in some cases unrecoverably, and is the subject of several bug reports internal to Red Hat.
--- drivers/gpu/drm/radeon/radeon_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +4 -0
@@ -784,6 +784,10 @@ int radeon_device_init(struct radeon_devif ((rdev->flags &RADEON_IS_PCI ) && (rdev->family <=CHIP_RS740 )) rdev->need_dma32 = true; +#ifdef CONFIG_PPC64 +if (rdev->family ==CHIP_CEDAR ) + rdev->need_dma32 = true; +#endif dma_bits = rdev->need_dma32 ?32 :40 ; r =pci_set_dma_mask (rdev->pdev,DMA_BIT_MASK (dma_bits));
PATCH 106/153 ALSA: usb-audio: Add a quirck for B&W PX headphones
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Erik Veijola <[email protected]>
commit 240a8af929c7c57dcde28682725b29cf8474e8e5 upstream.
The capture interface doesn't work and the playback interface only supports 48 kHz sampling rate even though it advertises more rates.
--- sound/usb/quirks-table.h | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
sound/usb/quirks-table.h +47 -0
@@ -2766,4 +2766,51 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge } }, +{ +/* +* Bower's & Wilkins PX headphones only support the 48 kHz sample rate +* even though it advertises more. The capture interface doesn't work +* even on windows. +*/ + USB_DEVICE(0x19b5, 0x0021), + .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_AUDIO_STANDARD_MIXER , + }, +/* Capture */ + { + .ifnum =1 , + .type =QUIRK_IGNORE_INTERFACE , + }, +/* Playback */ + { + .ifnum =2 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = &(const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S16_LE , + .channels =2 , + .iface =2 , + .altsetting =1 , + .altset_idx =1 , + .attributes =UAC_EP_CS_ATTR_FILL_MAX | +UAC_EP_CS_ATTR_SAMPLE_RATE , + .endpoint =0x03 , + .ep_attr =USB_ENDPOINT_XFER_ISOC , + .rates =SNDRV_PCM_RATE_48000 , + .rate_min =48000 , + .rate_max =48000 , + .nr_rates =1 , + .rate_table = (unsigned int []) { +48000 + } + } + }, + } + } +}, + #undef USB_DEVICE_VENDOR_SPEC
PATCH 107/153 batman-adv: fix packet checksum in receive path
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
commit abd6360591d3f8259f41c34e31ac4826dfe621b8 upstream.
eth_type_trans() internally calls skb_pull(), which does not adjust the skb checksum; skb_postpull_rcsum() is necessary to avoid log spam of the form "bat0: hw csum failure" when packets with CHECKSUM_COMPLETE are received.
Note that in usual setups, packets don't reach batman-adv with CHECKSUM_COMPLETE (I assume NICs bail out of checksumming when they see batadv's ethtype?), which is why the log messages do not occur on every system using batman-adv. I could reproduce this issue by stacking batman-adv on top of a VXLAN interface.
---
net/batman-adv/soft-interface.c +1 -6
@@ -733,12 +733,7 @@ void interface_rx(struct net_device *sof/* skb->dev & skb->pkt_type are set here */ skb->protocol =eth_type_trans (skb, soft_iface); - -/* should not be necessary anymore as we use skb_pull_rcsum() -* TODO: please verify this and remove this TODO -* -- Dec 21st 2009, Simon Wunderlich */ - -/* skb->ip_summed = CHECKSUM_UNNECESSARY;*/ +skb_postpull_rcsum (skb,eth_hdr (skb),ETH_HLEN ); bat_priv->stats.rx_packets++; bat_priv->stats.rx_bytes += skb->len +sizeof (struct ethhdr );
PATCH 108/153 l2tp: don't use inet_shutdown on ppp session destroy
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Chapman <[email protected]>
commit 225eb26489d05c679a4c4197ffcb81c81e9dcaf4 upstream.
Previously, if a ppp session was closed, we called inet_shutdown to mark the socket as unconnected such that userspace would get errors and then close the socket. This could race with userspace closing the socket. Instead, leave userspace to close the socket in its own time (our session will be detached anyway).
BUG: KASAN: use-after-free in inet_shutdown+0x5d/0x1c0 Read of size 4 at addr ffff880010ea3ac0 by task syzbot_347bd5ac/8296 CPU: 3 PID: 8296 Comm: syzbot_347bd5ac Not tainted 4.16.0-rc1+ #91 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 Call Trace: dump_stack+0x101/0x157 ? inet_shutdown+0x5d/0x1c0 print_address_description+0x78/0x260 ? inet_shutdown+0x5d/0x1c0 kasan_report+0x240/0x360 __asan_load4+0x78/0x80 inet_shutdown+0x5d/0x1c0 ? pppol2tp_show+0x80/0x80 pppol2tp_session_close+0x68/0xb0 l2tp_tunnel_closeall+0x199/0x210 ? udp_v6_flush_pending_frames+0x90/0x90 l2tp_udp_encap_destroy+0x6b/0xc0 ? l2tp_tunnel_del_work+0x2e0/0x2e0 udpv6_destroy_sock+0x8c/0x90 sk_common_release+0x47/0x190 udp_lib_close+0x15/0x20 inet_release+0x85/0xd0 inet6_release+0x43/0x60 sock_release+0x53/0x100 ? sock_alloc_file+0x260/0x260 sock_close+0x1b/0x20 __fput+0x19f/0x380 ____fput+0x1a/0x20 task_work_run+0xd2/0x110 exit_to_usermode_loop+0x18d/0x190 do_syscall_64+0x389/0x3b0 entry_SYSCALL_64_after_hwframe+0x26/0x9b RIP: 0033:0x7fe240a45259 RSP: 002b:00007fe241132df8 EFLAGS: 00000297 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fe240a45259 RDX: 00007fe240a45259 RSI: 0000000000000000 RDI: 00000000000000a5 RBP: 00007fe241132e20 R08: 00007fe241133700 R09: 0000000000000000 R10: 00007fe241133700 R11: 0000000000000297 R12: 0000000000000000 R13: 00007ffc49aff84f R14: 0000000000000000 R15: 00007fe241141040 Allocated by task 8331: save_stack+0x43/0xd0 kasan_kmalloc+0xad/0xe0 kasan_slab_alloc+0x12/0x20 kmem_cache_alloc+0x144/0x3e0 sock_alloc_inode+0x22/0x130 alloc_inode+0x3d/0xf0 new_inode_pseudo+0x1c/0x90 sock_alloc+0x30/0x110 __sock_create+0xaa/0x4c0 SyS_socket+0xbe/0x130 do_syscall_64+0x128/0x3b0 entry_SYSCALL_64_after_hwframe+0x26/0x9b Freed by task 8314: save_stack+0x43/0xd0 __kasan_slab_free+0x11a/0x170 kasan_slab_free+0xe/0x10 kmem_cache_free+0x88/0x2b0 sock_destroy_inode+0x49/0x50 destroy_inode+0x77/0xb0 evict+0x285/0x340 iput+0x429/0x530 dentry_unlink_inode+0x28c/0x2c0 __dentry_kill+0x1e3/0x2f0 dput.part.21+0x500/0x560 dput+0x24/0x30 __fput+0x2aa/0x380 ____fput+0x1a/0x20 task_work_run+0xd2/0x110 exit_to_usermode_loop+0x18d/0x190 do_syscall_64+0x389/0x3b0 entry_SYSCALL_64_after_hwframe+0x26/0x9b
---
net/l2tp/l2tp_ppp.c +0 -12
@@ -467,18 +467,6 @@ abort:*/ static void pppol2tp_session_close (struct l2tp_session *session) { -struct sock *sk; - -BUG_ON (session->magic !=L2TP_SESSION_MAGIC ); - - - sk =pppol2tp_session_get_sock (session); -if (sk) { -if (sk->sk_socket) -inet_shutdown (sk->sk_socket,SEND_SHUTDOWN ); -sock_put (sk); - } -return ; }/* Really kill the session socket. (Called from sock_put() if
PATCH 109/153 l2tp: fix race in pppol2tp_release with session object destroy
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Chapman <[email protected]>
commit d02ba2a6110c530a32926af8ad441111774d2893 upstream.
pppol2tp_release uses call_rcu to put the final ref on its socket. But the session object doesn't hold a ref on the session socket so may be freed while the pppol2tp_put_sk RCU callback is scheduled. Fix this by having the session hold a ref on its socket until the session is destroyed. It is this ref that is dropped via call_rcu.
Sessions are also deleted via l2tp_tunnel_closeall. This must now also put the final ref via call_rcu. So move the call_rcu call site into pppol2tp_session_close so that this happens in both destroy paths. A common destroy path should really be implemented, perhaps with l2tp_tunnel_closeall calling l2tp_session_delete like pppol2tp_release does, but this will be looked at later.
ODEBUG: activate active (active state 1) object type: rcu_head hint: (null)
WARNING: CPU: 3 PID: 13407 at lib/debugobjects.c:291 debug_print_object+0x166/0x220 Modules linked in: CPU: 3 PID: 13407 Comm: syzbot_19c09769 Not tainted 4.16.0-rc2+ #38 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 RIP: 0010:debug_print_object+0x166/0x220 RSP: 0018:ffff880013647a00 EFLAGS: 00010082 RAX: dffffc0000000008 RBX: 0000000000000003 RCX: ffffffff814d3333 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff88001a59f6d0 RBP: ffff880013647a40 R08: 0000000000000000 R09: 0000000000000001 R10: ffff8800136479a8 R11: 0000000000000000 R12: 0000000000000001 R13: ffffffff86161420 R14: ffffffff85648b60 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88001a580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020e77000 CR3: 0000000006022000 CR4: 00000000000006e0 Call Trace: debug_object_activate+0x38b/0x530 ? debug_object_assert_init+0x3b0/0x3b0 ? __mutex_unlock_slowpath+0x85/0x8b0 ? pppol2tp_session_destruct+0x110/0x110 __call_rcu.constprop.66+0x39/0x890 ? __call_rcu.constprop.66+0x39/0x890 call_rcu_sched+0x17/0x20 pppol2tp_release+0x2c7/0x440 ? fcntl_setlk+0xca0/0xca0 ? sock_alloc_file+0x340/0x340 sock_release+0x92/0x1e0 sock_close+0x1b/0x20 __fput+0x296/0x6e0 ____fput+0x1a/0x20 task_work_run+0x127/0x1a0 do_exit+0x7f9/0x2ce0 ? SYSC_connect+0x212/0x310 ? mm_update_next_owner+0x690/0x690 ? up_read+0x1f/0x40 ? __do_page_fault+0x3c8/0xca0 do_group_exit+0x10d/0x330 ? do_group_exit+0x330/0x330 SyS_exit_group+0x22/0x30 do_syscall_64+0x1e0/0x730 ? trace_hardirqs_off_thunk+0x1a/0x1c entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x7f362e471259 RSP: 002b:00007ffe389abe08 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f362e471259 RDX: 00007f362e471259 RSI: 000000000000002e RDI: 0000000000000000 RBP: 00007ffe389abe30 R08: 0000000000000000 R09: 00007f362e944270 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000400b60 R13: 00007ffe389abf50 R14: 0000000000000000 R15: 0000000000000000 Code: 8d 3c dd a0 8f 64 85 48 89 fa 48 c1 ea 03 80 3c 02 00 75 7b 48 8b 14 dd a0 8f 64 85 4c 89 f6 48 c7 c7 20 85 64 85 e
8 2a 55 14 ff <0f> 0b 83 05 ad 2a 68 04 01 48 83 c4 18 5b 41 5c 41 5d 41 5e 41
--- net/l2tp/l2tp_ppp.c | 52 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-)
net/l2tp/l2tp_ppp.c +27 -25
@@ -463,10 +463,28 @@ abort:* Session (and tunnel control) socket create/destroy. *****************************************************************************/ +static void pppol2tp_put_sk (struct rcu_head *head) +{ +struct pppol2tp_session *ps; + + ps =container_of (head,typeof (*ps), rcu); +sock_put (ps->__sk); +} +/* Called by l2tp_core when a session socket is being closed. */ static void pppol2tp_session_close (struct l2tp_session *session) { +struct pppol2tp_session *ps; + + ps =l2tp_session_priv (session); +mutex_lock (&ps->sk_lock); + ps->__sk =rcu_dereference_protected (ps->sk, +lockdep_is_held (&ps->sk_lock)); +RCU_INIT_POINTER (ps->sk,NULL ); +if (ps->__sk) +call_rcu (&ps->rcu, pppol2tp_put_sk); +mutex_unlock (&ps->sk_lock); }/* Really kill the session socket. (Called from sock_put() if
@@ -490,14 +508,6 @@ out:return ; } -static void pppol2tp_put_sk (struct rcu_head *head) -{ -struct pppol2tp_session *ps; - - ps =container_of (head,typeof (*ps), rcu); -sock_put (ps->__sk); -} -/* Called when the PPPoX socket (session) is closed. */ static int pppol2tp_release (struct socket *sock)
@@ -521,26 +531,17 @@ static int pppol2tp_release(struct sockesock_orphan (sk); sock->sk =NULL ; +/* If the socket is associated with a session, +* l2tp_session_delete will call pppol2tp_session_close which +* will drop the session's ref on the socket. +*/ session =pppol2tp_sock_to_session (sk); - -if (session !=NULL ) { -struct pppol2tp_session *ps; - +if (session) {l2tp_session_delete (session); - - ps =l2tp_session_priv (session); -mutex_lock (&ps->sk_lock); - ps->__sk =rcu_dereference_protected (ps->sk, -lockdep_is_held (&ps->sk_lock)); -RCU_INIT_POINTER (ps->sk,NULL ); -mutex_unlock (&ps->sk_lock); -call_rcu (&ps->rcu, pppol2tp_put_sk); - -/* Rely on the sock_put() call at the end of the function for -* dropping the reference held by pppol2tp_sock_to_session(). -* The last reference will be dropped by pppol2tp_put_sk(). -*/ +/* drop the ref obtained by pppol2tp_sock_to_session */ +sock_put (sk); } +skb_queue_purge (&sk->sk_receive_queue);skb_queue_purge (&sk->sk_write_queue);
@@ -828,6 +829,7 @@ static int pppol2tp_connect(struct socke out_no_ppp:/* This is how we get the session context from the socket. */ +sock_hold (sk); sk->sk_user_data = session;rcu_assign_pointer (ps->sk, sk);mutex_unlock (&ps->sk_lock);
PATCH 110/153 tpm_tis: fix potential buffer overruns caused by bit glitches on the bus
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Boone <[email protected]>
commit 6bb320ca4a4a7b5b3db8c8d7250cc40002046878 upstream.
Discrete TPMs are often connected over slow serial buses which, on some platforms, can have glitches causing bit flips. In all the driver _recv() functions, we need to use a u32 to unmarshal the response size, otherwise a bit flip of the 31st bit would cause the expected variable to go negative, which would then try to read a huge amount of data. Also sanity check that the expected amount of data is large enough for the TPM header.
--- drivers/char/tpm/tpm_tis.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis.c +3 -2
@@ -253,7 +253,8 @@ static int recv_data(struct tpm_chip *chstatic int tpm_tis_recv (struct tpm_chip *chip,u8 *buf,size_t count) {int size =0 ; -int expected, status; +int status; +u32 expected;if (count <TPM_HEADER_SIZE ) { size = -EIO ;
@@ -268,7 +269,7 @@ static int tpm_tis_recv(struct tpm_chip } expected =be32_to_cpu (*(__be32 *) (buf +2 )); -if (expected > count) { +if (expected > count || expected <TPM_HEADER_SIZE ) { size = -EIO ; goto out; }
PATCH 111/153 tty: make n_tty_read() always abort if hangup is in progress
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 28b0f8a6962a24ed21737578f3b1b07424635c9e upstream.
A tty is hung up by __tty_hangup() setting file->f_op to hung_up_tty_fops, which is skipped on ttys whose write operation isn't tty_write(). This means that, for example, /dev/console whose write op is redirected_tty_write() is never actually marked hung up.
Because n_tty_read() uses the hung up status to decide whether to abort the waiting readers, the lack of hung-up marking can lead to the following scenario.
1. A session contains two processes. The leader and its child. The child ignores SIGHUP.
2. The leader exits and starts disassociating from the controlling terminal (/dev/console).
3. __tty_hangup() skips setting f_op to hung_up_tty_fops.
4. SIGHUP is delivered and ignored.
5. tty_ldisc_hangup() is invoked. It wakes up the waits which should
clear the read lockers of tty->ldisc_sem.
6. The reader wakes up but because tty_hung_up_p() is false, it doesn't abort and goes back to sleep while read-holding tty->ldisc_sem.
7. The leader progresses to tty_ldisc_lock() in tty_ldisc_hangup() and is now stuck in D sleep indefinitely waiting for tty->ldisc_sem.
The following is Alan's explanation on why some ttys aren't hung up.
http://lkml.kernel.org/r/20171101170908.6ad08580@alans-desktop
1. It broke the serial consoles because they would hang up and close down the hardware. With tty_port that *should* be fixable properly for any cases remaining.
2. The console layer was (and still is) completely broken and doens't refcount properly. So if you turn on console hangups it breaks (as indeed does freeing consoles and half a dozen other things).
As neither can be fixed quickly, this patch works around the problem by introducing a new flag, TTY_HUPPING, which is used solely to tell n_tty_read() that hang-up is in progress for the console and the readers should be aborted regardless of the hung-up status of the device.
The following is a sample hung task warning caused by this issue.
INFO: task agetty:2662 blocked for more than 120 seconds.
Not tainted 4.11.3-dbg-tty-lockup-02478-gfd6c7ee-dirty #28
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
0 2662 1 0x00000086
Call Trace:
__schedule+0x267/0x890
schedule+0x36/0x80
schedule_timeout+0x23c/0x2e0
ldsem_down_write+0xce/0x1f6
tty_ldisc_lock+0x16/0x30
tty_ldisc_hangup+0xb3/0x1b0
__tty_hangup+0x300/0x410
disassociate_ctty+0x6c/0x290
do_exit+0x7ef/0xb00
do_group_exit+0x3f/0xa0
get_signal+0x1b3/0x5d0
do_signal+0x28/0x660
exit_to_usermode_loop+0x46/0x86
do_syscall_64+0x9c/0xb0
entry_SYSCALL64_slow_path+0x25/0x25The following is the repro. Run "$PROG /dev/console". The parent process hangs in D state.
#include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include <sys/ioctl.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <signal.h> #include <time.h> #include <termios.h>
int main(int argc, char **argv)
{
struct sigaction sact = { .sa_handler = SIG_IGN };
struct timespec ts1s = { .tv_sec = 1 };
pid_t pid;
int fd;
if (argc < 2) {
fprintf(stderr, "test-hung-tty /dev/$TTY\n");
return 1;
}
/* fork a child to ensure that it isn't already the session leader */
pid = fork();
if (pid < 0) {
perror("fork");
return 1;
}
if (pid > 0) {
/* top parent, wait for everyone */
while (waitpid(-1, NULL, 0) >= 0)
;
if (errno != ECHILD)
perror("waitpid");
return 0;
}
/* new session, start a new session and set the controlling tty */
if (setsid() < 0) {
perror("setsid");
return 1;
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
perror("open");
return 1;
}
if (ioctl(fd, TIOCSCTTY, 1) < 0) {
perror("ioctl");
return 1;
}
/* fork a child, sleep a bit and exit */
pid = fork();
if (pid < 0) {
perror("fork");
return 1;
}
if (pid > 0) {
nanosleep(&ts1s, NULL);
printf("Session leader exiting\n");
exit(0);
}
/*
* The child ignores SIGHUP and keeps reading from the controlling
* tty. Because SIGHUP is ignored, the child doesn't get killed on
* parent exit and the bug in n_tty makes the read(2) block the
* parent's control terminal hangup attempt. The parent ends up in
* D sleep until the child is explicitly killed.
*/
sigaction(SIGHUP, &sact, NULL);
printf("Child reading tty\n");
while (1) {
char buf[1024];
if (read(fd, buf, sizeof(buf)) < 0) {
perror("read");
return 1;
}
}
return 0;}
[bwh: Backported to 3.2: TTY_HUPPING is not really a new flag; it's an old flag
that was wrongly removed in 3.19. Just add the test for it in n_tty_read().]
---
drivers/tty/n_tty.c +6 -0
@@ -1809,6 +1809,12 @@ do_it_again: }if (tty_hung_up_p (file))break ; +/* +* Abort readers for ttys which never actually +* get hung up. See __tty_hangup(). +*/ +if (test_bit (TTY_HUPPING , &tty->flags)) +break ;if (!timeout)break ;if (file->f_flags &O_NONBLOCK ) {
PATCH 112/153 serial: sh-sci: prevent lockup on full TTY buffers
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ulrich Hecht <[email protected]>
commit 7842055bfce4bf0170d0f61df8b2add8399697be upstream.
When the TTY buffers fill up to the configured maximum, a system lockup occurs:
[ 598.820128] INFO: rcu_preempt detected stalls on CPUs/tasks: [ 598.825796] 0-...!: (1 GPs behind) idle=5a6/2/0 softirq=1974/1974 fqs=1 [ 598.832577] (detected by 3, t=62517 jiffies, g=296, c=295, q=126) [ 598.838755] Task dump for CPU 0: [ 598.841977] swapper/0 R running task 0 0 0 0x00000022 [ 598.849023] Call trace: [ 598.851476] __switch_to+0x98/0xb0 [ 598.854870] (null)
This can be prevented by doing a dummy read of the RX data register.
This issue affects both HSCIF and SCIF ports. Reported for R-Car H3 ES2.0; reproduced and fixed on H3 ES1.1. Probably affects other R-Car platforms as well.
[bwh: Backported to 3.2:
- Use sci_in()
- Adjust context]
--- drivers/tty/serial/sh-sci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/sh-sci.c +2 -0
@@ -668,6 +668,8 @@ static void sci_receive_chars(struct uar/* Tell the rest of the system the news. New characters! */ tty_flip_buffer_push (tty); }else { +/* TTY buffers full; read from RX reg to prevent lockup */ +sci_in (port, SCxRDR);sci_in (port, SCxSR);/* dummy read */ sci_out (port, SCxSR,SCxSR_RDxF_CLEAR (port)); }
PATCH 113/153 ahci: Add PCI-id for the Highpoint Rocketraid 644L card
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 28b2182dad43f6f8fcbd167539a26714fd12bd64 upstream.
Like the Highpoint Rocketraid 642L and cards using a Marvel 88SE9235 controller in general, this RAID card also supports AHCI mode and short of a custom driver, this is the only way to make it work under Linux.
Note that even though the card is called to 644L, it has a product-id of 0x0645.
--- drivers/ata/ahci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ata/ahci.c +3 -1
@@ -542,7 +542,9 @@ static const struct pci_device_id ahci_p .driver_data = board_ahci_yes_fbs }, { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230), .driver_data = board_ahci_yes_fbs }, - { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), + { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */ + .driver_data = board_ahci_yes_fbs }, + { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */ .driver_data = board_ahci_yes_fbs },/* Promise */
PATCH 114/153 e1000e: Fix check_for_link return value with autoneg off
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
commit 4e7dc08e57c95673d2edaba8983c3de4dd1f65f5 upstream.
When autoneg is off, the .check_for_link callback functions clear the get_link_status flag and systematically return a "pseudo-error". This means that the link is not detected as up until the next execution of the e1000_watchdog_task() 2 seconds later.
---
drivers/net/ethernet/intel/e1000e/ich8lan.c +1 -1
@@ -746,7 +746,7 @@ static s32 e1000_check_for_copper_link_i* we have already determined whether we have link or not. */ if (!mac->autoneg) { - ret_val = -E1000_ERR_CONFIG ; + ret_val =1 ; goto out; }
drivers/net/ethernet/intel/e1000e/lib.c +2 -4
@@ -478,10 +478,8 @@ s32 e1000e_check_for_copper_link(struct* If we are forcing speed/duplex, then we simply return since * we have already determined whether we have link or not. */ -if (!mac->autoneg) { - ret_val = -E1000_ERR_CONFIG ; -return ret_val; - } +if (!mac->autoneg) +return 1 ;/* * Auto-Neg is enabled. Auto Speed Detection takes care
PATCH 115/153 usb: quirks: add control message delay for 1b1c:1b20
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
commit cb88a0588717ba6c756cb5972d75766b273a6817 upstream.
Corsair Strafe RGB keyboard does not respond to usb control messages sometimes and hence generates timeouts.
Commit de3af5bf259d ("usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard") tried to fix those timeouts by adding USB_QUIRK_DELAY_INIT.
Unfortunately, even with this quirk timeouts of usb_control_msg() can still be seen, but with a lower frequency (approx. 1 out of 15):
[ 29.103520] usb 1-8: string descriptor 0 read error: -110 [ 34.363097] usb 1-8: can't set config #1, error -110
Adding further delays to different locations where usb control messages are issued just moves the timeouts to other locations, e.g.:
[ 35.400533] usbhid 1-8:1.0: can't add hid device: -110 [ 35.401014] usbhid: probe of 1-8:1.0 failed with error -110
The only way to reliably avoid those issues is having a pause after each usb control message. In approx. 200 boot cycles no more timeouts were seen.
Addionaly, keep USB_QUIRK_DELAY_INIT as it turned out to be necessary to have the delay in hub_port_connect() after hub_port_init().
The overall boot time seems not to be influenced by these additional delays, even on fast machines and lightweight distributions.
--- drivers/usb/core/message.c | 4 ++++ drivers/usb/core/quirks.c | 3 ++- include/linux/usb/quirks.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/usb/core/message.c +4 -0
@@ -150,6 +150,10 @@ int usb_control_msg(struct usb_device *d ret =usb_internal_control_msg (dev, pipe, dr, data, size, timeout); +/* Linger a bit, prior to the next control message. */ +if (dev->quirks &USB_QUIRK_DELAY_CTRL_MSG ) +msleep (200 ); +kfree (dr);return ret;
drivers/usb/core/quirks.c +2 -1
@@ -210,7 +210,8 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, /* Corsair Strafe RGB */ - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | + USB_QUIRK_DELAY_CTRL_MSG }, /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
include/linux/usb/quirks.h +3 -0
@@ -50,4 +50,7 @@*/ #define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11) +/* Device needs a pause after every control message. */ +#define USB_QUIRK_DELAY_CTRL_MSG BIT(13) +#endif /* __LINUX_USB_QUIRKS_H */
PATCH 116/153 l2tp: do not accept arbitrary sockets
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 17cfe79a65f98abe535261856c5aef14f306dff7 upstream.
syzkaller found an issue caused by lack of sufficient checks in l2tp_tunnel_create()
RAW sockets can not be considered as UDP ones for instance.
In another patch, we shall replace all pr_err() by less intrusive pr_debug() so that syzkaller can find other bugs faster.
==================================================================
BUG: KASAN: slab-out-of-bounds in setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69 dst_release: dst:00000000d53d0d0f refcnt:-1 Write of size 1 at addr ffff8801d013b798 by task syz-executor3/6242 CPU: 1 PID: 6242 Comm: syz-executor3 Not tainted 4.16.0-rc2+ #253 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x23b/0x360 mm/kasan/report.c:412 __asan_report_store1_noabort+0x17/0x20 mm/kasan/report.c:435 setup_udp_tunnel_sock+0x3ee/0x5f0 net/ipv4/udp_tunnel.c:69 l2tp_tunnel_create+0x1354/0x17f0 net/l2tp/l2tp_core.c:1596 pppol2tp_connect+0x14b1/0x1dd0 net/l2tp/l2tp_ppp.c:707 SYSC_connect+0x213/0x4a0 net/socket.c:1640 SyS_connect+0x24/0x30 net/socket.c:1621 do_syscall_64+0x280/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- net/l2tp/l2tp_core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/l2tp/l2tp_core.c +6 -2
@@ -1505,9 +1505,14 @@ int l2tp_tunnel_create(struct net *net, encap = cfg->encap;/* Quick sanity checks */ + err = -EPROTONOSUPPORT ; +if (sk->sk_type !=SOCK_DGRAM ) { +pr_debug ("tunl %hu: fd %d wrong socket type\n" , + tunnel_id, fd); + goto err; + }switch (encap) {case L2TP_ENCAPTYPE_UDP : - err = -EPROTONOSUPPORT ;if (sk->sk_protocol !=IPPROTO_UDP ) {printk (KERN_ERR "tunl %hu: fd %d wrong protocol, got %d, expected %d\n" , tunnel_id, fd, sk->sk_protocol,IPPROTO_UDP );
@@ -1515,7 +1520,6 @@ int l2tp_tunnel_create(struct net *net, }break ;case L2TP_ENCAPTYPE_IP : - err = -EPROTONOSUPPORT ;if (sk->sk_protocol !=IPPROTO_L2TP ) {printk (KERN_ERR "tunl %hu: fd %d wrong protocol, got %d, expected %d\n" , tunnel_id, fd, sk->sk_protocol,IPPROTO_L2TP );
PATCH 117/153 RDMA/ucma: Limit possible option size
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 6a21dfc0d0db7b7e0acedce67ca533a6eb19283c upstream.
Users of ucma are supposed to provide size of option level, in most paths it is supposed to be equal to u8 or u16, but it is not the case for the IB path record, where it can be multiple of struct ib_path_rec_data.
This patch takes simplest possible approach and prevents providing values more than possible to allocate.
--- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -1000,6 +1000,9 @@ static ssize_t ucma_set_option(struct ucif (IS_ERR (ctx))return PTR_ERR (ctx); +if (unlikely (cmd.optval >KMALLOC_MAX_SIZE )) +return -EINVAL ; + optval =kmalloc (cmd.optlen,GFP_KERNEL );if (!optval) { ret = -ENOMEM ;
PATCH 118/153 RDMA/ucma: Check that user doesn't overflow QP state
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit a5880b84430316e3e1c1f5d23aa32ec6000cc717 upstream.
The QP state is limited and declared in enum ib_qp_state, but ucma user was able to supply any possible (u32) value.
--- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -873,6 +873,9 @@ static ssize_t ucma_init_qp_attr(structif (copy_from_user (&cmd, inbuf,sizeof (cmd)))return -EFAULT ; +if (cmd.qp_state >IB_QPS_ERR ) +return -EINVAL ; + ctx =ucma_get_ctx (file, cmd.id);if (IS_ERR (ctx))return PTR_ERR (ctx);
PATCH 119/153 x86/MCE: Save microcode revision in machine check records
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tony Luck <[email protected]>
commit fa94d0c6e0f3431523f5701084d799c77c7d4a4f upstream.
Updating microcode used to be relatively rare. Now that it has become more common we should save the microcode version in a machine check record to make sure that those people looking at the error have this important information bundled with the rest of the logged information.
[ Borislav: Simplify a bit. ]
[bwh: Backported to 3.2:
- Add other new fields to struct mce, to match upstream UAPI
- Adjust filename, context]
---
--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
arch/x86/include/asm/mce.h +4 -0
@@ -76,6 +76,10 @@ struct mce {__u32 socketid;/* CPU socket ID */ __u32 apicid;/* CPU initial apic ID */ __u64 mcgcap;/* MCGCAP MSR: machine check capabilities of CPU */ +__u64 synd;/* MCA_SYND MSR: only valid on SMCA systems */ +__u64 ipid;/* MCA_IPID MSR: only valid on SMCA systems */ +__u64 ppin;/* Protected Processor Inventory Number */ +__u32 microcode;/* Microcode revision */ };/*
arch/x86/kernel/cpu/mcheck/mce.c +3 -1
@@ -125,6 +125,8 @@ void mce_setup(struct mce *m) m->socketid =cpu_data (m->extcpu).phys_proc_id; m->apicid =cpu_data (m->extcpu).initial_apicid;rdmsrl (MSR_IA32_MCG_CAP , m->mcgcap); + + m->microcode = boot_cpu_data.microcode; } DEFINE_PER_CPU(struct mce, injectm);
@@ -221,7 +223,7 @@ static void print_mce(struct mce *m)*/ pr_emerg (HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x microcode %x\n" , m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid, -cpu_data (m->extcpu).microcode); + m->microcode);/* * Print out human-readable details about the MCE error,
PATCH 120/153 USB: usbmon: remove assignment from IS_ERR argument
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
commit 46c236dc7d1212d7417e6fb0317f91c44c719322 upstream.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e1,e2;
statement S1,S2;
@@
+e1 = e2;
if (IS_ERR(
e1
- = e2
)) S1 else S2
// </smpl>
--- drivers/usb/mon/mon_text.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/mon/mon_text.c +4 -2
@@ -386,7 +386,8 @@ static ssize_t mon_text_read_t(struct fistruct mon_event_text *ep;struct mon_text_ptr ptr; -if (IS_ERR (ep =mon_text_read_wait (rp, file))) + ep =mon_text_read_wait (rp, file); +if (IS_ERR (ep))return PTR_ERR (ep);mutex_lock (&rp->printf_lock); ptr.cnt =0 ;
@@ -413,7 +414,8 @@ static ssize_t mon_text_read_u(struct fistruct mon_event_text *ep;struct mon_text_ptr ptr; -if (IS_ERR (ep =mon_text_read_wait (rp, file))) + ep =mon_text_read_wait (rp, file); +if (IS_ERR (ep))return PTR_ERR (ep);mutex_lock (&rp->printf_lock); ptr.cnt =0 ;
PATCH 121/153 usb: usbmon: Read text within supplied buffer size
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pete Zaitcev <[email protected]>
commit a5f596830e27e15f7a0ecd6be55e433d776986d8 upstream.
This change fixes buffer overflows and silent data corruption with the usbmon device driver text file read operations.
--- drivers/usb/mon/mon_text.c | 126 +++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 48 deletions(-)
drivers/usb/mon/mon_text.c +77 -47
@@ -82,6 +82,8 @@ struct mon_reader_text {wait_queue_head_t wait;int printf_size; +size_t printf_offset; +size_t printf_togo;char *printf_buf;struct mutex printf_lock;
@@ -373,75 +375,103 @@ err_alloc:return rc; } -/* -* For simplicity, we read one record in one system call and throw out -* what does not fit. This means that the following does not work: -* dd if=/dbg/usbmon/0t bs=10 -* Also, we do not allow seeks and do not bother advancing the offset. -*/ +static ssize_t mon_text_copy_to_user (struct mon_reader_text *rp, +char __user *const buf,const size_t nbytes) +{ +const size_t togo =min (nbytes, rp->printf_togo); + +if (copy_to_user (buf, &rp->printf_buf[rp->printf_offset], togo)) +return -EFAULT ; + rp->printf_togo -= togo; + rp->printf_offset += togo; +return togo; +} + +/* ppos is not advanced since the llseek operation is not permitted. */ static ssize_t mon_text_read_t (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +size_t nbytes,loff_t *ppos) {struct mon_reader_text *rp = file->private_data;struct mon_event_text *ep;struct mon_text_ptr ptr; +ssize_t ret; - ep =mon_text_read_wait (rp, file); -if (IS_ERR (ep)) -return PTR_ERR (ep);mutex_lock (&rp->printf_lock); - ptr.cnt =0 ; - ptr.pbuf = rp->printf_buf; - ptr.limit = rp->printf_size; - -mon_text_read_head_t (rp, &ptr, ep); -mon_text_read_statset (rp, &ptr, ep); - ptr.cnt +=snprintf (ptr.pbuf + ptr.cnt, ptr.limit - ptr.cnt, -" %d" , ep->length); -mon_text_read_data (rp, &ptr, ep); -if (copy_to_user (buf, rp->printf_buf, ptr.cnt)) - ptr.cnt = -EFAULT ; +if (rp->printf_togo ==0 ) { + + ep =mon_text_read_wait (rp, file); +if (IS_ERR (ep)) { +mutex_unlock (&rp->printf_lock); +return PTR_ERR (ep); + } + ptr.cnt =0 ; + ptr.pbuf = rp->printf_buf; + ptr.limit = rp->printf_size; + +mon_text_read_head_t (rp, &ptr, ep); +mon_text_read_statset (rp, &ptr, ep); + ptr.cnt +=snprintf (ptr.pbuf + ptr.cnt, ptr.limit - ptr.cnt, +" %d" , ep->length); +mon_text_read_data (rp, &ptr, ep); + + rp->printf_togo = ptr.cnt; + rp->printf_offset =0 ; + +kmem_cache_free (rp->e_slab, ep); + } + + ret =mon_text_copy_to_user (rp, buf, nbytes);mutex_unlock (&rp->printf_lock); -kmem_cache_free (rp->e_slab, ep); -return ptr.cnt; +return ret; } +/* ppos is not advanced since the llseek operation is not permitted. */ static ssize_t mon_text_read_u (struct file *file,char __user *buf, -size_t nbytes,loff_t *ppos) +size_t nbytes,loff_t *ppos) {struct mon_reader_text *rp = file->private_data;struct mon_event_text *ep;struct mon_text_ptr ptr; +ssize_t ret; - ep =mon_text_read_wait (rp, file); -if (IS_ERR (ep)) -return PTR_ERR (ep);mutex_lock (&rp->printf_lock); - ptr.cnt =0 ; - ptr.pbuf = rp->printf_buf; - ptr.limit = rp->printf_size; -mon_text_read_head_u (rp, &ptr, ep); -if (ep->type =='E' ) { -mon_text_read_statset (rp, &ptr, ep); - }else if (ep->xfertype ==USB_ENDPOINT_XFER_ISOC ) { -mon_text_read_isostat (rp, &ptr, ep); -mon_text_read_isodesc (rp, &ptr, ep); - }else if (ep->xfertype ==USB_ENDPOINT_XFER_INT ) { -mon_text_read_intstat (rp, &ptr, ep); - }else { -mon_text_read_statset (rp, &ptr, ep); +if (rp->printf_togo ==0 ) { + + ep =mon_text_read_wait (rp, file); +if (IS_ERR (ep)) { +mutex_unlock (&rp->printf_lock); +return PTR_ERR (ep); + } + ptr.cnt =0 ; + ptr.pbuf = rp->printf_buf; + ptr.limit = rp->printf_size; + +mon_text_read_head_u (rp, &ptr, ep); +if (ep->type =='E' ) { +mon_text_read_statset (rp, &ptr, ep); + }else if (ep->xfertype ==USB_ENDPOINT_XFER_ISOC ) { +mon_text_read_isostat (rp, &ptr, ep); +mon_text_read_isodesc (rp, &ptr, ep); + }else if (ep->xfertype ==USB_ENDPOINT_XFER_INT ) { +mon_text_read_intstat (rp, &ptr, ep); + }else { +mon_text_read_statset (rp, &ptr, ep); + } + ptr.cnt +=snprintf (ptr.pbuf + ptr.cnt, ptr.limit - ptr.cnt, +" %d" , ep->length); +mon_text_read_data (rp, &ptr, ep); + + rp->printf_togo = ptr.cnt; + rp->printf_offset =0 ; + +kmem_cache_free (rp->e_slab, ep); } - ptr.cnt +=snprintf (ptr.pbuf + ptr.cnt, ptr.limit - ptr.cnt, -" %d" , ep->length); -mon_text_read_data (rp, &ptr, ep); -if (copy_to_user (buf, rp->printf_buf, ptr.cnt)) - ptr.cnt = -EFAULT ; + ret =mon_text_copy_to_user (rp, buf, nbytes);mutex_unlock (&rp->printf_lock); -kmem_cache_free (rp->e_slab, ep); -return ptr.cnt; +return ret; } static struct mon_event_text *mon_text_read_wait(struct mon_reader_text *rp,
PATCH 122/153 xhci: Fix front USB ports on ASUS PRIME B350M-A
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 191edc5e2e515aab1075a3f0ef23599e80be5f59 upstream.
When a USB device gets plugged on ASUS PRIME B350M-A's front ports, the xHC stops working:
[ 549.114587] xhci_hcd 0000:02:00.0: WARN: xHC CMD_RUN timeout [ 549.114608] suspend_common(): xhci_pci_suspend+0x0/0xc0 returns -110 [ 549.114638] xhci_hcd 0000:02:00.0: can't suspend (hcd_pci_runtime_suspend returned -110)
Delay before running xHC command CMD_RUN can workaround the issue.
Use a new quirk to make the delay only targets to the affected xHC.
--- drivers/usb/host/xhci-pci.c | 3 +++ drivers/usb/host/xhci.c | 3 +++ drivers/usb/host/xhci.h | 1 + 3 files changed, 7 insertions(+)
drivers/usb/host/xhci-pci.c +3 -0
@@ -112,6 +112,9 @@ static void xhci_pci_quirks(struct devicif (pdev->vendor ==PCI_VENDOR_ID_AMD &&usb_amd_find_chipset_info ()) xhci->quirks |=XHCI_AMD_PLL_FIX ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && pdev->device ==0x43bb ) + xhci->quirks |=XHCI_SUSPEND_DELAY ; +if (pdev->vendor ==PCI_VENDOR_ID_AMD ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ;
drivers/usb/host/xhci.c +3 -0
@@ -936,6 +936,9 @@ int xhci_suspend(struct xhci_hcd *xhci,clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);del_timer_sync (&hcd->rh_timer); +if (xhci->quirks &XHCI_SUSPEND_DELAY ) +usleep_range (1000 ,1500 ); +spin_lock_irq (&xhci->lock);clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags);clear_bit (HCD_FLAG_HW_ACCESSIBLE , &xhci->shared_hcd->flags);
drivers/usb/host/xhci.h +1 -0
@@ -1503,6 +1503,7 @@ struct xhci_hcd {#define XHCI_PME_STUCK_QUIRK (1 << 20)#define XHCI_MISSING_CAS (1 << 24)#define XHCI_U2_DISABLE_WAKE (1 << 27) +#define XHCI_SUSPEND_DELAY (1 << 30)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
PATCH 123/153 ALSA: seq: Fix possible UAF in snd_seq_check_queue()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit d0f833065221cbfcbadf19fd4102bcfa9330006a upstream.
Although we've covered the races between concurrent write() and ioctl() in the previous patch series, there is still a possible UAF in the following scenario:
A: user client closed B: timer irq
-> snd_seq_release() -> snd_seq_timer_interrupt()
-> snd_seq_free_client() -> snd_seq_check_queue()
-> cell = snd_seq_prioq_cell_peek()
-> snd_seq_prioq_leave()
.... removing all cells
-> snd_seq_pool_done()
.... vfree()
-> snd_seq_compare_tick_time(cell)
... OopsSo the problem is that a cell is peeked and accessed without any protection until it's retrieved from the queue again via snd_seq_prioq_cell_out().
This patch tries to address it, also cleans up the code by a slight refactoring. snd_seq_prioq_cell_out() now receives an extra pointer argument. When it's non-NULL, the function checks the event timestamp with the given pointer. The caller needs to pass the right reference either to snd_seq_tick or snd_seq_realtime depending on the event timestamp type.
A good news is that the above change allows us to remove the snd_seq_prioq_cell_peek(), too, thus the patch actually reduces the code size.
--- sound/core/seq/seq_prioq.c | 28 ++++++++++++++-------------- sound/core/seq/seq_prioq.h | 6 ++---- sound/core/seq/seq_queue.c | 28 +++++++++------------------- 3 files changed, 25 insertions(+), 37 deletions(-)
sound/core/seq/seq_prioq.c +14 -13
@@ -89,7 +89,7 @@ void snd_seq_prioq_delete(struct snd_seqif (f->cells >0 ) {/* drain prioQ */ while (f->cells >0 ) -snd_seq_cell_free (snd_seq_prioq_cell_out (f)); +snd_seq_cell_free (snd_seq_prioq_cell_out (f,NULL )); }kfree (f);
@@ -216,8 +216,18 @@ int snd_seq_prioq_cell_in(struct snd_seqreturn 0 ; } +/* return 1 if the current time >= event timestamp */ +static int event_is_ready (struct snd_seq_event *ev,void *current_time) +{ +if ((ev->flags &SNDRV_SEQ_TIME_STAMP_MASK ) ==SNDRV_SEQ_TIME_STAMP_TICK ) +return snd_seq_compare_tick_time (current_time, &ev->time.tick); +else +return snd_seq_compare_real_time (current_time, &ev->time.time); +} +/* dequeue cell from prioq */ -struct snd_seq_event_cell *snd_seq_prioq_cell_out (struct snd_seq_prioq *f) +struct snd_seq_event_cell *snd_seq_prioq_cell_out (struct snd_seq_prioq *f, +void *current_time) {struct snd_seq_event_cell *cell;unsigned long flags;
@@ -229,6 +239,8 @@ struct snd_seq_event_cell *snd_seq_prioqspin_lock_irqsave (&f->lock, flags); cell = f->head; +if (cell && current_time && !event_is_ready (&cell->event, current_time)) + cell =NULL ;if (cell) { f->head = cell->next;
@@ -255,17 +267,6 @@ int snd_seq_prioq_avail(struct snd_seq_p } -/* peek at cell at the head of the prioq */ -struct snd_seq_event_cell *snd_seq_prioq_cell_peek (struct snd_seq_prioq * f) -{ -if (f ==NULL ) { -snd_printd ("oops: snd_seq_prioq_cell_in() called with NULL prioq\n" ); -return NULL ; - } -return f->head; -} - -static inline int prioq_match (struct snd_seq_event_cell *cell,int client,int timestamp) {
sound/core/seq/seq_prioq.h +2 -4
@@ -44,14 +44,12 @@ void snd_seq_prioq_delete(struct snd_seqint snd_seq_prioq_cell_in (struct snd_seq_prioq *f,struct snd_seq_event_cell *cell);/* dequeue cell from prioq */ -struct snd_seq_event_cell *snd_seq_prioq_cell_out (struct snd_seq_prioq *f); +struct snd_seq_event_cell *snd_seq_prioq_cell_out (struct snd_seq_prioq *f, +void *current_time);/* return number of events available in prioq */ int snd_seq_prioq_avail (struct snd_seq_prioq *f); -/* peek at cell at the head of the prioq */ -struct snd_seq_event_cell *snd_seq_prioq_cell_peek (struct snd_seq_prioq *f); -/* client left queue */ void snd_seq_prioq_leave (struct snd_seq_prioq *f,int client,int timestamp);
sound/core/seq/seq_queue.c +9 -19
@@ -275,30 +275,20 @@ void snd_seq_check_queue(struct snd_seq_ __again:/* Process tick queue... */ -while ((cell =snd_seq_prioq_cell_peek (q->tickq)) !=NULL ) { -if (snd_seq_compare_tick_time (&q->timer->tick.cur_tick, - &cell->event.time.tick)) { - cell =snd_seq_prioq_cell_out (q->tickq); -if (cell) -snd_seq_dispatch_event (cell, atomic, hop); - }else { -/* event remains in the queue */ +for (;;) { + cell =snd_seq_prioq_cell_out (q->tickq, + &q->timer->tick.cur_tick); +if (!cell)break ; - } +snd_seq_dispatch_event (cell, atomic, hop); } -/* Process time queue... */ -while ((cell =snd_seq_prioq_cell_peek (q->timeq)) !=NULL ) { -if (snd_seq_compare_real_time (&q->timer->cur_time, - &cell->event.time.time)) { - cell =snd_seq_prioq_cell_out (q->timeq); -if (cell) -snd_seq_dispatch_event (cell, atomic, hop); - }else { -/* event remains in the queue */ +for (;;) { + cell =snd_seq_prioq_cell_out (q->timeq, &q->timer->cur_time); +if (!cell)break ; - } +snd_seq_dispatch_event (cell, atomic, hop); }/* free lock */
PATCH 124/153 ALSA: seq: Clear client entry before deleting else at closing
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit a2ff19f7b70118ced291a28d5313469914de451b upstream.
When releasing a client, we need to clear the clienttab[] entry at first, then call snd_seq_queue_client_leave(). Otherwise, the in-flight cell in the queue might be picked up by the timer interrupt via snd_seq_check_queue() before calling snd_seq_queue_client_leave(), and it's delivered to another queue while the client is clearing queues. This may eventually result in an uncleared cell remaining in a queue, and the later snd_seq_pool_delete() may need to wait for a long time until the event gets really processed.
By moving the clienttab[] clearance at the beginning of release, any event delivery of a cell belonging to this client will fail at a later point, since snd_seq_client_ptr() returns NULL. Thus the cell that was picked up by the timer interrupt will be returned immediately without further delivery, and the long stall of snd_seq_delete_pool() can be avoided, too.
--- sound/core/seq/seq_clientmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/seq/seq_clientmgr.c +2 -2
@@ -270,12 +270,12 @@ static int seq_free_client1(struct snd_sif (!client)return 0 ; -snd_seq_delete_all_ports (client); -snd_seq_queue_client_leave (client->number);spin_lock_irqsave (&clients_lock, flags); clienttablock[client->number] =1 ; clienttab[client->number] =NULL ;spin_unlock_irqrestore (&clients_lock, flags); +snd_seq_delete_all_ports (client); +snd_seq_queue_client_leave (client->number);snd_use_lock_sync (&client->use_lock);snd_seq_queue_client_termination (client->number);if (client->pool)
PATCH 125/153 netfilter: bridge: ebt_among: add missing match size checks
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit c4585a2823edf4d1326da44d1524ecbfda26bb37 upstream.
ebt_among is special, it has a dynamic match size and is exempt from the central size checks.
Therefore it must check that the size of the match structure provided from userspace is sane by making sure em->match_size is at least the minimum size of the expected structure.
The module has such a check, but its only done after accessing a structure that might be out of bounds.
tested with: ebtables -A INPUT ... \
--among-dst fe:fe:fe:fe:fe:fe
--among-dst fe:fe:fe:fe:fe:fe --among-src fe:fe:fe:fe:ff:f,fe:fe:fe:fe:fe:fb,fe:fe:fe:fe:fc:fd,fe:fe:fe:fe:fe:fd,fe:fe:fe:fe:fe:fe --among-src fe:fe:fe:fe:ff:f,fe:fe:fe:fe:fe:fa,fe:fe:fe:fe:fe:fd,fe:fe:fe:fe:fe:fe,fe:fe:fe:fe:fe:fe
--- net/bridge/netfilter/ebt_among.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
net/bridge/netfilter/ebt_among.c +19 -2
@@ -172,18 +172,35 @@ ebt_among_mt(const struct sk_buff *skb,return true; } +static bool poolsize_invalid (const struct ebt_mac_wormhash *w) +{ +return w && w->poolsize >= (INT_MAX /sizeof (struct ebt_mac_wormhash_tuple )); +} +static int ebt_among_mt_check (const struct xt_mtchk_param *par) {const struct ebt_among_info *info = par->matchinfo;const struct ebt_entry_match *em = container_of(par->matchinfo, const struct ebt_entry_match, data); -int expected_length =sizeof (struct ebt_among_info ); +unsigned int expected_length =sizeof (struct ebt_among_info );const struct ebt_mac_wormhash *wh_dst, *wh_src;int err; +if (expected_length > em->match_size) +return -EINVAL ; + wh_dst =ebt_among_wh_dst (info); - wh_src =ebt_among_wh_src (info); +if (poolsize_invalid (wh_dst)) +return -EINVAL ; + expected_length +=ebt_mac_wormhash_size (wh_dst); +if (expected_length > em->match_size) +return -EINVAL ; + + wh_src =ebt_among_wh_src (info); +if (poolsize_invalid (wh_src)) +return -EINVAL ; + expected_length +=ebt_mac_wormhash_size (wh_src);if (em->match_size !=EBT_ALIGN (expected_length)) {
PATCH 126/153 netfilter: bridge: ebt_among: add more missing match size checks
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit c8d70a700a5b486bfa8e5a7d33d805389f6e59f9 upstream.
ebt_among is special, it has a dynamic match size and is exempt from the central size checks.
commit c4585a2823edf ("bridge: ebt_among: add missing match size checks") added validation for pool size, but missed fact that the macros ebt_among_wh_src/dst can already return out-of-bound result because they do not check value of wh_src/dst_ofs (an offset) vs. the size of the match that userspace gave to us.
v2:
check that offset has correct alignment.
Paolo Abeni points out that we should also check that src/dst wormhash arrays do not overlap, and src + length lines up with start of dst (or vice versa).
v3: compact wormhash_sizes_valid() part
NB: Fixes tag is intentionally wrong, this bug exists from day one when match was added for 2.6 kernel. Tag is there so stable maintainers will notice this one too.
Tested with same rules from the earlier patch.
--- net/bridge/netfilter/ebt_among.c | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
net/bridge/netfilter/ebt_among.c +34 -0
@@ -177,6 +177,28 @@ static bool poolsize_invalid(const strucreturn w && w->poolsize >= (INT_MAX /sizeof (struct ebt_mac_wormhash_tuple )); } +static bool wormhash_offset_invalid (int off,unsigned int len) +{ +if (off ==0 )/* not present */ +return false; + +if (off < (int )sizeof (struct ebt_among_info ) || + off % __alignof__(struct ebt_mac_wormhash )) +return true; + + off +=sizeof (struct ebt_mac_wormhash ); + +return off > len; +} + +static bool wormhash_sizes_valid (const struct ebt_mac_wormhash *wh,int a,int b) +{ +if (a ==0 ) + a =sizeof (struct ebt_among_info ); + +return ebt_mac_wormhash_size (wh) + a == b; +} +static int ebt_among_mt_check (const struct xt_mtchk_param *par) {const struct ebt_among_info *info = par->matchinfo;
@@ -189,6 +211,10 @@ static int ebt_among_mt_check(const struif (expected_length > em->match_size)return -EINVAL ; +if (wormhash_offset_invalid (info->wh_dst_ofs, em->match_size) || +wormhash_offset_invalid (info->wh_src_ofs, em->match_size)) +return -EINVAL ; + wh_dst =ebt_among_wh_dst (info);if (poolsize_invalid (wh_dst))return -EINVAL ;
@@ -201,6 +227,14 @@ static int ebt_among_mt_check(const struif (poolsize_invalid (wh_src))return -EINVAL ; +if (info->wh_src_ofs < info->wh_dst_ofs) { +if (!wormhash_sizes_valid (wh_src, info->wh_src_ofs, info->wh_dst_ofs)) +return -EINVAL ; + }else { +if (!wormhash_sizes_valid (wh_dst, info->wh_dst_ofs, info->wh_src_ofs)) +return -EINVAL ; + } + expected_length +=ebt_mac_wormhash_size (wh_src);if (em->match_size !=EBT_ALIGN (expected_length)) {
PATCH 127/153 RDMA/ucma: Fix access to non-initialized CM_ID object
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 7688f2c3bbf55e52388e37ac5d63ca471a7712e1 upstream.
The attempt to join multicast group without ensuring that CMA device exists will lead to the following crash reported by syzkaller.
[ 64.076794] BUG: KASAN: null-ptr-deref in rdma_join_multicast+0x26e/0x12c0 [ 64.076797] Read of size 8 at addr 00000000000000b0 by task join/691 [ 64.076797] [ 64.076800] CPU: 1 PID: 691 Comm: join Not tainted 4.16.0-rc1-00219-gb97853b65b93 #23 [ 64.076802] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-proj4 [ 64.076803] Call Trace: [ 64.076809] dump_stack+0x5c/0x77 [ 64.076817] kasan_report+0x163/0x380 [ 64.085859] ? rdma_join_multicast+0x26e/0x12c0 [ 64.086634] rdma_join_multicast+0x26e/0x12c0 [ 64.087370] ? rdma_disconnect+0xf0/0xf0 [ 64.088579] ? __radix_tree_replace+0xc3/0x110 [ 64.089132] ? node_tag_clear+0x81/0xb0 [ 64.089606] ? idr_alloc_u32+0x12e/0x1a0 [ 64.090517] ? __fprop_inc_percpu_max+0x150/0x150 [ 64.091768] ? tracing_record_taskinfo+0x10/0xc0 [ 64.092340] ? idr_alloc+0x76/0xc0 [ 64.092951] ? idr_alloc_u32+0x1a0/0x1a0 [ 64.093632] ? ucma_process_join+0x23d/0x460 [ 64.094510] ucma_process_join+0x23d/0x460 [ 64.095199] ? ucma_migrate_id+0x440/0x440 [ 64.095696] ? futex_wake+0x10b/0x2a0 [ 64.096159] ucma_join_multicast+0x88/0xe0 [ 64.096660] ? ucma_process_join+0x460/0x460 [ 64.097540] ? _copy_from_user+0x5e/0x90 [ 64.098017] ucma_write+0x174/0x1f0 [ 64.098640] ? ucma_resolve_route+0xf0/0xf0 [ 64.099343] ? rb_erase_cached+0x6c7/0x7f0 [ 64.099839] __vfs_write+0xc4/0x350 [ 64.100622] ? perf_syscall_enter+0xe4/0x5f0 [ 64.101335] ? kernel_read+0xa0/0xa0 [ 64.103525] ? perf_sched_cb_inc+0xc0/0xc0 [ 64.105510] ? syscall_exit_register+0x2a0/0x2a0 [ 64.107359] ? __switch_to+0x351/0x640 [ 64.109285] ? fsnotify+0x899/0x8f0 [ 64.111610] ? fsnotify_unmount_inodes+0x170/0x170 [ 64.113876] ? __fsnotify_update_child_dentry_flags+0x30/0x30 [ 64.115813] ? ring_buffer_record_is_on+0xd/0x20 [ 64.117824] ? __fget+0xa8/0xf0 [ 64.119869] vfs_write+0xf7/0x280 [ 64.122001] SyS_write+0xa1/0x120 [ 64.124213] ? SyS_read+0x120/0x120 [ 64.126644] ? SyS_read+0x120/0x120 [ 64.128563] do_syscall_64+0xeb/0x250 [ 64.130732] entry_SYSCALL_64_after_hwframe+0x21/0x86 [ 64.132984] RIP: 0033:0x7f5c994ade99 [ 64.135699] RSP: 002b:00007f5c99b97d98 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 64.138740] RAX: ffffffffffffffda RBX: 00000000200001e4 RCX: 00007f5c994ade99 [ 64.141056] RDX: 00000000000000a0 RSI: 00000000200001c0 RDI: 0000000000000015 [ 64.143536] RBP: 00007f5c99b97ec0 R08: 0000000000000000 R09: 0000000000000000 [ 64.146017] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5c99b97fc0 [ 64.148608] R13: 0000000000000000 R14: 00007fff660e1c40 R15: 00007f5c99b989c0 [ 64.151060] [ 64.153703] Disabling lock debugging due to kernel taint [ 64.156032] BUG: unable to handle kernel NULL pointer dereference at 00000000000000b0 [ 64.159066] IP: rdma_join_multicast+0x26e/0x12c0 [ 64.161451] PGD 80000001d0298067 P4D 80000001d0298067 PUD 1dea39067 PMD 0 [ 64.164442] Oops: 0000 [#1] SMP KASAN PTI [ 64.166817] CPU: 1 PID: 691 Comm: join Tainted: G B 4.16.0-rc1-00219-gb97853b65b93 #23 [ 64.170004] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-proj4 [ 64.174985] RIP: 0010:rdma_join_multicast+0x26e/0x12c0 [ 64.177246] RSP: 0018:ffff8801c8207860 EFLAGS: 00010282 [ 64.179901] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff94789522 [ 64.183344] RDX: 1ffffffff2d50fa5 RSI: 0000000000000297 RDI: 0000000000000297 [ 64.186237] RBP: ffff8801c8207a50 R08: 0000000000000000 R09: ffffed0039040ea7 [ 64.189328] R10: 0000000000000001 R11: ffffed0039040ea6 R12: 0000000000000000 [ 64.192634] R13: 0000000000000000 R14: ffff8801e2022800 R15: ffff8801d4ac2400 [ 64.196105] FS: 00007f5c99b98700(0000) GS:ffff8801e5d00000(0000) knlGS:0000000000000000 [ 64.199211] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 64.202046] CR2: 00000000000000b0 CR3: 00000001d1c48004 CR4: 00000000003606a0 [ 64.205032] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 64.208221] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 64.211554] Call Trace: [ 64.213464] ? rdma_disconnect+0xf0/0xf0 [ 64.216124] ? __radix_tree_replace+0xc3/0x110 [ 64.219337] ? node_tag_clear+0x81/0xb0 [ 64.222140] ? idr_alloc_u32+0x12e/0x1a0 [ 64.224422] ? __fprop_inc_percpu_max+0x150/0x150 [ 64.226588] ? tracing_record_taskinfo+0x10/0xc0 [ 64.229763] ? idr_alloc+0x76/0xc0 [ 64.232186] ? idr_alloc_u32+0x1a0/0x1a0 [ 64.234505] ? ucma_process_join+0x23d/0x460 [ 64.237024] ucma_process_join+0x23d/0x460 [ 64.240076] ? ucma_migrate_id+0x440/0x440 [ 64.243284] ? futex_wake+0x10b/0x2a0 [ 64.245302] ucma_join_multicast+0x88/0xe0 [ 64.247783] ? ucma_process_join+0x460/0x460 [ 64.250841] ? _copy_from_user+0x5e/0x90 [ 64.253878] ucma_write+0x174/0x1f0 [ 64.257008] ? ucma_resolve_route+0xf0/0xf0 [ 64.259877] ? rb_erase_cached+0x6c7/0x7f0 [ 64.262746] __vfs_write+0xc4/0x350 [ 64.265537] ? perf_syscall_enter+0xe4/0x5f0 [ 64.267792] ? kernel_read+0xa0/0xa0 [ 64.270358] ? perf_sched_cb_inc+0xc0/0xc0 [ 64.272575] ? syscall_exit_register+0x2a0/0x2a0 [ 64.275367] ? __switch_to+0x351/0x640 [ 64.277700] ? fsnotify+0x899/0x8f0 [ 64.280530] ? fsnotify_unmount_inodes+0x170/0x170 [ 64.283156] ? __fsnotify_update_child_dentry_flags+0x30/0x30 [ 64.286182] ? ring_buffer_record_is_on+0xd/0x20 [ 64.288749] ? __fget+0xa8/0xf0 [ 64.291136] vfs_write+0xf7/0x280 [ 64.292972] SyS_write+0xa1/0x120 [ 64.294965] ? SyS_read+0x120/0x120 [ 64.297474] ? SyS_read+0x120/0x120 [ 64.299751] do_syscall_64+0xeb/0x250 [ 64.301826] entry_SYSCALL_64_after_hwframe+0x21/0x86 [ 64.304352] RIP: 0033:0x7f5c994ade99 [ 64.306711] RSP: 002b:00007f5c99b97d98 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 64.309577] RAX: ffffffffffffffda RBX: 00000000200001e4 RCX: 00007f5c994ade99 [ 64.312334] RDX: 00000000000000a0 RSI: 00000000200001c0 RDI: 0000000000000015 [ 64.315783] RBP: 00007f5c99b97ec0 R08: 0000000000000000 R09: 0000000000000000 [ 64.318365] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5c99b97fc0 [ 64.320980] R13: 0000000000000000 R14: 00007fff660e1c40 R15: 00007f5c99b989c0 [ 64.323515] Code: e8 e8 79 08 ff 4c 89 ff 45 0f b6 a7 b8 01 00 00 e8 68 7c 08 ff 49 8b 1f 4d 89 e5 49 c1 e4 04 48 8 [ 64.330753] RIP: rdma_join_multicast+0x26e/0x12c0 RSP: ffff8801c8207860 [ 64.332979] CR2: 00000000000000b0 [ 64.335550] ---[ end trace 0c00c17a408849c1 ]---
--- drivers/infiniband/core/cma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/cma.c +3 -0
@@ -3131,6 +3131,9 @@ int rdma_join_multicast(struct rdma_cm_istruct cma_multicast *mc;int ret; +if (!id->device) +return -EINVAL ; + id_priv = container_of(id, struct rdma_id_private, id);if (!cma_comp (id_priv,RDMA_CM_ADDR_BOUND ) && !cma_comp (id_priv,RDMA_CM_ADDR_RESOLVED ))
PATCH 128/153 mmc: block: fix updating ext_csd caches on ioctl call
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bastian Stender <[email protected]>
commit e74ef2194b41ba5e511fab29fe5ff00e72d2f42a upstream.
PARTITION_CONFIG is cached in mmc_card->ext_csd.part_config and the currently active partition in mmc_blk_data->part_curr. These caches do not always reflect changes if the ioctl call modifies the PARTITION_CONFIG registers, e.g. by changing BOOT_PARTITION_ENABLE.
Write the PARTITION_CONFIG value extracted from the ioctl call to the cache and update the currently active partition accordingly. This ensures that the user space cannot change the values behind the kernel's back. The next call to mmc_blk_part_switch() will operate on the data set by the ioctl and reflect the changes appropriately.
[bwh: Backported to 3.2:
- Also add the definition of MMC_EXTRACT_INDEX_FROM_ARG()
- Adjust filename, context]
---
drivers/mmc/card/block.c +21 -0
@@ -59,6 +59,9 @@ MODULE_ALIAS("mmc:block");#define INAND_CMD38_ARG_SECTRIM1 0x81#define INAND_CMD38_ARG_SECTRIM2 0x88 +#define MMC_EXTRACT_INDEX_FROM_ARG (x) ((x & 0x00FF0000) >> 16) +#define MMC_EXTRACT_VALUE_FROM_ARG (x) ((x & 0x0000FF00) >> 8) +static DEFINE_MUTEX (block_mutex);/*
@@ -393,6 +396,24 @@ static int mmc_blk_ioctl_cmd(struct bloc }/* +* Make sure the cache of the PARTITION_CONFIG register and +* PARTITION_ACCESS bits is updated in case the ioctl ext_csd write +* changed it successfully. +*/ +if ((MMC_EXTRACT_INDEX_FROM_ARG (cmd.arg) ==EXT_CSD_PART_CONFIG ) && + (cmd.opcode ==MMC_SWITCH )) { +struct mmc_blk_data *main_md =dev_get_drvdata (&card->dev); +u8 value =MMC_EXTRACT_VALUE_FROM_ARG (cmd.arg); + +/* +* Update cache so the next mmc_blk_part_switch call operates +* on up-to-date data. +*/ + card->ext_csd.part_config = value; + main_md->part_curr = value &EXT_CSD_PART_CONFIG_ACC_MASK ; + } + +/* * According to the SD specs, some commands require a delay after * issuing the command. */
PATCH 129/153 drm/radeon: Don't turn off DP sink when disconnected
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit 2681bc79eeb640562c932007bfebbbdc55bf6a7d upstream.
Turning off the sink in this case causes various issues, because userspace expects it to stay on until it turns it off explicitly.
Instead, turn the sink off and back on when a display is connected again. This dance seems necessary for link training to work correctly.
Bugzilla: https://bugs.freedesktop.org/105308
--- drivers/gpu/drm/radeon/radeon_connectors.c | 31 +++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +11 -18
@@ -76,25 +76,18 @@ void radeon_connector_hotplug(struct drm/* don't do anything if sink is not display port, i.e., * passive dp->(dvi|hdmi) adaptor */ -if (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) { -int saved_dpms = connector->dpms; -/* Only turn off the display if it's physically disconnected */ -if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) { -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); - }else if (radeon_dp_needs_link_train (radeon_connector)) { -/* Don't try to start link training before we -* have the dpcd */ -if (!radeon_dp_getdpcd (radeon_connector)) -return ; +if (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT && +radeon_hpd_sense (rdev, radeon_connector->hpd.hpd) && +radeon_dp_needs_link_train (radeon_connector)) { +/* Don't start link training before we have the DPCD */ +if (!radeon_dp_getdpcd (radeon_connector)) +return ; -/* set it to OFF so that drm_helper_connector_dpms() -* won't return immediately since the current state -* is ON at this point. -*/ - connector->dpms =DRM_MODE_DPMS_OFF ; -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); - } - connector->dpms = saved_dpms; +/* Turn the connector off and back on immediately, which +* will trigger link training +*/ +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); } } }
PATCH 130/153 fs: Teach path_connected to handle nfs filesystems with multiple roots.
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 95dd77580ccd66a0da96e6d4696945b8cea39431 upstream.
On nfsv2 and nfsv3 the nfs server can export subsets of the same filesystem and report the same filesystem identifier, so that the nfs client can know they are the same filesystem. The subsets can be from disjoint directory trees. The nfsv2 and nfsv3 filesystems provides no way to find the common root of all directory trees exported form the server with the same filesystem identifier.
The practical result is that in struct super s_root for nfs s_root is not necessarily the root of the filesystem. The nfs mount code sets s_root to the root of the first subset of the nfs filesystem that the kernel mounts.
This effects the dcache invalidation code in generic_shutdown_super currently called shrunk_dcache_for_umount and that code for years has gone through an additional list of dentries that might be dentry trees that need to be freed to accomodate nfs.
When I wrote path_connected I did not realize nfs was so special, and it's hueristic for avoiding calling is_subdir can fail.
The practical case where this fails is when there is a move of a directory from the subtree exposed by one nfs mount to the subtree exposed by another nfs mount. This move can happen either locally or remotely. With the remote case requiring that the move directory be cached before the move and that after the move someone walks the path to where the move directory now exists and in so doing causes the already cached directory to be moved in the dcache through the magic of d_splice_alias.
If someone whose working directory is in the move directory or a subdirectory and now starts calling .. from the initial mount of nfs (where s_root == mnt_root), then path_connected as a heuristic will not bother with the is_subdir check. As s_root really is not the root of the nfs filesystem this heuristic is wrong, and the path may actually not be connected and path_connected can fail.
The is_subdir function might be cheap enough that we can call it unconditionally. Verifying that will take some benchmarking and the result may not be the same on all kernels this fix needs to be backported to. So I am avoiding that for now.
Filesystems with snapshots such as nilfs and btrfs do something similar. But as the directory tree of the snapshots are disjoint from one another and from the main directory tree rename won't move things between them and this problem will not occur.
[bwh: Backported to 3.2:
- Add the super_block::s_iflags field
- Adjust context]
---
fs/namei.c +3 -2
@@ -408,9 +408,10 @@ EXPORT_SYMBOL(path_put);static bool path_connected (const struct path *path) {struct vfsmount *mnt = path->mnt; +struct super_block *sb = mnt->mnt_sb; -/* Only bind mounts can have disconnected paths */ -if (mnt->mnt_root == mnt->mnt_sb->s_root) +/* Bind mounts and multi-root filesystems can have disconnected paths */ +if (!(sb->s_iflags &SB_I_MULTIROOT ) && (mnt->mnt_root == sb->s_root))return true;return is_subdir (path->dentry, mnt->mnt_root);
fs/nfs/super.c +2 -0
@@ -2288,6 +2288,8 @@ static struct dentry *nfs_fs_mount(struc/* initial superblock/root creation */ nfs_fill_super (s, data);nfs_fscache_get_super_cookie (s, data->fscache_uniq,NULL ); +if (!(server->flags &NFS_MOUNT_UNSHARED )) + s->s_iflags |=SB_I_MULTIROOT ; } mntroot =nfs_get_root (s, mntfh, dev_name);
include/linux/fs.h +4 -0
@@ -1416,6 +1416,9 @@ extern int send_sigurg(struct fown_struc#define UMOUNT_NOFOLLOW 0x00000008/* Don't follow symlink on umount */ #define UMOUNT_UNUSED 0x80000000/* Flag guaranteed to be unused */ +/* sb->s_iflags */ +#define SB_I_MULTIROOT 0x00000008/* Multiple roots to the dentry tree */ +extern struct list_head super_blocks;extern spinlock_t sb_lock;
@@ -1432,6 +1435,7 @@ struct super_block {const struct quotactl_ops *s_qcop;const struct export_operations *s_export_op;unsigned long s_flags; +unsigned long s_iflags;/* internal SB_I_* flags */ unsigned long s_magic;struct dentry *s_root;struct rw_semaphore s_umount;
PATCH 131/153 skbuff: Fix not waking applications when errors are enqueued
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit 6e5d58fdc9bedd0255a8781b258f10bbdc63e975 upstream.
When errors are enqueued to the error queue via sock_queue_err_skb() function, it is possible that the waiting application is not notified.
Calling 'sk->sk_data_ready()' would not notify applications that selected only POLLERR events in poll() (for example).
[bwh: Backported to 3.2: sk_data_ready() operation takes a length parameter.
Delete the local variable we used for that.]
--- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -3
@@ -3093,8 +3093,6 @@ static void sock_rmem_free(struct sk_buf*/ int sock_queue_err_skb (struct sock *sk,struct sk_buff *skb) { -int len = skb->len; -if (atomic_read (&sk->sk_rmem_alloc) + skb->truesize >= (unsigned )sk->sk_rcvbuf)return -ENOMEM ;
@@ -3109,7 +3107,7 @@ int sock_queue_err_skb(struct sock *sk,skb_queue_tail (&sk->sk_error_queue, skb);if (!sock_flag (sk,SOCK_DEAD )) - sk->sk_data_ready (sk, len); + sk->sk_error_report (sk);return 0 ; }EXPORT_SYMBOL (sock_queue_err_skb);
PATCH 132/153 libata: Apply NOLPM quirk to Crucial M500 480 and 960GB SSDs
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 62ac3f7305470e3f52f159de448bc1a771717e88 upstream.
There have been reports of the Crucial M500 480GB model not working with LPM set to min_power / med_power_with_dipm level.
It has not been tested with medium_power, but that typically has no measurable power-savings.
Note the reporters Crucial_CT480M500SSD3 has a firmware version of MU03 and there is a MU05 update available, but that update does not mention any LPM fixes in its changelog, so the quirk matches all firmware versions.
In my experience the LPM problems with (older) Crucial SSDs seem to be limited to higher capacity versions of the SSDs (different firmware?), so this commit adds a NOLPM quirk for the 480 and 960GB versions of the M500, to avoid LPM causing issues with these SSDs.
---
drivers/ata/libata-core.c +4 -0
@@ -4161,6 +4161,10 @@ static const struct ata_blacklist_entry/* The 512GB version of the MX100 has LPM issues */ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_NOLPM, }, + /* 480GB+ M500 SSDs have LPM issues */ + { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NOLPM, }, + { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NOLPM, }, + /* devices that don't properly handle TRIM commands */ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, },
PATCH 133/153 libata: Make Crucial BX100 500GB LPM quirk apply to all firmware versions
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 3bf7b5d6d017c27e0d3b160aafb35a8e7cfeda1f upstream.
Commit b17e5729a630 ("libata: disable LPM for Crucial BX100 SSD 500GB drive"), introduced a ATA_HORKAGE_NOLPM quirk for Crucial BX100 500GB SSDs but limited this to the MU02 firmware version, according to:
http://www.crucial.com/usa/en/support-ssd-firmware
MU02 is the last version, so there are no newer possibly fixed versions and if the MU02 version has broken LPM then the MU01 almost certainly also has broken LPM, so this commit changes the quirk to apply to all firmware versions.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -4156,7 +4156,7 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },/* Crucial BX100 SSD 500GB has broken LPM support */ - { "CT500BX100SSD1", "MU02", ATA_HORKAGE_NOLPM }, + { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },/* The 512GB version of the MX100 has LPM issues */ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_NOLPM, },
PATCH 134/153 ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Marinushkin <[email protected]>
commit a6618f4aedb2b60932d766bd82ae7ce866e842aa upstream.
Currently, the offsets in the UAC2 processing unit descriptor are calculated incorrectly. It causes an issue when connecting the device which provides such a feature:
~~~~
[84126.724420] usb 1-1.3.1: invalid Processing Unit descriptor (id 18)
~~~~
After this patch is applied, the UAC2 processing unit inits w/o this error.
--- include/linux/usb/audio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/usb/audio.h +2 -2
@@ -369,7 +369,7 @@ static inline __u8 uac_processing_unit_b {return (protocol ==UAC_VERSION_1 ) ? desc->baSourceID[desc->bNrInPins +4 ] : - desc->baSourceID[desc->bNrInPins +6 ]; +2 ;/* in UAC2, this value is constant */ } static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
@@ -377,7 +377,7 @@ static inline __u8 *uac_processing_unit_ {return (protocol ==UAC_VERSION_1 ) ? &desc->baSourceID[desc->bNrInPins +5 ] : - &desc->baSourceID[desc->bNrInPins +7 ]; + &desc->baSourceID[desc->bNrInPins +6 ]; } static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
PATCH 135/153 RDMA/ucma: Fix use-after-free access in ucma_close
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit ed65a4dc22083e73bac599ded6a262318cad7baf upstream.
The error in ucma_create_id() left ctx in the list of contexts belong to ucma file descriptor. The attempt to close this file descriptor causes to use-after-free accesses while iterating over such list.
--- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -433,6 +433,9 @@ err1:mutex_lock (&mut);idr_remove (&ctx_idr, ctx->id);mutex_unlock (&mut); +mutex_lock (&file->mut); +list_del (&ctx->list); +mutex_unlock (&file->mut);kfree (ctx);return ret; }
PATCH 136/153 RDMA/ucma: Ensure that CM_ID exists prior to access it
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit e8980d67d6017c8eee8f9c35f782c4bd68e004c9 upstream.
Prior to access UCMA commands, the context should be initialized and connected to CM_ID with ucma_create_id(). In case user skips this step, he can provide non-valid ctx without CM_ID and cause to multiple NULL dereferences.
Also there are situations where the create_id can be raced with other user access, ensure that the context is only shared to other threads once it is fully initialized to avoid the races.
[ 109.088108] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 [ 109.090315] IP: ucma_connect+0x138/0x1d0 [ 109.092595] PGD 80000001dc02d067 P4D 80000001dc02d067 PUD 1da9ef067 PMD 0 [ 109.095384] Oops: 0000 [#1] SMP KASAN PTI [ 109.097834] CPU: 0 PID: 663 Comm: uclose Tainted: G B 4.16.0-rc1-00062-g2975d5de6428 #45 [ 109.100816] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014 [ 109.105943] RIP: 0010:ucma_connect+0x138/0x1d0 [ 109.108850] RSP: 0018:ffff8801c8567a80 EFLAGS: 00010246 [ 109.111484] RAX: 0000000000000000 RBX: 1ffff100390acf50 RCX: ffffffff9d7812e2 [ 109.114496] RDX: 1ffffffff3f507a5 RSI: 0000000000000297 RDI: 0000000000000297 [ 109.117490] RBP: ffff8801daa15600 R08: 0000000000000000 R09: ffffed00390aceeb [ 109.120429] R10: 0000000000000001 R11: ffffed00390aceea R12: 0000000000000000 [ 109.123318] R13: 0000000000000120 R14: ffff8801de6459c0 R15: 0000000000000118 [ 109.126221] FS: 00007fabb68d6700(0000) GS:ffff8801e5c00000(0000) knlGS:0000000000000000 [ 109.129468] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 109.132523] CR2: 0000000000000020 CR3: 00000001d45d8003 CR4: 00000000003606b0 [ 109.135573] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 109.138716] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 109.142057] Call Trace: [ 109.144160] ? ucma_listen+0x110/0x110 [ 109.146386] ? wake_up_q+0x59/0x90 [ 109.148853] ? futex_wake+0x10b/0x2a0 [ 109.151297] ? save_stack+0x89/0xb0 [ 109.153489] ? _copy_from_user+0x5e/0x90 [ 109.155500] ucma_write+0x174/0x1f0 [ 109.157933] ? ucma_resolve_route+0xf0/0xf0 [ 109.160389] ? __mod_node_page_state+0x1d/0x80 [ 109.162706] __vfs_write+0xc4/0x350 [ 109.164911] ? kernel_read+0xa0/0xa0 [ 109.167121] ? path_openat+0x1b10/0x1b10 [ 109.169355] ? fsnotify+0x899/0x8f0 [ 109.171567] ? fsnotify_unmount_inodes+0x170/0x170 [ 109.174145] ? __fget+0xa8/0xf0 [ 109.177110] vfs_write+0xf7/0x280 [ 109.179532] SyS_write+0xa1/0x120 [ 109.181885] ? SyS_read+0x120/0x120 [ 109.184482] ? compat_start_thread+0x60/0x60 [ 109.187124] ? SyS_read+0x120/0x120 [ 109.189548] do_syscall_64+0xeb/0x250 [ 109.192178] entry_SYSCALL_64_after_hwframe+0x21/0x86 [ 109.194725] RIP: 0033:0x7fabb61ebe99 [ 109.197040] RSP: 002b:00007fabb68d5e98 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 109.200294] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fabb61ebe99 [ 109.203399] RDX: 0000000000000120 RSI: 00000000200001c0 RDI: 0000000000000004 [ 109.206548] RBP: 00007fabb68d5ec0 R08: 0000000000000000 R09: 0000000000000000 [ 109.209902] R10: 0000000000000000 R11: 0000000000000202 R12: 00007fabb68d5fc0 [ 109.213327] R13: 0000000000000000 R14: 00007fff40ab2430 R15: 00007fabb68d69c0 [ 109.216613] Code: 88 44 24 2c 0f b6 84 24 6e 01 00 00 88 44 24 2d 0f b6 84 24 69 01 00 00 88 44 24 2e 8b 44 24 60 89 44 24 30 e8 da f6 06 ff 31 c0 <66> 41 83 7c 24 20 1b 75 04 8b 44 24 64 48 8d 74 24 20 4c 89 e7 [ 109.223602] RIP: ucma_connect+0x138/0x1d0 RSP: ffff8801c8567a80 [ 109.226256] CR2: 0000000000000020
---
drivers/infiniband/core/ucma.c +8 -5
@@ -126,7 +126,7 @@ static inline struct ucma_context *_ucma ctx =idr_find (&ctx_idr, id);if (!ctx) ctx =ERR_PTR (-ENOENT ); -else if (ctx->file != file) +else if (ctx->file != file || !ctx->cm_id) ctx =ERR_PTR (-EINVAL );return ctx; }
@@ -393,6 +393,7 @@ static ssize_t ucma_create_id(struct ucmstruct rdma_ucm_create_id cmd;struct rdma_ucm_create_id_resp resp;struct ucma_context *ctx; +struct rdma_cm_id *cm_id;enum ib_qp_type qp_type;int ret;
@@ -413,9 +414,9 @@ static ssize_t ucma_create_id(struct ucmreturn -ENOMEM ; ctx->uid = cmd.uid; - ctx->cm_id =rdma_create_id (ucma_event_handler, ctx, cmd.ps, qp_type); -if (IS_ERR (ctx->cm_id)) { - ret =PTR_ERR (ctx->cm_id); + cm_id =rdma_create_id (ucma_event_handler, ctx, cmd.ps, qp_type); +if (IS_ERR (cm_id)) { + ret =PTR_ERR (cm_id); goto err1; }
@@ -425,10 +426,12 @@ static ssize_t ucma_create_id(struct ucm ret = -EFAULT ; goto err2; } + + ctx->cm_id = cm_id;return 0 ; err2: -rdma_destroy_id (ctx->cm_id); +rdma_destroy_id (cm_id); err1:mutex_lock (&mut);idr_remove (&ctx_idr, ctx->id);
PATCH 137/153 RDMA/ucma: Correct option size check using optlen
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chien Tin Tung <[email protected]>
commit 5f3e3b85cc0a5eae1c46d72e47d3de7bf208d9e2 upstream.
The option size check is using optval instead of optlen causing the set option call to fail. Use the correct field, optlen, for size check.
--- drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
@@ -1009,7 +1009,7 @@ static ssize_t ucma_set_option(struct ucif (IS_ERR (ctx))return PTR_ERR (ctx); -if (unlikely (cmd.optval >KMALLOC_MAX_SIZE )) +if (unlikely (cmd.optlen >KMALLOC_MAX_SIZE ))return -EINVAL ; optval =kmalloc (cmd.optlen,GFP_KERNEL );
PATCH 138/153 ALSA: aloop: Sync stale timer before release
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 67a01afaf3d34893cf7d2ea19b34555d6abb7cb0 upstream.
The aloop driver tries to stop the pending timer via timer_del() in the trigger callback and in the close callback. The former is correct, as it's an atomic operation, while the latter expects that the timer gets really removed and proceeds the resource releases after that. But timer_del() doesn't synchronize, hence the running timer may still access the released resources.
A similar situation can be also seen in the prepare callback after trigger(STOP) where the prepare tries to re-initialize the things while a timer is still running.
The problems like the above are seen indirectly in some syzkaller reports (although it's not 100% clear whether this is the only cause, as the race condition is quite narrow and not always easy to trigger).
For addressing these issues, this patch adds the explicit alls of timer_del_sync() in some places, so that the pending timer is properly killed / synced.
--- sound/drivers/aloop.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/drivers/aloop.c +8 -1
@@ -195,6 +195,11 @@ static inline void loopback_timer_stop(sspin_unlock (&dpcm->timer_lock); } +static inline void loopback_timer_stop_sync (struct loopback_pcm *dpcm) +{ +del_timer_sync (&dpcm->timer); +} +#define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)#define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE)#define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE)
@@ -328,6 +333,8 @@ static int loopback_prepare(struct snd_pstruct loopback_cable *cable = dpcm->cable;int bps, salign; +loopback_timer_stop_sync (dpcm); + salign = (snd_pcm_format_width (runtime->format) * runtime->channels) /8 ; bps = salign * runtime->rate;
@@ -736,7 +743,7 @@ static int loopback_close(struct snd_pcmstruct loopback *loopback = substream->private_data;struct loopback_pcm *dpcm = substream->runtime->private_data; -loopback_timer_stop (dpcm); +loopback_timer_stop_sync (dpcm);mutex_lock (&loopback->cable_lock);free_cable (substream);mutex_unlock (&loopback->cable_lock);
PATCH 139/153 ALSA: aloop: Fix access to not-yet-ready substream via cable
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8e6b1a72a75bb5067ccb6b56d8ca4aa3a300a64e upstream.
In loopback_open() and loopback_close(), we assign and release the substream object to the corresponding cable in a racy way. It's neither locked nor done in the right position. The open callback assigns the substream before its preparation finishes, hence the other side of the cable may pick it up, which may lead to the invalid memory access.
This patch addresses these: move the assignment to the end of the open callback, and wrap with cable->lock for avoiding concurrent accesses.
--- sound/drivers/aloop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/drivers/aloop.c +7 -1
@@ -656,7 +656,9 @@ static void free_cable(struct snd_pcm_sureturn ;if (cable->streams[!substream->stream]) {/* other stream is still alive */ +spin_lock_irq (&cable->lock); cable->streams[substream->stream] =NULL ; +spin_unlock_irq (&cable->lock); }else {/* free the cable */ loopback->cables[substream->number][dev] =NULL ;
@@ -697,7 +699,6 @@ static int loopback_open(struct snd_pcm_ loopback->cables[substream->number][dev] = cable; } dpcm->cable = cable; - cable->streams[substream->stream] = dpcm;snd_pcm_hw_constraint_integer (runtime,SNDRV_PCM_HW_PARAM_PERIODS );
@@ -729,6 +730,11 @@ static int loopback_open(struct snd_pcm_ runtime->hw = loopback_pcm_hardware; else runtime->hw = cable->hw; + +spin_lock_irq (&cable->lock); + cable->streams[substream->stream] = dpcm; +spin_unlock_irq (&cable->lock); + unlock:if (err <0 ) {free_cable (substream);
PATCH 140/153 posix-timers: Protect posix clock array access against speculation
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 19b558db12f9f4e45a22012bae7b4783e62224da upstream.
The clockid argument of clockid_to_kclock() comes straight from user space via various syscalls and is used as index into the posix_clocks array.
Protect it against spectre v1 array out of bounds speculation. Remove the redundant check for !posix_clock[id] as this is another source for speculation and does not provide any advantage over the return posix_clock[id] path which returns NULL in that case anyway.
[bwh: Backported to 3.2:
- Move the test of the clock_getres field below the lookup using array_index_nospec()
- Adjust filename, context]
---
kernel/posix-timers.c +12 -3
@@ -47,6 +47,7 @@#include <linux/wait.h> #include <linux/workqueue.h> #include <linux/export.h> +#include <linux/nospec.h> /* * Management arrays for POSIX timers. Timers are kept in slab memory
@@ -520,13 +521,21 @@ static void release_posix_timer(struct kstatic struct k_clock *clockid_to_kclock (const clockid_t id) { -if (id <0 ) +clockid_t idx = id; +struct k_clock *kc; + +if (id <0 ) {return (id &CLOCKFD_MASK ) ==CLOCKFD ? &clock_posix_dynamic : &clock_posix_cpu; + } + +if (id >=ARRAY_SIZE (posix_clocks)) +return NULL ; -if (id >=MAX_CLOCKS || !posix_clocks[id].clock_getres) + kc = &posix_clocks[array_index_nospec (idx,ARRAY_SIZE (posix_clocks))]; +if (!kc->clock_getres)return NULL ; -return &posix_clocks[id]; +return kc; }static int common_timer_create (struct k_itimer *new_timer)
PATCH 141/153 s390/qeth: free netdevice when removing a card
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit 6be687395b3124f002a653c1a50b3260222b3cd7 upstream.
On removal, a qeth card's netdevice is currently not properly freed because the call chain looks as follows:
qeth_core_remove_device(card)
lx_remove_device(card) unregister_netdev(card->dev) card->dev = NULL !!! qeth_core_free_card(card) if (card->dev) !!! free_netdev(card->dev)
Fix it by free'ing the netdev straight after unregistering. This also fixes the sysfs-driven layer switch case (qeth_dev_layer2_store()), where the need to free the current netdevice was not considered at all.
Note that free_netdev() takes care of the netif_napi_del() for us too.
--- drivers/s390/net/qeth_core_main.c | 2 -- drivers/s390/net/qeth_l2_main.c | 2 +- drivers/s390/net/qeth_l3_main.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_core_main.c +0 -2
@@ -4578,8 +4578,6 @@ static void qeth_core_free_card(struct qQETH_DBF_HEX (SETUP ,2 , &card,sizeof (void *));qeth_clean_channel (&card->read);qeth_clean_channel (&card->write); -if (card->dev) -free_netdev (card->dev);kfree (card->ip_tbd_list);qeth_free_qdio_buffers (card);unregister_service_level (&card->qeth_service_level);
drivers/s390/net/qeth_l2_main.c +1 -1
@@ -897,8 +897,8 @@ static void qeth_l2_remove_device(structqeth_l2_set_offline (cgdev);if (card->dev) { -netif_napi_del (&card->napi);unregister_netdev (card->dev); +free_netdev (card->dev); card->dev =NULL ; }return ;
drivers/s390/net/qeth_l3_main.c +1 -1
@@ -3395,8 +3395,8 @@ static void qeth_l3_remove_device(structqeth_l3_set_offline (cgdev);if (card->dev) { -netif_napi_del (&card->napi);unregister_netdev (card->dev); +free_netdev (card->dev); card->dev =NULL ; }
PATCH 142/153 mm/mempolicy.c: avoid use uninitialized preferred_node
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
commit 8970a63e965b43288c4f5f40efbc2bbf80de7f16 upstream.
Alexander reported a use of uninitialized memory in __mpol_equal(), which is caused by incorrect use of preferred_node.
When mempolicy in mode MPOL_PREFERRED with flags MPOL_F_LOCAL, it uses numa_node_id() instead of preferred_node, however, __mpol_equal() uses preferred_node without checking whether it is MPOL_F_LOCAL or not.
--- mm/mempolicy.c | 3 +++ 1 file changed, 3 insertions(+)
mm/mempolicy.c +3 -0
@@ -2019,6 +2019,9 @@ int __mpol_equal(struct mempolicy *a, stcase MPOL_INTERLEAVE :return nodes_equal (a->v.nodes, b->v.nodes);case MPOL_PREFERRED : +/* a's ->flags is the same as b's */ +if (a->flags &MPOL_F_LOCAL ) +return true;return a->v.preferred_node == b->v.preferred_node;default :BUG ();
PATCH 143/153 tracing: probeevent: Fix to support minus offset from symbol
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit c5d343b6b7badd1f5fe0873eff2e8d63a193e732 upstream.
In Documentation/trace/kprobetrace.txt, it says
@SYM[+|-offs] : Fetch memory at SYM +|- offs (SYM should be a data symbol)
However, the parser doesn't parse minus offset correctly, since commit 2fba0c8867af ("tracing/kprobes: Fix probe offset to be unsigned") drops minus ("-") offset support for kprobe probe address usage.
This fixes the traceprobe_split_symbol_offset() to parse minus offset again with checking the offset range, and add a minus offset check in kprobe probe address usage.
---
kernel/trace/trace_kprobe.c +5 -6
@@ -920,7 +920,7 @@ static struct notifier_block trace_probe };/* Split symbol and offset. */ -static int split_symbol_offset (char *symbol,unsigned long *offset) +static int split_symbol_offset (char *symbol,long *offset) {char *tmp;int ret;
@@ -928,10 +928,9 @@ static int split_symbol_offset(char *symif (!offset)return -EINVAL ; - tmp =strchr (symbol,'+' ); + tmp =strpbrk (symbol,"+-" );if (tmp) { -/* skip sign because strict_strtol doesn't accept '+' */ - ret =strict_strtoul (tmp +1 ,0 , offset); + ret =kstrtol (tmp,0 , offset);if (ret)return ret; *tmp ='\0' ;
@@ -1165,7 +1164,7 @@ static int create_trace_probe(int argc,int is_return =0 , is_delete =0 ;char *symbol =NULL , *event =NULL , *group =NULL ;char *arg; -unsigned long offset =0 ; +long offset =0 ;void *addr =NULL ;char buf[MAX_EVENT_NAME_LEN ];
@@ -1238,7 +1237,7 @@ static int create_trace_probe(int argc, symbol = argv[1 ];/* TODO: support .init module functions */ ret =split_symbol_offset (symbol, &offset); -if (ret) { +if (ret || offset <0 || offset >UINT_MAX ) {pr_info ("Failed to parse either an address or a symbol.\n" );return ret; }
PATCH 144/153 tty: vt: fix up tabstops properly
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit f1869a890cdedb92a3fab969db5d0fd982850273 upstream.
Tabs on a console with long lines do not wrap properly, so correctly account for the line length when computing the tab placement location.
--- drivers/tty/vt/vt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +4 -4
@@ -1676,7 +1676,7 @@ static void reset_terminal(struct vc_datdefault_attr (vc);update_attr (vc); - vc->vc_tab_stop[0 ] =0x01010100 ; + vc->vc_tab_stop[0 ] = vc->vc_tab_stop[1 ] = vc->vc_tab_stop[2 ] = vc->vc_tab_stop[3] =
@@ -1715,7 +1715,7 @@ static void do_con_trol(struct tty_struc vc->vc_pos -= (vc->vc_x <<1 );while (vc->vc_x < vc->vc_cols -1 ) { vc->vc_x++; -if (vc->vc_tab_stop[vc->vc_x >>5 ] & (1 << (vc->vc_x &31 ))) +if (vc->vc_tab_stop[7 & (vc->vc_x >>5 )] & (1 << (vc->vc_x &31 )))break ; } vc->vc_pos += (vc->vc_x <<1 );
@@ -1775,7 +1775,7 @@ static void do_con_trol(struct tty_struclf (vc);return ;case 'H' : - vc->vc_tab_stop[vc->vc_x >>5 ] |= (1 << (vc->vc_x &31 )); + vc->vc_tab_stop[7 & (vc->vc_x >>5 )] |= (1 << (vc->vc_x &31 ));return ;case 'Z' :respond_ID (tty);
@@ -1968,7 +1968,7 @@ static void do_con_trol(struct tty_strucreturn ;case 'g' :if (!vc->vc_par[0 ]) - vc->vc_tab_stop[vc->vc_x >>5 ] &= ~(1 << (vc->vc_x &31 )); + vc->vc_tab_stop[7 & (vc->vc_x >>5 )] &= ~(1 << (vc->vc_x &31 ));else if (vc->vc_par[0 ] ==3 ) { vc->vc_tab_stop[0 ] = vc->vc_tab_stop[1] =
PATCH 145/153 netlink: make sure nladdr has correct size in netlink_connect()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Potapenko <[email protected]>
commit 7880287981b60a6808f39f297bb66936e8bdf57a upstream.
KMSAN reports use of uninitialized memory in the case when |alen| is smaller than sizeof(struct sockaddr_nl), and therefore |nladdr| isn't fully copied from the userspace.
--- net/netlink/af_netlink.c | 3 +++ 1 file changed, 3 insertions(+)
net/netlink/af_netlink.c +3 -0
@@ -706,6 +706,9 @@ static int netlink_connect(struct socketif (addr->sa_family !=AF_NETLINK )return -EINVAL ; +if (alen <sizeof (struct sockaddr_nl )) +return -EINVAL ; +/* Only superuser is allowed to send multicasts */ if (nladdr->nl_groups && !netlink_capable (sock,NL_NONROOT_SEND ))return -EPERM ;
PATCH 146/153 ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Roese <[email protected]>
commit 9066ae7ff5d89c0b5daa271e2d573540097a94fa upstream.
When trying to use the driver (e.g. aplay *.wav), the 4MiB DMA buffer will get mmapp'ed in 16KiB chunks. But this fails with the 2nd 16KiB area, as the page offset is outside of the VMA range (size), which is currently used as size parameter in snd_pcm_lib_default_mmap(). By using the DMA buffer size (dma_bytes) instead, the complete DMA buffer can be mmapp'ed and the issue is fixed.
This issue was detected on an ARM platform (TI AM57xx) using the RME HDSP MADI PCIe soundcard.
--- sound/core/pcm_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/pcm_native.c +1 -1
@@ -3187,7 +3187,7 @@ int snd_pcm_lib_default_mmap(struct snd_ area, substream->runtime->dma_area, substream->runtime->dma_addr, - area->vm_end - area->vm_start); + substream->runtime->dma_bytes);#elif defined(CONFIG_MIPS ) && defined(CONFIG_DMA_NONCOHERENT )if (substream->dma_buffer.dev.type ==SNDRV_DMA_TYPE_DEV && !plat_device_is_coherent (substream->dma_buffer.dev.dev))
PATCH 147/153 bonding: process the err returned by dev_set_allmulti properly in bond_enslave
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 9f5a90c107741b864398f4ac0014711a8c1d8474 upstream.
When dev_set_promiscuity(1) succeeds but dev_set_allmulti(1) fails, dev_set_promiscuity(-1) should be done before going to the err path. Otherwise, dev->promiscuity will leak.
--- drivers/net/bonding/bond_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +4 -1
@@ -1704,8 +1704,11 @@ int bond_enslave(struct net_device *bond/* set allmulti level to new slave */ if (bond_dev->flags &IFF_ALLMULTI ) { res =dev_set_allmulti (slave_dev,1 ); -if (res) +if (res) { +if (bond_dev->flags &IFF_PROMISC ) +dev_set_promiscuity (slave_dev,-1 ); goto err_close; + } }netif_addr_lock_bh (bond_dev);
PATCH 148/153 ALSA: pcm: potential uninitialized return values
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 5607dddbfca774fb38bffadcb077fe03aa4ac5c6 upstream.
Smatch complains that "tmp" can be uninitialized if we do a zero size write.
--- sound/core/oss/pcm_oss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/oss/pcm_oss.c +2 -2
@@ -1367,7 +1367,7 @@ static ssize_t snd_pcm_oss_write2(structstatic ssize_t snd_pcm_oss_write1 (struct snd_pcm_substream *substream,const char __user *buf,size_t bytes) {size_t xfer =0 ; -ssize_t tmp; +ssize_t tmp =0 ;struct snd_pcm_runtime *runtime = substream->runtime;if (atomic_read (&substream->mmap_count))
@@ -1474,7 +1474,7 @@ static ssize_t snd_pcm_oss_read2(structstatic ssize_t snd_pcm_oss_read1 (struct snd_pcm_substream *substream,char __user *buf,size_t bytes) {size_t xfer =0 ; -ssize_t tmp; +ssize_t tmp =0 ;struct snd_pcm_runtime *runtime = substream->runtime;if (atomic_read (&substream->mmap_count))
PATCH 149/153 net/mlx4_en: do not ignore autoneg in mlx4_en_set_pauseparam()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
commit 278d436a476f69fc95d5c82bf61b6c2d02f4d44e upstream.
The driver does not support pause autonegotiation so it should return -EINVAL when the function is called with non-zero autoneg.
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +3 -0
@@ -364,6 +364,9 @@ static int mlx4_en_set_pauseparam(structstruct mlx4_en_dev *mdev = priv->mdev;int err; +if (pause->autoneg) +return -EINVAL ; + priv->prof->tx_pause = pause->tx_pause !=0 ; priv->prof->rx_pause = pause->rx_pause !=0 ; err = mlx4_SET_PORT_general(mdev->dev, priv->port,
PATCH 150/153 net/mlx4_en: Fix mixed PFC and Global pause user control requests
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eran Ben Elisha <[email protected]>
commit 6e8814ceb7e8f468659ef9253bd212c07ae19584 upstream.
Global pause and PFC configuration should be mutually exclusive (i.e. only one of them at most can be set). However, once PFC was turned off, driver automatically turned Global pause on. This is a bug.
Fix the driver behaviour to turn off PFC/Global once the user turned the other on.
This also fixed a weird behaviour that at a current time, the profile had both PFC and global pause configuration turned on, which is Hardware-wise impossible and caused returning false positive indication to query tools.
In addition, fix error code when setting global pause or PFC to change metadata only upon successful change.
Also, removed useless debug print.
[bwh: Backported to 3.2:
- Drop changes in en_dcb_nl.c
- Don't call mlx4_en_update_pfc_stats_bitmap()]
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +16 -8
@@ -362,21 +362,29 @@ static int mlx4_en_set_pauseparam(struct {struct mlx4_en_priv *priv =netdev_priv (dev);struct mlx4_en_dev *mdev = priv->mdev; +u8 tx_pause, tx_ppp, rx_pause, rx_ppp;int err;if (pause->autoneg)return -EINVAL ; - priv->prof->tx_pause = pause->tx_pause !=0 ; - priv->prof->rx_pause = pause->rx_pause !=0 ; + tx_pause = !!(pause->tx_pause); + rx_pause = !!(pause->rx_pause); + rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause); + tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause); + err =mlx4_SET_PORT_general (mdev->dev, priv->port, priv->rx_skb_size +ETH_FCS_LEN , - priv->prof->tx_pause, - priv->prof->tx_ppp, - priv->prof->rx_pause, - priv->prof->rx_ppp); -if (err) -en_err (priv,"Failed setting pause params\n" ); + tx_pause, tx_ppp, rx_pause, rx_ppp); +if (err) { +en_err (priv,"Failed setting pause params, err = %d\n" , err); +return err; + } + + priv->prof->tx_pause = tx_pause; + priv->prof->rx_pause = rx_pause; + priv->prof->tx_ppp = tx_ppp; + priv->prof->rx_ppp = rx_ppp;return err; }
drivers/net/ethernet/mellanox/mlx4/en_main.c +2 -2
@@ -112,9 +112,9 @@ static int mlx4_en_get_profile(struct ml params->udp_rss =0 ; }for (i =1 ; i <=MLX4_MAX_PORTS ; i++) { - params->prof[i].rx_pause =1 ; + params->prof[i].rx_pause = !(pfcrx || pfctx); params->prof[i].rx_ppp = pfcrx; - params->prof[i].tx_pause =1 ; + params->prof[i].tx_pause = !(pfcrx || pfctx); params->prof[i].tx_ppp = pfctx; params->prof[i].tx_ring_size =MLX4_EN_DEF_TX_RING_SIZE ; params->prof[i].rx_ring_size =MLX4_EN_DEF_RX_RING_SIZE ;
PATCH 151/153 RDMA/ucma: Check that device is connected prior to access it
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 4b658d1bbc16605330694bb3ef2570c465ef383d upstream.
Add missing check that device is connected prior to access it.
[ 55.358652] BUG: KASAN: null-ptr-deref in rdma_init_qp_attr+0x4a/0x2c0 [ 55.359389] Read of size 8 at addr 00000000000000b0 by task qp/618 [ 55.360255] [ 55.360432] CPU: 1 PID: 618 Comm: qp Not tainted 4.16.0-rc1-00071-gcaf61b1b8b88 #91 [ 55.361693] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.0-0-g63451fca13-prebuilt.qemu-project.org 04/01/2014 [ 55.363264] Call Trace: [ 55.363833] dump_stack+0x5c/0x77 [ 55.364215] kasan_report+0x163/0x380 [ 55.364610] ? rdma_init_qp_attr+0x4a/0x2c0 [ 55.365238] rdma_init_qp_attr+0x4a/0x2c0 [ 55.366410] ucma_init_qp_attr+0x111/0x200 [ 55.366846] ? ucma_notify+0xf0/0xf0 [ 55.367405] ? _get_random_bytes+0xea/0x1b0 [ 55.367846] ? urandom_read+0x2f0/0x2f0 [ 55.368436] ? kmem_cache_alloc_trace+0xd2/0x1e0 [ 55.369104] ? refcount_inc_not_zero+0x9/0x60 [ 55.369583] ? refcount_inc+0x5/0x30 [ 55.370155] ? rdma_create_id+0x215/0x240 [ 55.370937] ? _copy_to_user+0x4f/0x60 [ 55.371620] ? mem_cgroup_commit_charge+0x1f5/0x290 [ 55.372127] ? _copy_from_user+0x5e/0x90 [ 55.372720] ucma_write+0x174/0x1f0 [ 55.373090] ? ucma_close_id+0x40/0x40 [ 55.373805] ? __lru_cache_add+0xa8/0xd0 [ 55.374403] __vfs_write+0xc4/0x350 [ 55.374774] ? kernel_read+0xa0/0xa0 [ 55.375173] ? fsnotify+0x899/0x8f0 [ 55.375544] ? fsnotify_unmount_inodes+0x170/0x170 [ 55.376689] ? __fsnotify_update_child_dentry_flags+0x30/0x30 [ 55.377522] ? handle_mm_fault+0x174/0x320 [ 55.378169] vfs_write+0xf7/0x280 [ 55.378864] SyS_write+0xa1/0x120 [ 55.379270] ? SyS_read+0x120/0x120 [ 55.379643] ? mm_fault_error+0x180/0x180 [ 55.380071] ? task_work_run+0x7d/0xd0 [ 55.380910] ? __task_pid_nr_ns+0x120/0x140 [ 55.381366] ? SyS_read+0x120/0x120 [ 55.381739] do_syscall_64+0xeb/0x250 [ 55.382143] entry_SYSCALL_64_after_hwframe+0x21/0x86 [ 55.382841] RIP: 0033:0x7fc2ef803e99 [ 55.383227] RSP: 002b:00007fffcc5f3be8 EFLAGS: 00000217 ORIG_RAX: 0000000000000001 [ 55.384173] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc2ef803e99 [ 55.386145] RDX: 0000000000000057 RSI: 0000000020000080 RDI: 0000000000000003 [ 55.388418] RBP: 00007fffcc5f3c00 R08: 0000000000000000 R09: 0000000000000000 [ 55.390542] R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000400480 [ 55.392916] R13: 00007fffcc5f3cf0 R14: 0000000000000000 R15: 0000000000000000 [ 55.521088] Code: e5 4d 1e ff 48 89 df 44 0f b6 b3 b8 01 00 00 e8 65 50 1e ff 4c 8b 2b 49 8d bd b0 00 00 00 e8 56 50 1e ff 41 0f b6 c6 48 c1 e0 04 <49> 03 85 b0 00 00 00 48 8d 78 08 48 89 04 24 e8 3a 4f 1e ff 48 [ 55.525980] RIP: rdma_init_qp_attr+0x52/0x2c0 RSP: ffff8801e2c2f9d8 [ 55.532648] CR2: 00000000000000b0 [ 55.534396] ---[ end trace 70cee64090251c0b ]---
--- drivers/infiniband/core/ucma.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/core/ucma.c +5 -0
@@ -886,6 +886,11 @@ static ssize_t ucma_init_qp_attr(structif (IS_ERR (ctx))return PTR_ERR (ctx); +if (!ctx->cm_id->device) { + ret = -EINVAL ; + goto out; + } + resp.qp_attr_mask =0 ;memset (&qp_attr,0 ,sizeof qp_attr); qp_attr.qp_state = cmd.qp_state;
PATCH 152/153 RDMA/ucma: Check that device exists prior to accessing it
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit c8d3bcbfc5eab3f01cf373d039af725f3b488813 upstream.
Ensure that device exists prior to accessing its properties.
--- drivers/infiniband/core/ucma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/ucma.c +4 -2
@@ -1043,7 +1043,7 @@ static ssize_t ucma_notify(struct ucma_f {struct rdma_ucm_notify cmd;struct ucma_context *ctx; -int ret; +int ret = -EINVAL ;if (copy_from_user (&cmd, inbuf,sizeof (cmd)))return -EFAULT ;
@@ -1052,7 +1052,9 @@ static ssize_t ucma_notify(struct ucma_fif (IS_ERR (ctx))return PTR_ERR (ctx); - ret =rdma_notify (ctx->cm_id, (enum ib_event_type ) cmd.event); +if (ctx->cm_id->device) + ret =rdma_notify (ctx->cm_id, (enum ib_event_type )cmd.event); +ucma_put_ctx (ctx);return ret; }
PATCH 153/153 mtd: jedec_probe: Fix crash in jedec_read_mfr()
In reply to Ben Hutchings3.2.102-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 87a73eb5b56fd6e07c8e499fe8608ef2d8912b82 upstream.
It turns out that the loop where we read manufacturer jedec_read_mfd() can under some circumstances get a CFI_MFR_CONTINUATION repeatedly, making the loop go over all banks and eventually hit the end of the map and crash because of an access violation:
Unable to handle kernel paging request at virtual address c4980000 pgd = (ptrval) [c4980000] *pgd=03808811, *pte=00000000, *ppte=00000000 Internal error: Oops: 7 [#1] PREEMPT ARM CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc1+ #150 Hardware name: Gemini (Device Tree) PC is at jedec_probe_chip+0x6ec/0xcd0 LR is at 0x4 pc : [<c03a2bf4>] lr : [<00000004>] psr: 60000013
sp : c382dd18 ip : 0000ffff fp : 00000000
r10: c0626388 r9 : 00020000 r8 : c0626340
r7 : 00000000 r6 : 00000001 r5 : c3a71afc r4 : c382dd70 r3 : 00000001 r2 : c4900000 r1 : 00000002 r0 : 00080000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 0000397f Table: 00004000 DAC: 00000053 Process swapper (pid: 1, stack limit = 0x(ptrval))
Fix this by breaking the loop with a return 0 if
the offset exceeds the map size.
--- drivers/mtd/chips/jedec_probe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/chips/jedec_probe.c +2 -0
@@ -1888,6 +1888,8 @@ static inline u32 jedec_read_mfr(structdo {uint32_t ofs =cfi_build_cmd_addr (0 + (bank <<8 ), map, cfi); mask = (1 << (cfi->device_type *8 )) -1 ; +if (ofs >= map->size) +return 0 ; result =map_read (map, base + ofs); bank++; }while ((result.x[0 ] & mask) ==CFI_MFR_CONTINUATION );
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.102 release. There are 153 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu May 31 23:00:00 UTC 2018. Anything received after that time might be too late.
Build results:
total: 86 pass: 86 fail: 0 Qemu test results: total: 73 pass: 73 fail: 0
Details are available at http://kerneltests.org/builders/.
Guenter
Quoted 13 lines · Guenter Roeck
Quoted 11 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.102 release.
There are 153 patches in this series, which will be posted as responses
to this one. If anyone has any issues with these being applied, please
let me know.Responses should be made by Thu May 31 23:00:00 UTC 2018. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 86 pass: 86 fail: 0 Qemu test results: total: 73 pass: 73 fail: 0Details are available at http://kerneltests.org/builders/.
Thanks for checking.
Ben.
Signature · 2 lines
Ben Hutchings No political challenge can be met by shopping. - George Monbiot