linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Stephen Boyd <sboyd@kernel.org>
Subject: [PATCH 4.14 051/124] reset: hisilicon: fix potential NULL pointer dereference
Date: Mon, 19 Nov 2018 17:28:25 +0100	[thread overview]
Message-ID: <20181119162623.493108367@linuxfoundation.org> (raw)
In-Reply-To: <20181119162612.951907286@linuxfoundation.org>

4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Gustavo A. R. Silva <gustavo@embeddedor.com>

commit e9a2310fb689151166df7fd9971093362d34bd79 upstream.

There is a potential execution path in which function
platform_get_resource() returns NULL. If this happens,
we will end up having a NULL pointer dereference.

Fix this by replacing devm_ioremap with devm_ioremap_resource,
which has the NULL check and the memory region request.

This code was detected with the help of Coccinelle.

Cc: stable@vger.kernel.org
Fixes: 97b7129cd2af ("reset: hisilicon: change the definition of hisi_reset_init")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/clk/hisilicon/reset.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/clk/hisilicon/reset.c
+++ b/drivers/clk/hisilicon/reset.c
@@ -109,9 +109,8 @@ struct hisi_reset_controller *hisi_reset
 		return NULL;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rstc->membase = devm_ioremap(&pdev->dev,
-				res->start, resource_size(res));
-	if (!rstc->membase)
+	rstc->membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(rstc->membase))
 		return NULL;
 
 	spin_lock_init(&rstc->lock);



  parent reply	other threads:[~2018-11-19 16:49 UTC|newest]

