linux/drivers/staging
Suren Baghdasaryan 3e338d3c95 staging: android: ashmem: Fix lockdep warning for write operation
syzbot report [1] describes a deadlock when write operation against an
ashmem fd executed at the time when ashmem is shrinking its cache results
in the following lock sequence:

Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(fs_reclaim);
                                lock(&sb->s_type->i_mutex_key#13);
                                lock(fs_reclaim);
   lock(&sb->s_type->i_mutex_key#13);

kswapd takes fs_reclaim and then inode_lock while generic_perform_write
takes inode_lock and then fs_reclaim. However ashmem does not support
writing into backing shmem with a write syscall. The only way to change
its content is to mmap it and operate on mapped memory. Therefore the race
that lockdep is warning about is not valid. Resolve this by introducing a
separate lockdep class for the backing shmem inodes.

[1]: https://lkml.kernel.org/lkml/0000000000000b5f9d059aa2037f@google.com/

Reported-by: syzbot+7a0d9d0b26efefe61780@syzkaller.appspotmail.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Link: https://lore.kernel.org/r/20200730192632.3088194-1-surenb@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-31 14:41:43 +02:00
..
android staging: android: ashmem: Fix lockdep warning for write operation 2020-07-31 14:41:43 +02:00
axis-fifo
board
clocking-wizard staging: Replace HTTP links with HTTPS ones 2020-07-20 10:22:47 +02:00
comedi staging: comedi: s526: Use fallthrough pseudo-keyword 2020-07-28 10:18:52 +02:00
emxx_udc
fbtft staging: fbtft: fb_st7789v: make HSD20_IPS numeric and not a string 2020-05-22 10:48:32 +02:00
fieldbus
fsl-dpaa2 staging: dpaa2-ethsw: check if there is space for a new VLAN 2020-07-21 16:53:34 +02:00
fwserial
gasket staging: gasket: core: Fix a coding style issue in gasket_core.c 2020-07-15 16:05:14 +02:00
gdm724x staging: gdm724x: Use fallthrough pseudo-keyword 2020-07-28 10:18:52 +02:00
goldfish
greybus drivers: staging: audio: Fix the missing header file for helper file 2020-07-29 16:43:26 +02:00
gs_fpgaboot staging: Replace HTTP links with HTTPS ones 2020-07-20 10:22:47 +02:00
iio iio: remove left-over parent assignments 2020-06-14 11:50:04 +01:00
kpc2000 staging: kpc2000: kpc_dma: Remove additional goto statements 2020-07-01 15:44:26 +02:00
ks7010 staging: ks7010: Use %pM format specifier for MAC addresses 2020-07-31 09:47:44 +02:00
media media fixes for v5.8-rc7 2020-07-22 11:56:00 -07:00
most drivers: most: add USB adapter driver 2020-07-31 14:38:12 +02:00
mt7621-dma
mt7621-dts
mt7621-pci
mt7621-pci-phy
mt7621-pinctrl staging: mt7621-pinctrl: Use correct pointer type argument for sizeof 2020-04-23 13:36:20 +02:00
netlogic
nvec Staging: nvec: Replace HTTP links with HTTPS ones 2020-07-10 13:52:46 +02:00
octeon staging: octeon: Indent with tabs instead of spaces 2020-07-23 20:34:34 +02:00
octeon-usb
olpc_dcon
pi433 staging: pi433: fix error return code in pi433_probe() 2020-05-05 12:31:18 +02:00
qlge staging: qlge: qlge_dbg: removed comment repition 2020-07-30 08:41:40 +02:00
ralink-gdma
rtl8188eu Staging: rtl8188eu: rtw_mlme: Fix uninitialized variable authmode 2020-07-28 10:18:53 +02:00
rtl8192e staging: rtl8192e: Use fallthrough pseudo-keyword 2020-07-28 10:18:51 +02:00
rtl8192u staging: rtl8192u: fix a dubious looking mask before a shift 2020-07-17 12:08:44 +02:00
rtl8712 Staging: rtl8712: Fixed a coding sytle issue 2020-07-29 14:00:25 +02:00
rtl8723bs staging: rtl8723bs: Align macro definitions 2020-07-30 08:41:06 +02:00
rts5208 staging: rts5208: rtsx: Replace depracated MSI API 2020-07-21 16:52:47 +02:00
sm750fb staging: sm750fb: use generic power management 2020-07-29 14:01:37 +02:00
unisys staging: unisys: visorhba: remove redundant initialization of variables scsicmd_id and rc 2020-07-23 20:34:34 +02:00
vc04_services staging: vc04_services: Use fallthrough pseudo-keyword 2020-07-28 10:18:52 +02:00
vme
vt6655 staging: vt6655: Use fallthrough pseudo-keyword 2020-07-10 13:52:46 +02:00
vt6656 staging: vt6655: Use fallthrough pseudo-keyword 2020-07-10 13:52:46 +02:00
wfx staging: wfx: Use flex_array_size() helper in memcpy() 2020-07-30 08:41:06 +02:00
wlan-ng Linux 5.8-rc7 2020-07-27 12:42:15 +02:00
Kconfig staging/speakup: Move out of staging 2020-07-29 14:02:41 +02:00
Makefile staging/speakup: Move out of staging 2020-07-29 14:02:41 +02:00