Brian Norris
715780ae4b
firmware: actually return NULL on failed request_firmware_nowait()
The kerneldoc for request_firmware_nowait() says that it may call the
provided cont() callback with @fw == NULL, if the firmware request
fails. However, this is not the case when called with an empty string
(""). This case is short-circuited by the 'name[0] == '\0'' check
introduced in commit 471b095dfe ("firmware_class: make sure fw requests
contain a name"), so _request_firmware() never gets to set the fw to
NULL.
Noticed while using the new 'trigger_async_request' testing hook:
# printf '\x00' > /sys/devices/virtual/misc/test_firmware/trigger_async_request
[10553.726178] test_firmware: loading ''
[10553.729859] test_firmware: loaded: 995209091
# printf '\x00' > /sys/devices/virtual/misc/test_firmware/trigger_async_request
[10733.676184] test_firmware: loading ''
[10733.679855] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[10733.687951] pgd = ec188000
[10733.690655] [00000004] *pgd=00000000
[10733.694240] Internal error: Oops: 5 [#1] SMP ARM
[10733.698847] Modules linked in: btmrvl_sdio btmrvl bluetooth sbs_battery nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables asix usbnet mwifiex_sdio mwifiex cfg80211 jitterentropy_rng drbg joydev snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async ppp_generic slhc tun
[10733.725670] CPU: 0 PID: 6600 Comm: bash Not tainted 4.4.0-rc4-00351-g63d0877 #178
[10733.733137] Hardware name: Rockchip (Device Tree)
[10733.737831] task: ed24f6c0 ti: ee322000 task.ti: ee322000
[10733.743222] PC is at do_raw_spin_lock+0x18/0x1a0
[10733.747831] LR is at _raw_spin_lock+0x18/0x1c
[10733.752180] pc : [<c00653a0>] lr : [<c054c204>] psr: a00d0013
[10733.752180] sp : ee323df8 ip : ee323e20 fp : ee323e1c
[10733.763634] r10: 00000051 r9 : b6f18000 r8 : ee323f80
[10733.768847] r7 : c089cebc r6 : 00000001 r5 : 00000000 r4 : ec0e6000
[10733.775360] r3 : dead4ead r2 : c06bd140 r1 : eef913b4 r0 : 00000000
[10733.781874] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[10733.788995] Control: 10c5387d Table: 2c18806a DAC: 00000051
[10733.794728] Process bash (pid: 6600, stack limit = 0xee322218)
[10733.800549] Stack: (0xee323df8 to 0xee324000)
[10733.804896] 3de0: ec0e6000 00000000
[10733.813059] 3e00: 00000001 c089cebc ee323f80 b6f18000 ee323e2c ee323e20 c054c204 c0065394
[10733.821221] 3e20: ee323e44 ee323e30 c02fec60 c054c1f8 ec0e7ec0 ec3fcfc0 ee323e5c ee323e48
[10733.829384] 3e40: c02fed08 c02fec48 c07dbf74 eeb05a00 ee323e8c ee323e60 c0253828 c02fecac
[10733.837547] 3e60: 00000001 c0116950 ee323eac ee323e78 00000001 ec3fce00 ed2d9700 ed2d970c
[10733.845710] 3e80: ee323e9c ee323e90 c02e873c c02537d4 ee323eac ee323ea0 c017bd40 c02e8720
[10733.853873] 3ea0: ee323ee4 ee323eb0 c017b250 c017bd00 00000000 00000000 f3e47a54 ec128b00
[10733.862035] 3ec0: c017b10c ee323f80 00000001 c000f504 ee322000 00000000 ee323f4c ee323ee8
[10733.870197] 3ee0: c011b71c c017b118 ee323fb0 c011bc90 becfa8d9 00000001 ec128b00 00000001
[10733.878359] 3f00: b6f18000 ee323f80 ee323f4c ee323f18 c011bc90 c0063950 ee323f3c ee323f28
[10733.886522] 3f20: c0063950 c0549138 00000001 ec128b00 00000001 ec128b00 b6f18000 ee323f80
[10733.894684] 3f40: ee323f7c ee323f50 c011bed8 c011b6ec c0135fb8 c0135f24 ec128b00 ec128b00
[10733.902847] 3f60: 00000001 b6f18000 c000f504 ee322000 ee323fa4 ee323f80 c011c664 c011be24
[10733.911009] 3f80: 00000000 00000000 00000001 b6f18000 b6e79be0 00000004 00000000 ee323fa8
[10733.919172] 3fa0: c000f340 c011c618 00000001 b6f18000 00000001 b6f18000 00000001 00000000
[10733.927334] 3fc0: 00000001 b6f18000 b6e79be0 00000004 00000001 00000001 8068a3f1 b6e79c84
[10733.935496] 3fe0: 00000000 becfa7dc b6de194d b6e20246 400d0030 00000001 7a4536e8 49bda390
[10733.943664] [<c00653a0>] (do_raw_spin_lock) from [<c054c204>] (_raw_spin_lock+0x18/0x1c)
[10733.951743] [<c054c204>] (_raw_spin_lock) from [<c02fec60>] (fw_free_buf+0x24/0x64)
[10733.959388] [<c02fec60>] (fw_free_buf) from [<c02fed08>] (release_firmware+0x68/0x74)
[10733.967207] [<c02fed08>] (release_firmware) from [<c0253828>] (trigger_async_request_store+0x60/0x124)
[10733.976501] [<c0253828>] (trigger_async_request_store) from [<c02e873c>] (dev_attr_store+0x28/0x34)
[10733.985533] [<c02e873c>] (dev_attr_store) from [<c017bd40>] (sysfs_kf_write+0x4c/0x58)
[10733.993437] [<c017bd40>] (sysfs_kf_write) from [<c017b250>] (kernfs_fop_write+0x144/0x1a8)
[10734.001689] [<c017b250>] (kernfs_fop_write) from [<c011b71c>] (__vfs_write+0x3c/0xe4)
After this patch:
# printf '\x00' > /sys/devices/virtual/misc/test_firmware/trigger_async_request
[ 32.126322] test_firmware: loading ''
[ 32.129995] test_firmware: failed to async load firmware
-bash: printf: write error: No such device
Fixes: 471b095dfe ("firmware_class: make sure fw requests contain a name")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Ming Lei <ming.lei@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
|
2016-01-07 13:45:34 -07:00 |
| .. |
|
accessibility
|
|
|
|
acpi
|
More power management and ACPI updates for v4.4-rc1
|
2015-11-12 11:50:33 -08:00 |
|
amba
|
|
|
|
android
|
|
|
|
ata
|
SCSI misc on 20151113
|
2015-11-13 20:35:54 -08:00 |
|
atm
|
|
|
|
auxdisplay
|
|
|
|
base
|
firmware: actually return NULL on failed request_firmware_nowait()
|
2016-01-07 13:45:34 -07:00 |
|
bcma
|
|
|
|
block
|
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
|
2015-11-13 09:24:40 -08:00 |
|
bluetooth
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
|
2015-11-10 18:11:41 -08:00 |
|
bus
|
ARM: SoC driver updates for v4.4
|
2015-11-10 15:00:03 -08:00 |
|
cdrom
|
|
|
|
char
|
Merge tag 'tpmdd-next-20151110' of https://github.com/jsakkine/linux-tpmdd into for-linus
|
2015-11-12 20:38:04 +11:00 |
|
clk
|
h8300 update for v4.4
|
2015-11-12 15:26:39 -08:00 |
|
clocksource
|
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
|
2015-11-15 09:10:53 -08:00 |
|
connector
|
mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
|
2015-11-06 17:50:42 -08:00 |
|
cpufreq
|
More power management and ACPI updates for v4.4-rc1
|
2015-11-12 11:50:33 -08:00 |
|
cpuidle
|
|
|
|
crypto
|
More power management and ACPI updates for v4.4-rc1
|
2015-11-12 11:50:33 -08:00 |
|
dca
|
|
|
|
devfreq
|
|
|
|
dio
|
|
|
|
dma
|
dmaengine updates for 4.4-rc1
|
2015-11-10 10:05:17 -08:00 |
|
dma-buf
|
dma-buf/fence: add fence_wait_any_timeout function v2
|
2015-10-30 01:16:16 -04:00 |
|
edac
|
asm-generic cleanups
|
2015-11-06 14:22:15 -08:00 |
|
eisa
|
|
|
|
extcon
|
|
|
|
firewire
|
IEEE 1394 subsystem patch:
|
2015-11-11 10:21:34 -08:00 |
|
firmware
|
ARM: SoC driver updates for v4.4
|
2015-11-10 15:00:03 -08:00 |
|
fmc
|
|
|
|
fpga
|
fpga: socfpga: Fix check of return value of devm_request_irq
|
2015-10-29 15:20:25 -07:00 |
|
gpio
|
asm-generic cleanups
|
2015-11-06 14:22:15 -08:00 |
|
gpu
|
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
|
2015-11-13 09:12:38 -08:00 |
|
hid
|
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
|
2015-11-07 12:49:27 -08:00 |
|
hsi
|
hsi: controllers:remove redundant code
|
2015-10-30 16:10:40 +01:00 |
|
hv
|
drivers/hv: share Hyper-V SynIC constants with userspace
|
2015-11-04 16:24:33 +01:00 |
|
hwmon
|
ARM: SoC driver updates for v4.4
|
2015-11-10 15:00:03 -08:00 |
|
hwspinlock
|
|
|
|
hwtracing
|
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
|
2015-11-13 20:04:17 -08:00 |
|
i2c
|
Merge branch 'i2c/for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
|
2015-11-10 11:58:25 -08:00 |
|
ide
|
mm, page_alloc: rename __GFP_WAIT to __GFP_RECLAIM
|
2015-11-06 17:50:42 -08:00 |
|
idle
|
|
|
|
iio
|
spi: Updates for v4.4
|
2015-11-05 13:15:12 -08:00 |
|
infiniband
|
SCSI misc on 20151113
|
2015-11-13 20:35:54 -08:00 |
|
input
|
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
|
2015-11-13 21:41:14 -08:00 |
|
iommu
|
mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
|
2015-11-06 17:50:42 -08:00 |
|
ipack
|
|
|
|
irqchip
|
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
|
2015-11-15 09:10:53 -08:00 |
|
isdn
|
TTY/Serial driver patches for 4.4-rc1
|
2015-11-04 21:35:12 -08:00 |
|
leds
|
spi: Updates for v4.4
|
2015-11-05 13:15:12 -08:00 |
|
lguest
|
|
|
|
lightnvm
|
block: change ->make_request_fn() and users to return a queue cookie
|
2015-11-07 10:40:46 -07:00 |
|
macintosh
|
|
|
|
mailbox
|
mailbox: mailbox-test: avoid reading iomem twice
|
2015-11-04 14:03:04 +05:30 |
|
mcb
|
mcb: Destroy IDA on module unload
|
2015-10-29 09:02:16 +09:00 |
|
md
|
Merge branch 'for-4.4/io-poll' of git://git.kernel.dk/linux-block
|
2015-11-10 17:23:49 -08:00 |
|
media
|
netup_unidvb: use pci_set_dma_mask insted of pci_dma_supported
|
2015-11-10 16:32:11 -08:00 |
|
memory
|
ARM: SoC driver updates for v4.4
|
2015-11-10 15:00:03 -08:00 |
|
memstick
|
|
|
|
message
|
SCSI queue for 4.4.
|
2015-11-12 07:06:18 -05:00 |
|
mfd
|
asm-generic cleanups
|
2015-11-06 14:22:15 -08:00 |
|
misc
|
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
|
2015-11-13 20:04:17 -08:00 |
|
mmc
|
spi: Updates for v4.4
|
2015-11-05 13:15:12 -08:00 |
|
mtd
|
This pull request includes the following UBI/UBIFS changes:
|
2015-11-10 16:35:06 -08:00 |
|
net
|
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
|
2015-11-13 20:04:17 -08:00 |
|
nfc
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
|
2015-11-10 18:11:41 -08:00 |
|
ntb
|
NTB: fix 32-bit compiler warning
|
2015-11-08 16:24:43 -05:00 |
|
nubus
|
|
|
|
nvdimm
|
libnvdimm, pmem: fix size trim in pmem_direct_access()
|
2015-11-12 09:55:23 -08:00 |
|
nvme
|
NVMe: add support for Apple NVMe controller
|
2015-11-11 09:36:57 -07:00 |
|
nvmem
|
|
|
|
of
|
More power management and ACPI updates for v4.4-rc1
|
2015-11-12 11:50:33 -08:00 |
|
oprofile
|
|
|
|
parisc
|
pci: remove pci_dma_supported
|
2015-11-10 16:32:11 -08:00 |
|
parport
|
|
|
|
pci
|
More power management and ACPI updates for v4.4-rc1
|
2015-11-12 11:50:33 -08:00 |
|
pcmcia
|
|
|
|
perf
|
arm64 updates for 4.4:
|
2015-11-04 14:47:13 -08:00 |
|
phy
|
phy: qcom-ufs: fix build error when the component is built as a module
|
2015-11-09 17:44:24 -05:00 |
|
pinctrl
|
This is the bulk of GPIO changes for v4.4:
|
2015-11-02 12:59:12 -08:00 |
|
platform
|
platform/chrome: Branch for v4.4
|
2015-11-13 21:53:18 -08:00 |
|
pnp
|
|
|
|
power
|
- New Device Support
|
2015-11-06 10:23:50 -08:00 |
|
powercap
|
|
|
|
pps
|
|
|
|
ps3
|
|
|
|
ptp
|
|
|
|
pwm
|
pwm: Changes for v4.4-rc1
|
2015-11-11 09:16:10 -08:00 |
|
rapidio
|
|
|
|
ras
|
|
|
|
regulator
|
spi: Updates for v4.4
|
2015-11-05 13:15:12 -08:00 |
|
remoteproc
|
|
|
|
reset
|
|
|
|
rpmsg
|
|
|
|
rtc
|
RTC for 4.4
|
2015-11-10 10:01:21 -08:00 |
|
s390
|
block: change ->make_request_fn() and users to return a queue cookie
|
2015-11-07 10:40:46 -07:00 |
|
sbus
|
|
|
|
scsi
|
SCSI misc on 20151113
|
2015-11-13 20:35:54 -08:00 |
|
sfi
|
|
|
|
sh
|
|
|
|
sn
|
|
|
|
soc
|
ARM: SoC driver updates for v4.4
|
2015-11-10 15:00:03 -08:00 |
|
spi
|
Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/ti-qspi' and 'spi/topic/txx9' into spi-next
|
2015-11-04 11:02:16 +00:00 |
|
spmi
|
char/misc drivers for 4.4-rc1
|
2015-11-04 22:15:15 -08:00 |
|
ssb
|
|
|
|
staging
|
Merge branch 'for-4.4/io-poll' of git://git.kernel.dk/linux-block
|
2015-11-10 17:23:49 -08:00 |
|
target
|
SCSI misc on 20151113
|
2015-11-13 20:35:54 -08:00 |
|
tc
|
|
|
|
thermal
|
thermal: rockchip: fix compile error
|
2015-11-11 19:52:39 -08:00 |
|
thunderbolt
|
|
|
|
tty
|
asm-generic cleanups
|
2015-11-06 14:22:15 -08:00 |
|
uio
|
|
|
|
usb
|
SCSI misc on 20151113
|
2015-11-13 20:35:54 -08:00 |
|
uwb
|
driver core update for 4.4-rc1
|
2015-11-04 21:50:37 -08:00 |
|
vfio
|
VFIO updates for v4.4-rc1
|
2015-11-13 17:05:32 -08:00 |
|
vhost
|
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
|
2015-11-13 20:04:17 -08:00 |
|
video
|
fbdev changes for 4.4
|
2015-11-10 10:00:09 -08:00 |
|
virt
|
|
|
|
virtio
|
|
|
|
vlynq
|
|
|
|
vme
|
char/misc drivers for 4.4-rc1
|
2015-11-04 22:15:15 -08:00 |
|
w1
|
power supply and reset changes for the v4.4 series
|
2015-11-05 12:28:15 -08:00 |
|
watchdog
|
Merge git://www.linux-watchdog.org/linux-watchdog
|
2015-11-10 10:11:12 -08:00 |
|
xen
|
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
|
2015-11-13 20:04:17 -08:00 |
|
zorro
|
|
|
|
Kconfig
|
char/misc drivers for 4.4-rc1
|
2015-11-04 22:15:15 -08:00 |
|
Makefile
|
char/misc drivers for 4.4-rc1
|
2015-11-04 22:15:15 -08:00 |