Thread overview: 131+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 16:27 [PATCH 4.14 000/124] 4.14.82-stable review Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 001/124] powerpc/traps: restore recoverability of machine_check interrupts Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 002/124] powerpc/64/module: REL32 relocation range check Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 003/124] powerpc/mm: Fix page table dump to work on Radix Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 004/124] powerpc/eeh: Fix possible null deref in eeh_dump_dev_log() Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 005/124] tty: check name length in tty_find_polling_driver() Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 006/124] ARM: imx_v6_v7_defconfig: Select CONFIG_TMPFS_POSIX_ACL Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 007/124] powerpc/nohash: fix undefined behaviour when testing page size support Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 008/124] powerpc/mm: Dont report hugepage tables as memory leaks when using kmemleak Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 009/124] drm/omap: fix memory barrier bug in DMM driver Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 010/124] drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer pointer Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 011/124] media: pci: cx23885: handle adding to list failure Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 012/124] media: coda: dont overwrite h.264 profile_idc on decoder instance Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 013/124] MIPS: kexec: Mark CPU offline before disabling local IRQ Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 014/124] powerpc/boot: Ensure _zimage_start is a weak symbol Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 015/124] powerpc/memtrace: Remove memory in chunks Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 016/124] MIPS/PCI: Call pcie_bus_configure_settings() to set MPS/MRRS Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 017/124] sc16is7xx: Fix for multi-channel stall Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 018/124] media: tvp5150: fix width alignment during set_selection() Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 019/124] powerpc/selftests: Wait all threads to join Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 020/124] staging:iio:ad7606: fix voltage scales Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 021/124] 9p locks: fix glock.client_id leak in do_lock Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 022/124] 9p: clear dangling pointers in p9stat_free Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 023/124] cdrom: fix improper type cast, which can leat to information leak Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 024/124] ovl: fix error handling in ovl_verify_set_fh() Greg Kroah-Hartman
2018-11-19 16:27 ` [PATCH 4.14 025/124] scsi: qla2xxx: Fix incorrect port speed being set for FC adapters Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 026/124] scsi: qla2xxx: Fix process response queue for ISP26XX and above Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 027/124] scsi: qla2xxx: Remove stale debug trace message from tcm_qla2xxx Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 028/124] scsi: qla2xxx: shutdown chip if reset fail Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 029/124] scsi: qla2xxx: Fix re-using LoopID when handle is in use Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 030/124] fuse: Fix use-after-free in fuse_dev_do_read() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 031/124] fuse: Fix use-after-free in fuse_dev_do_write() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 032/124] fuse: fix blocked_waitq wakeup Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 033/124] fuse: set FR_SENT while locked Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 034/124] ovl: fix recursive oi->lock in ovl_link() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 035/124] MIPS: Loongson-3: Fix CPU UART irq delivery problem Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 036/124] MIPS: Loongson-3: Fix BRIDGE " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 037/124] xtensa: add NOTES section to the linker script Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 038/124] xtensa: make sure bFLT stack is 16 byte aligned Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 039/124] xtensa: fix boot parameters address translation Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 040/124] um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 041/124] clk: s2mps11: Fix matching when built as module and DT node contains compatible Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 042/124] clk: at91: Fix division by zero in PLL recalc_rate() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 043/124] clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 044/124] clk: mvebu: use correct bit for 98DX3236 NAND Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 045/124] media: ov7670: make "xclk" clock optional Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 046/124] libceph: bump CEPH_MSG_MAX_DATA_LEN Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 047/124] Revert "ceph: fix dentry leak in splice_dentry()" Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 048/124] thermal: enable broadcom menu for arm64 bcm2835 Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 049/124] mach64: fix display corruption on big endian machines Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 050/124] mach64: fix image corruption due to reading accelerator registers Greg Kroah-Hartman
2018-11-19 16:28 ` Greg Kroah-Hartman [this message]
2018-11-19 16:28 ` [PATCH 4.14 052/124] vhost/scsi: truncate T10 PI iov_iter to prot_bytes Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 053/124] scsi: qla2xxx: Initialize port speed to avoid setting lower speed Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 054/124] SCSI: fix queue cleanup race before queue initialization is done Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 055/124] soc: ti: QMSS: Fix usage of irq_set_affinity_hint Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 056/124] ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 057/124] ocfs2: free up write context when direct IO failed Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 058/124] mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 059/124] netfilter: conntrack: fix calculation of next bucket number in early_drop Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 060/124] ARM: 8809/1: proc-v7: fix Thumb annotation of cpu_v7_hvc_switch_mm Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 061/124] mtd: docg3: dont set conflicting BCH_CONST_PARAMS option Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 062/124] of, numa: Validate some distance map rules Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 063/124] x86/cpu/vmware: Do not trace vmware_sched_clock() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 064/124] x86/hyper-v: Enable PIT shutdown quirk Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 065/124] termios, tty/tty_baudrate.c: fix buffer overrun Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 066/124] arch/alpha, termios: implement BOTHER, IBSHIFT and termios2 Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 067/124] watchdog/core: Add missing prototypes for weak functions Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 068/124] btrfs: fix pinned underflow after transaction aborted Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 069/124] Btrfs: fix cur_offset in the error case for nocow Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 070/124] Btrfs: fix infinite loop on inode eviction after deduplication of eof block Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 071/124] Btrfs: fix data corruption due to cloning " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 072/124] clockevents/drivers/i8253: Add support for PIT shutdown quirk Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 073/124] ext4: add missing brelse() update_backups()s error path Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 074/124] ext4: add missing brelse() in set_flexbg_block_bitmap()s " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 075/124] ext4: add missing brelse() add_new_gdb_meta_bg()s " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 076/124] ext4: avoid potential extra brelse in setup_new_flex_group_blocks() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 077/124] ext4: missing !bh check in ext4_xattr_inode_write() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 078/124] ext4: fix possible inode leak in the retry loop of ext4_resize_fs() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 079/124] ext4: avoid buffer leak on shutdown in ext4_mark_iloc_dirty() Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 080/124] ext4: avoid buffer leak in ext4_orphan_add() after prior errors Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 081/124] ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 082/124] ext4: avoid possible double brelse() in add_new_gdb() on error path Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 083/124] ext4: fix possible leak of sbi->s_group_desc_leak in " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 084/124] ext4: fix possible leak of s_journal_flag_rwsem " Greg Kroah-Hartman
2018-11-19 16:28 ` [PATCH 4.14 085/124] ext4: fix buffer leak in ext4_xattr_get_block() on " Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 086/124] ext4: release bs.bh before re-using in ext4_xattr_block_find() Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 087/124] ext4: fix buffer leak in ext4_xattr_move_to_block() on error path Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 088/124] ext4: fix buffer leak in ext4_expand_extra_isize_ea() " Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 089/124] ext4: fix buffer leak in __ext4_read_dirblock() " Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 090/124] mount: Retest MNT_LOCKED in do_umount Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 091/124] mount: Dont allow copying MNT_UNBINDABLE|MNT_LOCKED mounts Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 092/124] mount: Prevent MNT_DETACH from disconnecting locked mounts Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 093/124] kdb: use correct pointer when btc calls btt Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 094/124] kdb: print real address of pointers instead of hashed addresses Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 095/124] sunrpc: correct the computation for page_ptr when truncating Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 096/124] nfsd: COPY and CLONE operations require the saved filehandle to be set Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 097/124] rtc: hctosys: Add missing range error reporting Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 098/124] fuse: fix use-after-free in fuse_direct_IO() Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 099/124] fuse: fix leaked notify reply Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 100/124] configfs: replace strncpy with memcpy Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 101/124] gfs2: Put bitmap buffers in put_super Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 102/124] crypto: user - fix leaking uninitialized memory to userspace Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 103/124] lib/ubsan.c: dont mark __ubsan_handle_builtin_unreachable as noreturn Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 104/124] hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444! Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 105/124] mm/swapfile.c: use kvzalloc for swap_info_struct allocation Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 106/124] efi/arm/libstub: Pack FDT after populating it Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 107/124] drm/rockchip: Allow driver to be shutdown on reboot/kexec Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 108/124] drm/amdgpu: add missing CHIP_HAINAN in amdgpu_ucode_get_load_type Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 109/124] drm/nouveau: Check backlight IDs are >= 0, not > 0 Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 110/124] drm/dp_mst: Check if primary mstb is null Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 111/124] drm/atomic_helper: Disallow new modesets on unregistered connectors Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 112/124] drm/i915: Restore vblank interrupts earlier Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 113/124] drm/i915: Dont unset intel_connector->mst_port Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 114/124] drm/i915: Skip vcpi allocation for MSTB ports that are gone Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 115/124] drm/i915: Large page offsets for pread/pwrite Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 116/124] drm/i915/hdmi: Add HDMI 2.0 audio clock recovery N values Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 117/124] drm/i915: Dont oops during modeset shutdown after lpe audio deinit Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 118/124] drm/i915: Mark pin flags as u64 Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 119/124] drm/i915/execlists: Force write serialisation into context image vs execution Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 120/124] CONFIG_XEN_PV breaks xen_create_contiguous_region on ARM Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 121/124] ovl: check whiteout in ovl_create_over_whiteout() Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 122/124] printk: Never set console_may_schedule in console_trylock() Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 123/124] nvme-loop: fix kernel oops in case of unhandled command Greg Kroah-Hartman
2018-11-19 16:29 ` [PATCH 4.14 124/124] gpio: brcmstb: release the bgpio lock during irq handlers Greg Kroah-Hartman
2018-11-20  0:21 ` [PATCH 4.14 000/124] 4.14.82-stable review shuah
2018-11-20  1:15 ` kernelci.org bot
2018-11-20  8:09 ` Naresh Kamboju
2018-11-20 10:56 ` Jon Hunter
2018-11-20 11:26   ` Greg Kroah-Hartman
2018-11-20 20:39 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181119162623.493108367@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).