From 184012ad69b275a17d6fa40a8d4dcf15ef76c4d2 Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Wed, 27 Mar 2019 11:33:01 +0300 Subject: [PATCH 1/3] dtlk: remove double call to nonseekable_open dtlk_open currently has 2 calls to nonseekable_open which are both executed on success path. It was not hurting to make the extra call as nonseekable_open is only changing file->f_flags in idempotent way. However the first nonseekable_open is indeed both unneeded and looks suspicious. The first nonseekable_open was added in 6244f13c51 ("Fix up a couple of drivers - notable sg - for nonseekability."; 2004-Aug-7). The second nonseekable_open call was introduced in dc5c724584 ("Remove ESPIPE logic from drivers, letting the VFS layer handle it instead.; 2004-Aug-8). The latter patch being mass change probably missed to remove nonseekable_open that was introduced into dtlk_open the day before. Fix it: remove the extra/unneeded nonseekable_open call and leave the call to nonseekable_open only on the path where we are actually opening the file. Suggested-by: Pavel Machek Signed-off-by: Kirill Smelkov --- drivers/char/dtlk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index f882460b5a44..669c3311adc4 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -298,7 +298,6 @@ static int dtlk_open(struct inode *inode, struct file *file) { TRACE_TEXT("(dtlk_open"); - nonseekable_open(inode, file); switch (iminor(inode)) { case DTLK_MINOR: if (dtlk_busy) From c5bf68fe0c86a5835bd2e6aead1c49976360753f Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Tue, 26 Mar 2019 23:51:19 +0300 Subject: [PATCH 2/3] *: convert stream-like files from nonseekable_open -> stream_open Using scripts/coccinelle/api/stream_open.cocci added in 10dce8af3422 ("fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock"), search and convert to stream_open all in-kernel nonseekable_open users for which read and write actually do not depend on ppos and where there is no other methods in file_operations which assume @offset access. I've verified each generated change manually - that it is correct to convert - and each other nonseekable_open instance left - that it is either not correct to convert there, or that it is not converted due to current stream_open.cocci limitations. The script also does not convert files that should be valid to convert, but that currently have .llseek = noop_llseek or generic_file_llseek for unknown reason despite file being opened with nonseekable_open (e.g. drivers/input/mousedev.c) Among cases converted 14 were potentially vulnerable to read vs write deadlock (see details in 10dce8af3422): drivers/char/pcmcia/cm4000_cs.c:1685:7-23: ERROR: cm4000_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/gnss/core.c:45:1-17: ERROR: gnss_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/hid/uhid.c:635:1-17: ERROR: uhid_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/infiniband/core/user_mad.c:988:1-17: ERROR: umad_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/input/evdev.c:527:1-17: ERROR: evdev_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/input/misc/uinput.c:401:1-17: ERROR: uinput_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/isdn/capi/capi.c:963:8-24: ERROR: capi_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/leds/uleds.c:77:1-17: ERROR: uleds_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/media/rc/lirc_dev.c:198:1-17: ERROR: lirc_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/s390/char/fs3270.c:488:1-17: ERROR: fs3270_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/usb/misc/ldusb.c:310:1-17: ERROR: ld_usb_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. drivers/xen/evtchn.c:667:8-24: ERROR: evtchn_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. net/batman-adv/icmp_socket.c:80:1-17: ERROR: batadv_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. net/rfkill/core.c:1146:8-24: ERROR: rfkill_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. and the rest were just safe to convert to stream_open because their read and write do not use ppos at all and corresponding file_operations do not have methods that assume @offset file access(*): arch/powerpc/platforms/52xx/mpc52xx_gpt.c:631:8-24: WARNING: mpc52xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_ibox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_mbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. arch/powerpc/platforms/cell/spufs/file.c:591:8-24: WARNING: spufs_wbox_stat_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. arch/um/drivers/harddog_kern.c:88:8-24: WARNING: harddog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. arch/x86/kernel/cpu/microcode/core.c:430:33-49: WARNING: microcode_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/char/ds1620.c:215:8-24: WARNING: ds1620_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/char/dtlk.c:301:1-17: WARNING: dtlk_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/char/ipmi/ipmi_watchdog.c:840:9-25: WARNING: ipmi_wdog_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/char/pcmcia/scr24x_cs.c:95:8-24: WARNING: scr24x_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/char/tb0219.c:246:9-25: WARNING: tb0219_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/firewire/nosy.c:306:8-24: WARNING: nosy_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/hwmon/fschmd.c:840:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/hwmon/w83793.c:1344:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/infiniband/core/ucma.c:1747:8-24: WARNING: ucma_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/infiniband/core/ucm.c:1178:8-24: WARNING: ucm_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/infiniband/core/uverbs_main.c:1086:8-24: WARNING: uverbs_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/input/joydev.c:282:1-17: WARNING: joydev_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/pci/switch/switchtec.c:393:1-17: WARNING: switchtec_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/platform/chrome/cros_ec_debugfs.c:135:8-24: WARNING: cros_ec_console_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/rtc/rtc-ds1374.c:470:9-25: WARNING: ds1374_wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/rtc/rtc-m41t80.c:805:9-25: WARNING: wdt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/s390/char/tape_char.c:293:2-18: WARNING: tape_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/s390/char/zcore.c:194:8-24: WARNING: zcore_reipl_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/s390/crypto/zcrypt_api.c:528:8-24: WARNING: zcrypt_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/spi/spidev.c:594:1-17: WARNING: spidev_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/staging/pi433/pi433_if.c:974:1-17: WARNING: pi433_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/acquirewdt.c:203:8-24: WARNING: acq_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/advantechwdt.c:202:8-24: WARNING: advwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/alim1535_wdt.c:252:8-24: WARNING: ali_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/alim7101_wdt.c:217:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ar7_wdt.c:166:8-24: WARNING: ar7_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/at91rm9200_wdt.c:113:8-24: WARNING: at91wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ath79_wdt.c:135:8-24: WARNING: ath79_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/bcm63xx_wdt.c:119:8-24: WARNING: bcm63xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/cpu5wdt.c:143:8-24: WARNING: cpu5wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/cpwd.c:397:8-24: WARNING: cpwd_fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/eurotechwdt.c:319:8-24: WARNING: eurwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/f71808e_wdt.c:528:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/gef_wdt.c:232:8-24: WARNING: gef_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/geodewdt.c:95:8-24: WARNING: geodewdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ib700wdt.c:241:8-24: WARNING: ibwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ibmasr.c:326:8-24: WARNING: asr_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/indydog.c:80:8-24: WARNING: indydog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/intel_scu_watchdog.c:307:8-24: WARNING: intel_scu_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/iop_wdt.c:104:8-24: WARNING: iop_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/it8712f_wdt.c:330:8-24: WARNING: it8712f_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ixp4xx_wdt.c:68:8-24: WARNING: ixp4xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/ks8695_wdt.c:145:8-24: WARNING: ks8695wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/m54xx_wdt.c:88:8-24: WARNING: m54xx_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/machzwd.c:336:8-24: WARNING: zf_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/mixcomwd.c:153:8-24: WARNING: mixcomwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/mtx-1_wdt.c:121:8-24: WARNING: mtx1_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/mv64x60_wdt.c:136:8-24: WARNING: mv64x60_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/nuc900_wdt.c:134:8-24: WARNING: nuc900wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/nv_tco.c:164:8-24: WARNING: nv_tco_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pc87413_wdt.c:289:8-24: WARNING: pc87413_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd.c:698:8-24: WARNING: pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd.c:737:8-24: WARNING: pcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd_pci.c:581:8-24: WARNING: pcipcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd_pci.c:623:8-24: WARNING: pcipcwd_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd_usb.c:488:8-24: WARNING: usb_pcwd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pcwd_usb.c:527:8-24: WARNING: usb_pcwd_temperature_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pika_wdt.c:121:8-24: WARNING: pikawdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/pnx833x_wdt.c:119:8-24: WARNING: pnx833x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/rc32434_wdt.c:153:8-24: WARNING: rc32434_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/rdc321x_wdt.c:145:8-24: WARNING: rdc321x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/riowd.c:79:1-17: WARNING: riowd_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sa1100_wdt.c:62:8-24: WARNING: sa1100dog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sbc60xxwdt.c:211:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sbc7240_wdt.c:139:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sbc8360.c:274:8-24: WARNING: sbc8360_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sbc_epx_c3.c:81:8-24: WARNING: epx_c3_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sbc_fitpc2_wdt.c:78:8-24: WARNING: fitpc2_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sb_wdog.c:108:1-17: WARNING: sbwdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sc1200wdt.c:181:8-24: WARNING: sc1200wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sc520_wdt.c:261:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/sch311x_wdt.c:319:8-24: WARNING: sch311x_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/scx200_wdt.c:105:8-24: WARNING: scx200_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/smsc37b787_wdt.c:369:8-24: WARNING: wb_smsc_wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/w83877f_wdt.c:227:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/w83977f_wdt.c:301:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wafer5823wdt.c:200:8-24: WARNING: wafwdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/watchdog_dev.c:828:8-24: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdrtas.c:379:8-24: WARNING: wdrtas_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdrtas.c:445:8-24: WARNING: wdrtas_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt285.c:104:1-17: WARNING: watchdog_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt977.c:276:8-24: WARNING: wdt977_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt.c:424:8-24: WARNING: wdt_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt.c:484:8-24: WARNING: wdt_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt_pci.c:464:8-24: WARNING: wdtpci_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. drivers/watchdog/wdt_pci.c:527:8-24: WARNING: wdtpci_temp_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. net/batman-adv/log.c:105:1-17: WARNING: batadv_log_fops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. sound/core/control.c:57:7-23: WARNING: snd_ctl_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. sound/core/rawmidi.c:385:7-23: WARNING: snd_rawmidi_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. sound/core/seq/seq_clientmgr.c:310:7-23: WARNING: snd_seq_f_ops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. sound/core/timer.c:1428:7-23: WARNING: snd_timer_f_ops: .read() has stream semantic; safe to change nonseekable_open -> stream_open. One can also recheck/review the patch via generating it with explanation comments included via $ make coccicheck MODE=patch COCCI=scripts/coccinelle/api/stream_open.cocci SPFLAGS="-D explain" (*) This second group also contains cases with read/write deadlocks that stream_open.cocci don't yet detect, but which are still valid to convert to stream_open since ppos is not used. For example drivers/pci/switch/switchtec.c calls wait_for_completion_interruptible() in its .read, but stream_open.cocci currently detects only "wait_event*" as blocking. Cc: Michael Kerrisk Cc: Yongzhi Pan Cc: Jonathan Corbet Cc: David Vrabel Cc: Juergen Gross Cc: Miklos Szeredi Cc: Tejun Heo Cc: Kirill Tkhai Cc: Arnd Bergmann Cc: Christoph Hellwig Cc: Greg Kroah-Hartman Cc: Julia Lawall Cc: Nikolaus Rath Cc: Han-Wen Nienhuys Cc: Anatolij Gustschin Cc: Jeff Dike Cc: Richard Weinberger Cc: Anton Ivanov Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "James R. Van Zandt" Cc: Corey Minyard Cc: Harald Welte Acked-by: Lubomir Rintel [scr24x_cs] Cc: Stefan Richter Cc: Johan Hovold Cc: David Herrmann Cc: Jiri Kosina Cc: Benjamin Tissoires Cc: Jean Delvare Acked-by: Guenter Roeck [watchdog/* hwmon/*] Cc: Rudolf Marek Cc: Dmitry Torokhov Cc: Karsten Keil Cc: Jacek Anaszewski Cc: Pavel Machek Cc: Mauro Carvalho Chehab Cc: Kurt Schwemmer Acked-by: Logan Gunthorpe [drivers/pci/switch/switchtec] Acked-by: Bjorn Helgaas [drivers/pci/switch/switchtec] Cc: Benson Leung Acked-by: Enric Balletbo i Serra [platform/chrome] Cc: Alessandro Zummo Acked-by: Alexandre Belloni [rtc/*] Cc: Mark Brown Cc: Wim Van Sebroeck Cc: Florian Fainelli Cc: bcm-kernel-feedback-list@broadcom.com Cc: Wan ZongShun Cc: Zwane Mwaikambo Cc: Marek Lindner Cc: Simon Wunderlich Cc: Antonio Quartulli Cc: "David S. Miller" Cc: Johannes Berg Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Kirill Smelkov --- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 2 +- arch/powerpc/platforms/cell/spufs/file.c | 2 +- arch/um/drivers/harddog_kern.c | 2 +- arch/x86/kernel/cpu/microcode/core.c | 2 +- drivers/char/ds1620.c | 2 +- drivers/char/dtlk.c | 2 +- drivers/char/ipmi/ipmi_watchdog.c | 2 +- drivers/char/pcmcia/cm4000_cs.c | 2 +- drivers/char/pcmcia/scr24x_cs.c | 2 +- drivers/char/tb0219.c | 2 +- drivers/firewire/nosy.c | 2 +- drivers/gnss/core.c | 2 +- drivers/hid/uhid.c | 2 +- drivers/hwmon/fschmd.c | 2 +- drivers/hwmon/w83793.c | 2 +- drivers/infiniband/core/ucm.c | 2 +- drivers/infiniband/core/ucma.c | 2 +- drivers/infiniband/core/user_mad.c | 2 +- drivers/infiniband/core/uverbs_main.c | 2 +- drivers/input/evdev.c | 2 +- drivers/input/joydev.c | 2 +- drivers/input/misc/uinput.c | 2 +- drivers/isdn/capi/capi.c | 2 +- drivers/leds/uleds.c | 2 +- drivers/media/rc/lirc_dev.c | 2 +- drivers/pci/switch/switchtec.c | 2 +- drivers/platform/chrome/cros_ec_debugfs.c | 2 +- drivers/rtc/rtc-ds1374.c | 2 +- drivers/rtc/rtc-m41t80.c | 2 +- drivers/s390/char/fs3270.c | 2 +- drivers/s390/char/tape_char.c | 2 +- drivers/s390/char/zcore.c | 2 +- drivers/s390/crypto/zcrypt_api.c | 2 +- drivers/spi/spidev.c | 2 +- drivers/staging/pi433/pi433_if.c | 2 +- drivers/usb/misc/ldusb.c | 2 +- drivers/watchdog/acquirewdt.c | 2 +- drivers/watchdog/advantechwdt.c | 2 +- drivers/watchdog/alim1535_wdt.c | 2 +- drivers/watchdog/alim7101_wdt.c | 2 +- drivers/watchdog/ar7_wdt.c | 2 +- drivers/watchdog/at91rm9200_wdt.c | 2 +- drivers/watchdog/ath79_wdt.c | 2 +- drivers/watchdog/bcm63xx_wdt.c | 2 +- drivers/watchdog/cpu5wdt.c | 2 +- drivers/watchdog/cpwd.c | 2 +- drivers/watchdog/eurotechwdt.c | 2 +- drivers/watchdog/f71808e_wdt.c | 2 +- drivers/watchdog/gef_wdt.c | 2 +- drivers/watchdog/geodewdt.c | 2 +- drivers/watchdog/ib700wdt.c | 2 +- drivers/watchdog/ibmasr.c | 2 +- drivers/watchdog/indydog.c | 2 +- drivers/watchdog/intel_scu_watchdog.c | 2 +- drivers/watchdog/iop_wdt.c | 2 +- drivers/watchdog/it8712f_wdt.c | 2 +- drivers/watchdog/ixp4xx_wdt.c | 2 +- drivers/watchdog/ks8695_wdt.c | 2 +- drivers/watchdog/m54xx_wdt.c | 2 +- drivers/watchdog/machzwd.c | 2 +- drivers/watchdog/mixcomwd.c | 2 +- drivers/watchdog/mtx-1_wdt.c | 2 +- drivers/watchdog/mv64x60_wdt.c | 2 +- drivers/watchdog/nuc900_wdt.c | 2 +- drivers/watchdog/nv_tco.c | 2 +- drivers/watchdog/pc87413_wdt.c | 2 +- drivers/watchdog/pcwd.c | 4 ++-- drivers/watchdog/pcwd_pci.c | 4 ++-- drivers/watchdog/pcwd_usb.c | 4 ++-- drivers/watchdog/pika_wdt.c | 2 +- drivers/watchdog/pnx833x_wdt.c | 2 +- drivers/watchdog/rc32434_wdt.c | 2 +- drivers/watchdog/rdc321x_wdt.c | 2 +- drivers/watchdog/riowd.c | 2 +- drivers/watchdog/sa1100_wdt.c | 2 +- drivers/watchdog/sb_wdog.c | 2 +- drivers/watchdog/sbc60xxwdt.c | 2 +- drivers/watchdog/sbc7240_wdt.c | 2 +- drivers/watchdog/sbc8360.c | 2 +- drivers/watchdog/sbc_epx_c3.c | 2 +- drivers/watchdog/sbc_fitpc2_wdt.c | 2 +- drivers/watchdog/sc1200wdt.c | 2 +- drivers/watchdog/sc520_wdt.c | 2 +- drivers/watchdog/sch311x_wdt.c | 2 +- drivers/watchdog/scx200_wdt.c | 2 +- drivers/watchdog/smsc37b787_wdt.c | 2 +- drivers/watchdog/w83877f_wdt.c | 2 +- drivers/watchdog/w83977f_wdt.c | 2 +- drivers/watchdog/wafer5823wdt.c | 2 +- drivers/watchdog/watchdog_dev.c | 2 +- drivers/watchdog/wdrtas.c | 4 ++-- drivers/watchdog/wdt.c | 4 ++-- drivers/watchdog/wdt285.c | 2 +- drivers/watchdog/wdt977.c | 2 +- drivers/watchdog/wdt_pci.c | 4 ++-- drivers/xen/evtchn.c | 2 +- net/batman-adv/icmp_socket.c | 2 +- net/batman-adv/log.c | 2 +- net/rfkill/core.c | 2 +- sound/core/control.c | 2 +- sound/core/rawmidi.c | 2 +- sound/core/seq/seq_clientmgr.c | 2 +- sound/core/timer.c | 2 +- 103 files changed, 109 insertions(+), 109 deletions(-) diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index 17cf249b18ee..3cb2f07ce8eb 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -628,7 +628,7 @@ static int mpc52xx_wdt_open(struct inode *inode, struct file *file) } file->private_data = mpc52xx_gpt_wdt; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int mpc52xx_wdt_release(struct inode *inode, struct file *file) diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 48c2477e7e2a..bfb9ca99ac05 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -588,7 +588,7 @@ static int spufs_pipe_open(struct inode *inode, struct file *file) struct spufs_inode_info *i = SPUFS_I(inode); file->private_data = i->i_ctx; - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c index 6d381279b362..000cb69ba0bc 100644 --- a/arch/um/drivers/harddog_kern.c +++ b/arch/um/drivers/harddog_kern.c @@ -85,7 +85,7 @@ static int harddog_open(struct inode *inode, struct file *file) timer_alive = 1; spin_unlock(&lock); mutex_unlock(&harddog_mutex); - return nonseekable_open(inode, file); + return stream_open(inode, file); err: spin_unlock(&lock); mutex_unlock(&harddog_mutex); diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 5260185cbf7b..639817729ed4 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -427,7 +427,7 @@ static int do_microcode_update(const void __user *buf, size_t size) static int microcode_open(struct inode *inode, struct file *file) { - return capable(CAP_SYS_RAWIO) ? nonseekable_open(inode, file) : -EPERM; + return capable(CAP_SYS_RAWIO) ? stream_open(inode, file) : -EPERM; } static ssize_t microcode_write(struct file *file, const char __user *buf, diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index a5ecf6dae02e..373f549525fe 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c @@ -212,7 +212,7 @@ static void ds1620_read_state(struct therm *therm) static int ds1620_open(struct inode *inode, struct file *file) { - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 669c3311adc4..4fed8fafa0f0 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -302,7 +302,7 @@ static int dtlk_open(struct inode *inode, struct file *file) case DTLK_MINOR: if (dtlk_busy) return -EBUSY; - return nonseekable_open(inode, file); + return stream_open(inode, file); default: return -ENXIO; diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 2924a4bc4a32..74c6d1f34132 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -837,7 +837,7 @@ static int ipmi_open(struct inode *ino, struct file *filep) * first heartbeat. */ ipmi_start_timer_on_heartbeat = 1; - return nonseekable_open(ino, filep); + return stream_open(ino, filep); default: return (-ENODEV); diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 7a4eb86aedac..15bf585af5d3 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1682,7 +1682,7 @@ static int cmm_open(struct inode *inode, struct file *filp) link->open = 1; /* only one open per device */ DEBUGP(2, dev, "<- cmm_open\n"); - ret = nonseekable_open(inode, filp); + ret = stream_open(inode, filp); out: mutex_unlock(&cmm_mutex); return ret; diff --git a/drivers/char/pcmcia/scr24x_cs.c b/drivers/char/pcmcia/scr24x_cs.c index f6b43d9350f0..04b39c3596cc 100644 --- a/drivers/char/pcmcia/scr24x_cs.c +++ b/drivers/char/pcmcia/scr24x_cs.c @@ -92,7 +92,7 @@ static int scr24x_open(struct inode *inode, struct file *filp) kref_get(&dev->refcnt); filp->private_data = dev; - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int scr24x_release(struct inode *inode, struct file *filp) diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 7c19d9b22785..e8614ea843e2 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c @@ -243,7 +243,7 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file) case 16 ... 23: case 32 ... 39: case 48 ... 55: - return nonseekable_open(inode, file); + return stream_open(inode, file); default: break; } diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c index a128dd1126ae..515e96db4391 100644 --- a/drivers/firewire/nosy.c +++ b/drivers/firewire/nosy.c @@ -303,7 +303,7 @@ nosy_open(struct inode *inode, struct file *file) file->private_data = client; - return nonseekable_open(inode, file); + return stream_open(inode, file); fail: kfree(client); lynx_put(lynx); diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c index 320cfca80d5f..e6f94501cb28 100644 --- a/drivers/gnss/core.c +++ b/drivers/gnss/core.c @@ -42,7 +42,7 @@ static int gnss_open(struct inode *inode, struct file *file) get_device(&gdev->dev); - nonseekable_open(inode, file); + stream_open(inode, file); file->private_data = gdev; down_write(&gdev->rwsem); diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 840634e0f1e3..dbaead0a5371 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -632,7 +632,7 @@ static int uhid_char_open(struct inode *inode, struct file *file) INIT_WORK(&uhid->worker, uhid_device_add_worker); file->private_data = uhid; - nonseekable_open(inode, file); + stream_open(inode, file); return 0; } diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index 042a166e1858..8fb54079fac8 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c @@ -837,7 +837,7 @@ static int watchdog_open(struct inode *inode, struct file *filp) watchdog_trigger(data); filp->private_data = data; - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int watchdog_release(struct inode *inode, struct file *filp) diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 0af0f6283b35..e94ae1bb3cf0 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -1341,7 +1341,7 @@ static int watchdog_open(struct inode *inode, struct file *filp) /* Store pointer to data into filp's private data */ filp->private_data = data; - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int watchdog_close(struct inode *inode, struct file *filp) diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index 7541fbaf58a3..65c3230f5663 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c @@ -1175,7 +1175,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp) file->filp = filp; file->device = container_of(inode->i_cdev, struct ib_ucm_device, cdev); - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int ib_ucm_close(struct inode *inode, struct file *filp) diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 7468b26b8a01..140a338a135f 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1744,7 +1744,7 @@ static int ucma_open(struct inode *inode, struct file *filp) filp->private_data = file; file->filp = filp; - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int ucma_close(struct inode *inode, struct file *filp) diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 02b7947ab215..b58b07c03cfb 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -985,7 +985,7 @@ static int ib_umad_open(struct inode *inode, struct file *filp) list_add_tail(&file->port_list, &port->file_list); - nonseekable_open(inode, filp); + stream_open(inode, filp); out: mutex_unlock(&port->file_mutex); return ret; diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index c489f545baae..8b43dd96d3b2 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -1132,7 +1132,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) setup_ufile_idr_uobject(file); - return nonseekable_open(inode, filp); + return stream_open(inode, filp); err_module: module_put(ib_dev->owner); diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index f48369d6f3a0..f040d8881ff2 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -524,7 +524,7 @@ static int evdev_open(struct inode *inode, struct file *file) goto err_free_client; file->private_data = client; - nonseekable_open(inode, file); + stream_open(inode, file); return 0; diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 4c1e427dfabb..d806f6be4788 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -279,7 +279,7 @@ static int joydev_open(struct inode *inode, struct file *file) goto err_free_client; file->private_data = client; - nonseekable_open(inode, file); + stream_open(inode, file); return 0; diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 26ec603fe220..1a6762fc38f9 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -398,7 +398,7 @@ static int uinput_open(struct inode *inode, struct file *file) newdev->state = UIST_NEW_DEVICE; file->private_data = newdev; - nonseekable_open(inode, file); + stream_open(inode, file); return 0; } diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index e1da70a9530c..3c3ad42f22bf 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -960,7 +960,7 @@ static int capi_open(struct inode *inode, struct file *file) list_add_tail(&cdev->list, &capidev_list); mutex_unlock(&capidev_list_lock); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int capi_release(struct inode *inode, struct file *file) diff --git a/drivers/leds/uleds.c b/drivers/leds/uleds.c index 0c43bfac9598..08b6a769ff8f 100644 --- a/drivers/leds/uleds.c +++ b/drivers/leds/uleds.c @@ -74,7 +74,7 @@ static int uleds_open(struct inode *inode, struct file *file) udev->state = ULEDS_STATE_UNKNOWN; file->private_data = udev; - nonseekable_open(inode, file); + stream_open(inode, file); return 0; } diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index f862f1b7f996..92db1e83c192 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -195,7 +195,7 @@ static int ir_lirc_open(struct inode *inode, struct file *file) list_add(&fh->list, &dev->lirc_fh); spin_unlock_irqrestore(&dev->lirc_fh_lock, flags); - nonseekable_open(inode, file); + stream_open(inode, file); return 0; out_kfifo: diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index e22766c79fe9..0f7b80144863 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c @@ -390,7 +390,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp) return PTR_ERR(stuser); filp->private_data = stuser; - nonseekable_open(inode, filp); + stream_open(inode, filp); dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 71308766e891..2b8e8a01a739 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -132,7 +132,7 @@ static int cros_ec_console_log_open(struct inode *inode, struct file *file) { file->private_data = inode->i_private; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t cros_ec_console_log_read(struct file *file, char __user *buf, diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 38a2e9e684df..225a8df1d4e9 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c @@ -467,7 +467,7 @@ static int ds1374_wdt_open(struct inode *inode, struct file *file) */ wdt_is_open = 1; mutex_unlock(&ds1374->mutex); - return nonseekable_open(inode, file); + return stream_open(inode, file); } return -ENODEV; } diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index ebf50b1540f2..dd5a8991f75b 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c @@ -802,7 +802,7 @@ static int wdt_open(struct inode *inode, struct file *file) */ wdt_is_open = 1; mutex_unlock(&m41t80_rtc_mutex); - return nonseekable_open(inode, file); + return stream_open(inode, file); } return -ENODEV; } diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 8b48ba9c598e..4c4683d8784a 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c @@ -486,7 +486,7 @@ fs3270_open(struct inode *inode, struct file *filp) raw3270_del_view(&fp->view); goto out; } - nonseekable_open(inode, filp); + stream_open(inode, filp); filp->private_data = fp; out: mutex_unlock(&fs3270_mutex); diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index fc206c9d1c56..ea4253939555 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -290,7 +290,7 @@ tapechar_open (struct inode *inode, struct file *filp) rc = tape_open(device); if (rc == 0) { filp->private_data = device; - nonseekable_open(inode, filp); + stream_open(inode, filp); } else tape_put_device(device); diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 76d3c50bf078..a57e1c55094f 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -191,7 +191,7 @@ static ssize_t zcore_reipl_write(struct file *filp, const char __user *buf, static int zcore_reipl_open(struct inode *inode, struct file *filp) { - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int zcore_reipl_release(struct inode *inode, struct file *filp) diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 689c2af7026a..6bfdc69a13e7 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -525,7 +525,7 @@ static int zcrypt_open(struct inode *inode, struct file *filp) filp->private_data = (void *) perms; atomic_inc(&zcrypt_open_count); - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } /** diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index b0c76e2626ce..7fd0d9943160 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -591,7 +591,7 @@ static int spidev_open(struct inode *inode, struct file *filp) spidev->users++; filp->private_data = spidev; - nonseekable_open(inode, filp); + stream_open(inode, filp); mutex_unlock(&device_list_lock); return 0; diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index b2314636dc89..2299a11b1878 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -971,7 +971,7 @@ static int pi433_open(struct inode *inode, struct file *filp) /* instance data as context */ filp->private_data = instance; - nonseekable_open(inode, filp); + stream_open(inode, filp); return 0; } diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 006762b72ff5..6581774bdfa4 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -307,7 +307,7 @@ static int ld_usb_open(struct inode *inode, struct file *file) int retval; struct usb_interface *interface; - nonseekable_open(inode, file); + stream_open(inode, file); subminor = iminor(inode); interface = usb_find_interface(&ld_usb_driver, subminor); diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index d6210d946082..957d1255d4ca 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c @@ -200,7 +200,7 @@ static int acq_open(struct inode *inode, struct file *file) /* Activate */ acq_keepalive(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int acq_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index f61944369c1a..2766af292a71 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c @@ -199,7 +199,7 @@ static int advwdt_open(struct inode *inode, struct file *file) */ advwdt_ping(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int advwdt_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index 60f0c2eb8531..39a07bb5f6d5 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c @@ -249,7 +249,7 @@ static int ali_open(struct inode *inode, struct file *file) /* Activate */ ali_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index 12f7ea62dddd..7e9884960eb9 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c @@ -214,7 +214,7 @@ static int fop_open(struct inode *inode, struct file *file) return -EBUSY; /* Good, fire up the show */ wdt_startup(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int fop_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index ee1ab12ab04f..b9b2d06b3879 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c @@ -163,7 +163,7 @@ static int ar7_wdt_open(struct inode *inode, struct file *file) ar7_wdt_enable_wdt(); expect_close = 0; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int ar7_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index b45fc0aee667..907a4545dee6 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c @@ -110,7 +110,7 @@ static int at91_wdt_open(struct inode *inode, struct file *file) return -EBUSY; at91_wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c index e2209bf5fa8a..4f56b63f9691 100644 --- a/drivers/watchdog/ath79_wdt.c +++ b/drivers/watchdog/ath79_wdt.c @@ -132,7 +132,7 @@ static int ath79_wdt_open(struct inode *inode, struct file *file) clear_bit(WDT_FLAGS_EXPECT_CLOSE, &wdt_flags); ath79_wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int ath79_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c index d3c1113e774c..e2af37c9a266 100644 --- a/drivers/watchdog/bcm63xx_wdt.c +++ b/drivers/watchdog/bcm63xx_wdt.c @@ -116,7 +116,7 @@ static int bcm63xx_wdt_open(struct inode *inode, struct file *file) return -EBUSY; bcm63xx_wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int bcm63xx_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index 6cfb102c397c..475360de6e9e 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c @@ -140,7 +140,7 @@ static int cpu5wdt_open(struct inode *inode, struct file *file) { if (test_and_set_bit(0, &cpu5wdt_device.inuse)) return -EBUSY; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int cpu5wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 32156e199c51..b5b078bdebe6 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c @@ -394,7 +394,7 @@ static int cpwd_open(struct inode *inode, struct file *f) mutex_unlock(&cpwd_mutex); - return nonseekable_open(inode, f); + return stream_open(inode, f); } static int cpwd_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 47f77a6fdfd6..89129e6fa9b6 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c @@ -316,7 +316,7 @@ static int eurwdt_open(struct inode *inode, struct file *file) eurwdt_timeout = WDT_TIMEOUT; /* initial timeout */ /* Activate the WDT */ eurwdt_activate_timer(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index 9a1c761258ce..021c6ace9462 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -525,7 +525,7 @@ static int watchdog_open(struct inode *inode, struct file *file) __module_get(THIS_MODULE); watchdog.expect_close = 0; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int watchdog_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 006e2348022c..26350b319505 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c @@ -229,7 +229,7 @@ static int gef_wdt_open(struct inode *inode, struct file *file) gef_wdt_handler_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int gef_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 88e01238f01b..c5a727da6657 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c @@ -92,7 +92,7 @@ static int geodewdt_open(struct inode *inode, struct file *file) __module_get(THIS_MODULE); geodewdt_ping(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int geodewdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index cc262284a6aa..30d6cec582af 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c @@ -238,7 +238,7 @@ static int ibwdt_open(struct inode *inode, struct file *file) /* Activate */ ibwdt_ping(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int ibwdt_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c index 366b0474f278..897f7eda9e6a 100644 --- a/drivers/watchdog/ibmasr.c +++ b/drivers/watchdog/ibmasr.c @@ -323,7 +323,7 @@ static int asr_open(struct inode *inode, struct file *file) asr_toggle(); asr_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int asr_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index 5d20cdd30efe..5592b975fe3a 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c @@ -77,7 +77,7 @@ static int indydog_open(struct inode *inode, struct file *file) pr_info("Started watchdog timer\n"); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int indydog_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/intel_scu_watchdog.c b/drivers/watchdog/intel_scu_watchdog.c index 0caab6241eb7..3181a72c7ddf 100644 --- a/drivers/watchdog/intel_scu_watchdog.c +++ b/drivers/watchdog/intel_scu_watchdog.c @@ -304,7 +304,7 @@ static int intel_scu_open(struct inode *inode, struct file *file) if (watchdog_device.driver_closed) return -EPERM; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int intel_scu_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c index b16013ffacc2..d910a7dec21b 100644 --- a/drivers/watchdog/iop_wdt.c +++ b/drivers/watchdog/iop_wdt.c @@ -101,7 +101,7 @@ static int iop_wdt_open(struct inode *inode, struct file *file) clear_bit(WDT_OK_TO_CLOSE, &wdt_status); wdt_enable(); set_bit(WDT_ENABLED, &wdt_status); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len, diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index 41b3979a9d87..b1567240a0e6 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c @@ -327,7 +327,7 @@ static int it8712f_wdt_open(struct inode *inode, struct file *file) ret = it8712f_wdt_enable(); if (ret) return ret; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int it8712f_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index f20cc53ff719..dd139cda936c 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -65,7 +65,7 @@ static int ixp4xx_wdt_open(struct inode *inode, struct file *file) clear_bit(WDT_OK_TO_CLOSE, &wdt_status); wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index 1e41818a44bc..0565cf30017b 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c @@ -142,7 +142,7 @@ static int ks8695_wdt_open(struct inode *inode, struct file *file) return -EBUSY; ks8695_wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/drivers/watchdog/m54xx_wdt.c b/drivers/watchdog/m54xx_wdt.c index da6fa2b68074..752d03620f0a 100644 --- a/drivers/watchdog/m54xx_wdt.c +++ b/drivers/watchdog/m54xx_wdt.c @@ -85,7 +85,7 @@ static int m54xx_wdt_open(struct inode *inode, struct file *file) clear_bit(WDT_OK_TO_CLOSE, &wdt_status); wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t m54xx_wdt_write(struct file *file, const char *data, diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 88d823d87a4b..53759415cf06 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c @@ -333,7 +333,7 @@ static int zf_open(struct inode *inode, struct file *file) if (nowayout) __module_get(THIS_MODULE); zf_timer_on(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int zf_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c index 3cc07447c655..ece56db0a379 100644 --- a/drivers/watchdog/mixcomwd.c +++ b/drivers/watchdog/mixcomwd.c @@ -150,7 +150,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file) mixcomwd_timer_alive = 0; } } - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int mixcomwd_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c index e028e0a2eca0..25a92857b217 100644 --- a/drivers/watchdog/mtx-1_wdt.c +++ b/drivers/watchdog/mtx-1_wdt.c @@ -118,7 +118,7 @@ static int mtx1_wdt_open(struct inode *inode, struct file *file) { if (test_and_set_bit(0, &mtx1_wdt_device.inuse)) return -EBUSY; - return nonseekable_open(inode, file); + return stream_open(inode, file); } diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c index 315275d7bab6..c785f4f0a196 100644 --- a/drivers/watchdog/mv64x60_wdt.c +++ b/drivers/watchdog/mv64x60_wdt.c @@ -133,7 +133,7 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file) mv64x60_wdt_handler_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int mv64x60_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/nuc900_wdt.c b/drivers/watchdog/nuc900_wdt.c index 830bd04ff911..8a36350bab7b 100644 --- a/drivers/watchdog/nuc900_wdt.c +++ b/drivers/watchdog/nuc900_wdt.c @@ -131,7 +131,7 @@ static int nuc900_wdt_open(struct inode *inode, struct file *file) nuc900_wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int nuc900_wdt_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c index a0fabf6f92b0..98d4f5371cf4 100644 --- a/drivers/watchdog/nv_tco.c +++ b/drivers/watchdog/nv_tco.c @@ -161,7 +161,7 @@ static int nv_tco_open(struct inode *inode, struct file *file) /* Reload and activate timer */ tco_timer_keepalive(); tco_timer_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int nv_tco_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 2ffa39b46970..ca21d6c240a3 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c @@ -286,7 +286,7 @@ static int pc87413_open(struct inode *inode, struct file *file) pr_info("Watchdog enabled. Timeout set to %d minute(s).\n", timeout); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index b72ce68eacd3..a3415cf07c98 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c @@ -695,7 +695,7 @@ static int pcwd_open(struct inode *inode, struct file *file) /* Activate */ pcwd_start(); pcwd_keepalive(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int pcwd_close(struct inode *inode, struct file *file) @@ -734,7 +734,7 @@ static int pcwd_temp_open(struct inode *inode, struct file *file) if (!pcwd_private.supports_temp) return -ENODEV; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int pcwd_temp_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index 1f78f0908621..5773d2591d3f 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c @@ -578,7 +578,7 @@ static int pcipcwd_open(struct inode *inode, struct file *file) /* Activate */ pcipcwd_start(); pcipcwd_keepalive(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int pcipcwd_release(struct inode *inode, struct file *file) @@ -620,7 +620,7 @@ static int pcipcwd_temp_open(struct inode *inode, struct file *file) if (!pcipcwd_private.supports_temp) return -ENODEV; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int pcipcwd_temp_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 4d02f26156f9..5de6182dae33 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -485,7 +485,7 @@ static int usb_pcwd_open(struct inode *inode, struct file *file) /* Activate */ usb_pcwd_start(usb_pcwd_device); usb_pcwd_keepalive(usb_pcwd_device); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int usb_pcwd_release(struct inode *inode, struct file *file) @@ -524,7 +524,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data, static int usb_pcwd_temperature_open(struct inode *inode, struct file *file) { - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int usb_pcwd_temperature_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c index bb97f5b2f7eb..8938b3fb2b2d 100644 --- a/drivers/watchdog/pika_wdt.c +++ b/drivers/watchdog/pika_wdt.c @@ -118,7 +118,7 @@ static int pikawdt_open(struct inode *inode, struct file *file) pikawdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index 882fdcb46ad1..312899f39fd2 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c @@ -116,7 +116,7 @@ static int pnx833x_wdt_open(struct inode *inode, struct file *file) pr_info("Started watchdog timer\n"); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int pnx833x_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index 3a75f3b53452..e74d5cf272ab 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c @@ -150,7 +150,7 @@ static int rc32434_wdt_open(struct inode *inode, struct file *file) rc32434_wdt_start(); rc32434_wdt_ping(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int rc32434_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index a281aa84bfb1..4382e9556860 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c @@ -142,7 +142,7 @@ static int rdc321x_wdt_open(struct inode *inode, struct file *file) if (test_and_set_bit(0, &rdc321x_wdt_device.inuse)) return -EBUSY; - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int rdc321x_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index aba53424605e..f7f7a7a62022 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c @@ -76,7 +76,7 @@ static void riowd_writereg(struct riowd *p, u8 val, int index) static int riowd_open(struct inode *inode, struct file *filp) { - nonseekable_open(inode, filp); + stream_open(inode, filp); return 0; } diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index d3be4f831db5..bfa035e1a75e 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c @@ -59,7 +59,7 @@ static int sa1100dog_open(struct inode *inode, struct file *file) writel_relaxed(OSSR_M3, OSSR); writel_relaxed(OWER_WME, OWER); writel_relaxed(readl_relaxed(OIER) | OIER_E3, OIER); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index 3abae50773b8..0692d42e5c67 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c @@ -105,7 +105,7 @@ static const struct watchdog_info ident = { */ static int sbwdog_open(struct inode *inode, struct file *file) { - nonseekable_open(inode, file); + stream_open(inode, file); if (test_and_set_bit(0, &sbwdog_gate)) return -EBUSY; __module_get(THIS_MODULE); diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c index 72d15fd1f183..4d127a91cbdc 100644 --- a/drivers/watchdog/sbc60xxwdt.c +++ b/drivers/watchdog/sbc60xxwdt.c @@ -208,7 +208,7 @@ static int fop_open(struct inode *inode, struct file *file) /* Good, fire up the show */ wdt_startup(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int fop_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/sbc7240_wdt.c b/drivers/watchdog/sbc7240_wdt.c index 5f268add17ce..efc81b318939 100644 --- a/drivers/watchdog/sbc7240_wdt.c +++ b/drivers/watchdog/sbc7240_wdt.c @@ -136,7 +136,7 @@ static int fop_open(struct inode *inode, struct file *file) wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int fop_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c index da60560ca446..3396024e7b76 100644 --- a/drivers/watchdog/sbc8360.c +++ b/drivers/watchdog/sbc8360.c @@ -271,7 +271,7 @@ static int sbc8360_open(struct inode *inode, struct file *file) /* Activate and ping once to start the countdown */ sbc8360_activate(); sbc8360_ping(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int sbc8360_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c index a1c502e0d8ec..783037ffd7d8 100644 --- a/drivers/watchdog/sbc_epx_c3.c +++ b/drivers/watchdog/sbc_epx_c3.c @@ -78,7 +78,7 @@ static int epx_c3_open(struct inode *inode, struct file *file) epx_c3_alive = 1; pr_info("Started watchdog timer\n"); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int epx_c3_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index a517d8bae757..3822a60a8d2b 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c @@ -75,7 +75,7 @@ static int fitpc2_wdt_open(struct inode *inode, struct file *file) wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static ssize_t fitpc2_wdt_write(struct file *file, const char *data, diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c index e035a4d4b299..3c2e9355410a 100644 --- a/drivers/watchdog/sc1200wdt.c +++ b/drivers/watchdog/sc1200wdt.c @@ -178,7 +178,7 @@ static int sc1200wdt_open(struct inode *inode, struct file *file) sc1200wdt_start(); pr_info("Watchdog enabled, timeout = %d min(s)", timeout); - return nonseekable_open(inode, file); + return stream_open(inode, file); } diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c index 403542f9ed8d..44797414c886 100644 --- a/drivers/watchdog/sc520_wdt.c +++ b/drivers/watchdog/sc520_wdt.c @@ -258,7 +258,7 @@ static int fop_open(struct inode *inode, struct file *file) /* Good, fire up the show */ wdt_startup(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int fop_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 814cdf539b0f..ed6e9fac5d74 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c @@ -316,7 +316,7 @@ static int sch311x_wdt_open(struct inode *inode, struct file *file) * Activate */ sch311x_wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int sch311x_wdt_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c index ec4063ebb41a..85f2d8e06cd0 100644 --- a/drivers/watchdog/scx200_wdt.c +++ b/drivers/watchdog/scx200_wdt.c @@ -102,7 +102,7 @@ static int scx200_wdt_open(struct inode *inode, struct file *file) return -EBUSY; scx200_wdt_enable(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int scx200_wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c index c768dcd53034..a22170775273 100644 --- a/drivers/watchdog/smsc37b787_wdt.c +++ b/drivers/watchdog/smsc37b787_wdt.c @@ -366,7 +366,7 @@ static int wb_smsc_wdt_open(struct inode *inode, struct file *file) pr_info("Watchdog enabled. Timeout set to %d %s\n", timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /* close => shut off the timer */ diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c index db9b6488e388..8dd953f90680 100644 --- a/drivers/watchdog/w83877f_wdt.c +++ b/drivers/watchdog/w83877f_wdt.c @@ -224,7 +224,7 @@ static int fop_open(struct inode *inode, struct file *file) /* Good, fire up the show */ wdt_startup(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int fop_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 672b61a7f9a3..184324c1edae 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c @@ -298,7 +298,7 @@ static int wdt_open(struct inode *inode, struct file *file) __module_get(THIS_MODULE); wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int wdt_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c index 93c5b610e264..0a8073b419f8 100644 --- a/drivers/watchdog/wafer5823wdt.c +++ b/drivers/watchdog/wafer5823wdt.c @@ -197,7 +197,7 @@ static int wafwdt_open(struct inode *inode, struct file *file) * Activate */ wafwdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int wafwdt_close(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index f6c24b22b37c..252a7c7b6592 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -825,7 +825,7 @@ static int watchdog_open(struct inode *inode, struct file *file) kref_get(&wd_data->kref); /* dev/watchdog is a virtual (and thus non-seekable) filesystem */ - return nonseekable_open(inode, file); + return stream_open(inode, file); out_mod: module_put(wd_data->wdd->ops->owner); diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 0240c60d14e3..3c3ed512ce1e 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c @@ -376,7 +376,7 @@ static int wdrtas_open(struct inode *inode, struct file *file) wdrtas_timer_start(); wdrtas_timer_keepalive(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** @@ -442,7 +442,7 @@ static ssize_t wdrtas_temp_read(struct file *file, char __user *buf, */ static int wdrtas_temp_open(struct inode *inode, struct file *file) { - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index e481fbbc4ae7..3d2f5ed60e88 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c @@ -421,7 +421,7 @@ static int wdt_open(struct inode *inode, struct file *file) * Activate */ wdt_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** @@ -481,7 +481,7 @@ static ssize_t wdt_temp_read(struct file *file, char __user *buf, static int wdt_temp_open(struct inode *inode, struct file *file) { - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c index ebbb183be618..68843e7f224d 100644 --- a/drivers/watchdog/wdt285.c +++ b/drivers/watchdog/wdt285.c @@ -101,7 +101,7 @@ static int watchdog_open(struct inode *inode, struct file *file) ret = 0; #endif - nonseekable_open(inode, file); + stream_open(inode, file); return ret; } diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c index a8e6f87f60c9..59ed644dd4a9 100644 --- a/drivers/watchdog/wdt977.c +++ b/drivers/watchdog/wdt977.c @@ -273,7 +273,7 @@ static int wdt977_open(struct inode *inode, struct file *file) __module_get(THIS_MODULE); wdt977_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } static int wdt977_release(struct inode *inode, struct file *file) diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index 10e2cda0ee5a..ff3a41f47127 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c @@ -461,7 +461,7 @@ static int wdtpci_open(struct inode *inode, struct file *file) * Activate */ wdtpci_start(); - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** @@ -524,7 +524,7 @@ static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, static int wdtpci_temp_open(struct inode *inode, struct file *file) { - return nonseekable_open(inode, file); + return stream_open(inode, file); } /** diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 6d1a5e58968f..f341b016672f 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c @@ -664,7 +664,7 @@ static int evtchn_open(struct inode *inode, struct file *filp) filp->private_data = u; - return nonseekable_open(inode, filp); + return stream_open(inode, filp); } static int evtchn_release(struct inode *inode, struct file *filp) diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 9859ababb82e..3ff32125f4b5 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -77,7 +77,7 @@ static int batadv_socket_open(struct inode *inode, struct file *file) batadv_debugfs_deprecated(file, ""); - nonseekable_open(inode, file); + stream_open(inode, file); socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); if (!socket_client) { diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c index 3e610df8debf..e8ff13598c08 100644 --- a/net/batman-adv/log.c +++ b/net/batman-adv/log.c @@ -102,7 +102,7 @@ static int batadv_log_open(struct inode *inode, struct file *file) batadv_debugfs_deprecated(file, "Use tracepoint batadv:batadv_dbg instead\n"); - nonseekable_open(inode, file); + stream_open(inode, file); file->private_data = inode->i_private; return 0; } diff --git a/net/rfkill/core.c b/net/rfkill/core.c index abca57040f37..742e186bfadb 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -1143,7 +1143,7 @@ static int rfkill_fop_open(struct inode *inode, struct file *file) file->private_data = data; - return nonseekable_open(inode, file); + return stream_open(inode, file); free: mutex_unlock(&data->mtx); diff --git a/sound/core/control.c b/sound/core/control.c index fad7db402443..a5cc9a874062 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -54,7 +54,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) struct snd_ctl_file *ctl; int i, err; - err = nonseekable_open(inode, file); + err = stream_open(inode, file); if (err < 0) return err; diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index c0690d1ecd55..4666bb366c0c 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -382,7 +382,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) if ((file->f_flags & O_APPEND) && !(file->f_flags & O_NONBLOCK)) return -EINVAL; /* invalid combination */ - err = nonseekable_open(inode, file); + err = stream_open(inode, file); if (err < 0) return err; diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 38e7deab6384..a11bdc0350fc 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -307,7 +307,7 @@ static int snd_seq_open(struct inode *inode, struct file *file) struct snd_seq_user_client *user; int err; - err = nonseekable_open(inode, file); + err = stream_open(inode, file); if (err < 0) return err; diff --git a/sound/core/timer.c b/sound/core/timer.c index 61a0cec6e1f6..b842b61f66c2 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -1425,7 +1425,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) struct snd_timer_user *tu; int err; - err = nonseekable_open(inode, file); + err = stream_open(inode, file); if (err < 0) return err; From 438ab720c675a16d53bb18f76a94d25bbe420c45 Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Fri, 12 Apr 2019 12:31:57 +0300 Subject: [PATCH 3/3] vfs: pass ppos=NULL to .read()/.write() of FMODE_STREAM files This amends commit 10dce8af3422 ("fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock") in how position is passed into .read()/.write() handler for stream-like files: Rasmus noticed that we currently pass 0 as position and ignore any position change if that is done by a file implementation. This papers over bugs if ppos is used in files that declare themselves as being stream-like as such bugs will go unnoticed. Even if a file implementation is correctly converted into using stream_open, its read/write later could be changed to use ppos and even though that won't be working correctly, that bug might go unnoticed without someone doing wrong behaviour analysis. It is thus better to pass ppos=NULL into read/write for stream-like files as that don't give any chance for ppos usage bugs because it will oops if ppos is ever used inside .read() or .write(). Note 1: rw_verify_area, new_sync_{read,write} needs to be updated because they are called by vfs_read/vfs_write & friends before file_operations .read/.write . Note 2: if file backend uses new-style .read_iter/.write_iter, position is still passed into there as non-pointer kiocb.ki_pos . Currently stream_open.cocci (semantic patch added by 10dce8af3422) ignores files whose file_operations has *_iter methods. Suggested-by: Rasmus Villemoes Signed-off-by: Kirill Smelkov --- fs/open.c | 5 ++- fs/read_write.c | 113 ++++++++++++++++++++++++++++-------------------- 2 files changed, 70 insertions(+), 48 deletions(-) diff --git a/fs/open.c b/fs/open.c index a00350018a47..9c7d724a6f67 100644 --- a/fs/open.c +++ b/fs/open.c @@ -1219,8 +1219,9 @@ EXPORT_SYMBOL(nonseekable_open); /* * stream_open is used by subsystems that want stream-like file descriptors. * Such file descriptors are not seekable and don't have notion of position - * (file.f_pos is always 0). Contrary to file descriptors of other regular - * files, .read() and .write() can run simultaneously. + * (file.f_pos is always 0 and ppos passed to .read()/.write() is always NULL). + * Contrary to file descriptors of other regular files, .read() and .write() + * can run simultaneously. * * stream_open never fails and is marked to return int so that it could be * directly used as file_operations.open . diff --git a/fs/read_write.c b/fs/read_write.c index 61b43ad7608e..c543d965e288 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -365,29 +365,37 @@ out_putf: int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count) { struct inode *inode; - loff_t pos; int retval = -EINVAL; inode = file_inode(file); if (unlikely((ssize_t) count < 0)) return retval; - pos = *ppos; - if (unlikely(pos < 0)) { - if (!unsigned_offsets(file)) - return retval; - if (count >= -pos) /* both values are in 0..LLONG_MAX */ - return -EOVERFLOW; - } else if (unlikely((loff_t) (pos + count) < 0)) { - if (!unsigned_offsets(file)) - return retval; + + /* + * ranged mandatory locking does not apply to streams - it makes sense + * only for files where position has a meaning. + */ + if (ppos) { + loff_t pos = *ppos; + + if (unlikely(pos < 0)) { + if (!unsigned_offsets(file)) + return retval; + if (count >= -pos) /* both values are in 0..LLONG_MAX */ + return -EOVERFLOW; + } else if (unlikely((loff_t) (pos + count) < 0)) { + if (!unsigned_offsets(file)) + return retval; + } + + if (unlikely(inode->i_flctx && mandatory_lock(inode))) { + retval = locks_mandatory_area(inode, file, pos, pos + count - 1, + read_write == READ ? F_RDLCK : F_WRLCK); + if (retval < 0) + return retval; + } } - if (unlikely(inode->i_flctx && mandatory_lock(inode))) { - retval = locks_mandatory_area(inode, file, pos, pos + count - 1, - read_write == READ ? F_RDLCK : F_WRLCK); - if (retval < 0) - return retval; - } return security_file_permission(file, read_write == READ ? MAY_READ : MAY_WRITE); } @@ -400,12 +408,13 @@ static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo ssize_t ret; init_sync_kiocb(&kiocb, filp); - kiocb.ki_pos = *ppos; + kiocb.ki_pos = (ppos ? *ppos : 0); iov_iter_init(&iter, READ, &iov, 1, len); ret = call_read_iter(filp, &kiocb, &iter); BUG_ON(ret == -EIOCBQUEUED); - *ppos = kiocb.ki_pos; + if (ppos) + *ppos = kiocb.ki_pos; return ret; } @@ -468,12 +477,12 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t ssize_t ret; init_sync_kiocb(&kiocb, filp); - kiocb.ki_pos = *ppos; + kiocb.ki_pos = (ppos ? *ppos : 0); iov_iter_init(&iter, WRITE, &iov, 1, len); ret = call_write_iter(filp, &kiocb, &iter); BUG_ON(ret == -EIOCBQUEUED); - if (ret > 0) + if (ret > 0 && ppos) *ppos = kiocb.ki_pos; return ret; } @@ -558,15 +567,10 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ return ret; } -static inline loff_t file_pos_read(struct file *file) +/* file_ppos returns &file->f_pos or NULL if file is stream */ +static inline loff_t *file_ppos(struct file *file) { - return file->f_mode & FMODE_STREAM ? 0 : file->f_pos; -} - -static inline void file_pos_write(struct file *file, loff_t pos) -{ - if ((file->f_mode & FMODE_STREAM) == 0) - file->f_pos = pos; + return file->f_mode & FMODE_STREAM ? NULL : &file->f_pos; } ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count) @@ -575,10 +579,14 @@ ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count) ssize_t ret = -EBADF; if (f.file) { - loff_t pos = file_pos_read(f.file); - ret = vfs_read(f.file, buf, count, &pos); - if (ret >= 0) - file_pos_write(f.file, pos); + loff_t pos, *ppos = file_ppos(f.file); + if (ppos) { + pos = *ppos; + ppos = &pos; + } + ret = vfs_read(f.file, buf, count, ppos); + if (ret >= 0 && ppos) + f.file->f_pos = pos; fdput_pos(f); } return ret; @@ -595,10 +603,14 @@ ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count) ssize_t ret = -EBADF; if (f.file) { - loff_t pos = file_pos_read(f.file); - ret = vfs_write(f.file, buf, count, &pos); - if (ret >= 0) - file_pos_write(f.file, pos); + loff_t pos, *ppos = file_ppos(f.file); + if (ppos) { + pos = *ppos; + ppos = &pos; + } + ret = vfs_write(f.file, buf, count, ppos); + if (ret >= 0 && ppos) + f.file->f_pos = pos; fdput_pos(f); } @@ -673,14 +685,15 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, ret = kiocb_set_rw_flags(&kiocb, flags); if (ret) return ret; - kiocb.ki_pos = *ppos; + kiocb.ki_pos = (ppos ? *ppos : 0); if (type == READ) ret = call_read_iter(filp, &kiocb, iter); else ret = call_write_iter(filp, &kiocb, iter); BUG_ON(ret == -EIOCBQUEUED); - *ppos = kiocb.ki_pos; + if (ppos) + *ppos = kiocb.ki_pos; return ret; } @@ -1013,10 +1026,14 @@ static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec, ssize_t ret = -EBADF; if (f.file) { - loff_t pos = file_pos_read(f.file); - ret = vfs_readv(f.file, vec, vlen, &pos, flags); - if (ret >= 0) - file_pos_write(f.file, pos); + loff_t pos, *ppos = file_ppos(f.file); + if (ppos) { + pos = *ppos; + ppos = &pos; + } + ret = vfs_readv(f.file, vec, vlen, ppos, flags); + if (ret >= 0 && ppos) + f.file->f_pos = pos; fdput_pos(f); } @@ -1033,10 +1050,14 @@ static ssize_t do_writev(unsigned long fd, const struct iovec __user *vec, ssize_t ret = -EBADF; if (f.file) { - loff_t pos = file_pos_read(f.file); - ret = vfs_writev(f.file, vec, vlen, &pos, flags); - if (ret >= 0) - file_pos_write(f.file, pos); + loff_t pos, *ppos = file_ppos(f.file); + if (ppos) { + pos = *ppos; + ppos = &pos; + } + ret = vfs_writev(f.file, vec, vlen, ppos, flags); + if (ret >= 0 && ppos) + f.file->f_pos = pos; fdput_pos(f); }