Skip to content
OpenAdvisories

Weakness (CWE)

CWE-476: NULL Pointer Dereference

Base

The product dereferences a pointer that it expects to be valid but is NULL.

How to prevent it (5 mitigations)
  1. Implementation

    For any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].

  2. Requirements

    Select a programming language that is not susceptible to these issues.

  3. Implementation

    Check the results of all functions that return a value and verify that the value is non-null before acting upon it.

  4. Architecture and Design

    Identify all variables and data stores that receive information from external sources, and apply input validation to make sure that they are only initialized to expected values.

  5. Implementation

    Explicitly initialize all variables and other data stores, either during declaration or just before the first usage.

Source: MITRE CWE-476

2,668 results · Feed

  • Medium 5.5

    rxrpc: Fix listen() setting the bar too high for the prealloc rings

    In the Linux kernel, the following vulnerability has been resolved: rxrpc: Fix listen() setting the bar too high for the prealloc rings AF_RXRPC's listen() handler lets you set the backlog up to 32 (if you bump up the sysctl), but whilst the preallocation cir…

  • Medium 5.5

    soc: bcm: Check for NULL return of devm_kzalloc()

    In the Linux kernel, the following vulnerability has been resolved: soc: bcm: Check for NULL return of devm_kzalloc() As the potential failure of allocation, devm_kzalloc() may return NULL. Then the 'pd->pmb' and the follow lines of code may bring null pointe…

  • Medium 5.5

    pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources()

    In the Linux kernel, the following vulnerability has been resolved: pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources() It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after…

  • Medium 5.5

    pinctrl: renesas: core: Fix possible null-ptr-deref in sh_pfc_map_resources()

    In the Linux kernel, the following vulnerability has been resolved: pinctrl: renesas: core: Fix possible null-ptr-deref in sh_pfc_map_resources() It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after…

  • Medium 5.5

    md: Don't set mddev private to NULL in raid0 pers->free

    In the Linux kernel, the following vulnerability has been resolved: md: Don't set mddev private to NULL in raid0 pers->free In normal stop process, it does like this: do_md_stop | __md_stop (pers->free(); mddev->private=NULL) | md_free (free mddev) __md_stop …

  • Medium 5.5

    serial: 8250_aspeed_vuart: Fix potential NULL dereference in aspeed_vuart_probe

    In the Linux kernel, the following vulnerability has been resolved: serial: 8250_aspeed_vuart: Fix potential NULL dereference in aspeed_vuart_probe platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL p…

  • Medium 5.5

    scsi: sd: Fix potential NULL pointer dereference

    In the Linux kernel, the following vulnerability has been resolved: scsi: sd: Fix potential NULL pointer dereference If sd_probe() sees an early error before sdkp->device is initialized, sd_zbc_release_disk() is called. This causes a NULL pointer dereference …

  • Medium 5.5

    rtc: mt6397: check return value after calling platform_get_resource()

    In the Linux kernel, the following vulnerability has been resolved: rtc: mt6397: check return value after calling platform_get_resource() It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.

  • Medium 5.5

    powerpc/papr_scm: don't requests stats with '0' sized stats buffer

    In the Linux kernel, the following vulnerability has been resolved: powerpc/papr_scm: don't requests stats with '0' sized stats buffer Sachin reported [1] that on a POWER-10 lpar he is seeing a kernel panic being reported with vPMEM when papr_scm probe is bei…

  • Medium 5.5

    drm/amdgpu/cs: make commands with 0 chunks illegal behaviour.

    In the Linux kernel, the following vulnerability has been resolved: drm/amdgpu/cs: make commands with 0 chunks illegal behaviour. Submitting a cs with 0 chunks, causes an oops later, found trying to execute the wrong userspace driver. MESA_LOADER_DRIVER_OVERR…

  • Medium 5.5

    scsi: lpfc: Address NULL pointer dereference after starget_to_rport()

    In the Linux kernel, the following vulnerability has been resolved: scsi: lpfc: Address NULL pointer dereference after starget_to_rport() Calls to starget_to_rport() may return NULL. Add check for NULL rport before dereference.

  • Medium 5.5

    vduse: Fix NULL pointer dereference on sysfs access

    In the Linux kernel, the following vulnerability has been resolved: vduse: Fix NULL pointer dereference on sysfs access The control device has no drvdata. So we will get a NULL pointer dereference when accessing control device's msg_timeout attribute via sysf…

  • Medium 5.5

    iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe()

    In the Linux kernel, the following vulnerability has been resolved: iommu/arm-smmu: fix possible null-ptr-deref in arm_smmu_device_probe() It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_i…

  • High 7.5

    xprtrdma: treat all calls not a bcall when bc_serv is NULL

    In the Linux kernel, the following vulnerability has been resolved: xprtrdma: treat all calls not a bcall when bc_serv is NULL When a rdma server returns a fault format reply, nfs v3 client may treats it as a bcall when bc service is not exist. The debug mess…

  • Medium 5.5

    iommu/arm-smmu-v3: check return value after calling platform_get_resource()

    In the Linux kernel, the following vulnerability has been resolved: iommu/arm-smmu-v3: check return value after calling platform_get_resource() It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.

  • Medium 5.5

    tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()

    In the Linux kernel, the following vulnerability has been resolved: tty: synclink_gt: Fix null-pointer-dereference in slgt_clean() When the driver fails at alloc_hdlcdev(), and then we remove the driver module, we will get the following splat: [ 25.065966] ge…

  • Medium 5.5

    USB: host: isp116x: check return value after calling platform_get_resource()

    In the Linux kernel, the following vulnerability has been resolved: USB: host: isp116x: check return value after calling platform_get_resource() It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.

  • Medium 4.7

    nbd: fix race between nbd_alloc_config() and module removal

    In the Linux kernel, the following vulnerability has been resolved: nbd: fix race between nbd_alloc_config() and module removal When nbd module is being removing, nbd_alloc_config() may be called concurrently by nbd_genl_connect(), although try_module_get() w…

  • High 7.0

    nbd: call genl_unregister_family() first in nbd_cleanup()

    In the Linux kernel, the following vulnerability has been resolved: nbd: call genl_unregister_family() first in nbd_cleanup() Otherwise there may be race between module removal and the handling of netlink command, which can lead to the oops as shown below: BU…

  • Medium 5.5

    f2fs: quota: fix loop condition at f2fs_quota_sync()

    In the Linux kernel, the following vulnerability has been resolved: f2fs: quota: fix loop condition at f2fs_quota_sync() cnt should be passed to sb_has_quota_active() instead of type to check active quota properly. Moreover, when the type is -1, the compiler …

  • Medium 5.5

    rtc: pl031: fix rtc features null pointer dereference

    In the Linux kernel, the following vulnerability has been resolved: rtc: pl031: fix rtc features null pointer dereference When there is no interrupt line, rtc alarm feature is disabled. The clearing of the alarm feature bit was being done prior to allocations…

  • Medium 5.5

    drm/amd/display: Fix a NULL pointer dereference in amdgpu_dm_connector_add_common_modes()

    In the Linux kernel, the following vulnerability has been resolved: drm/amd/display: Fix a NULL pointer dereference in amdgpu_dm_connector_add_common_modes() In amdgpu_dm_connector_add_common_modes(), amdgpu_dm_create_common_mode() is assigned to mode and is …

  • Medium 5.5

    drm/msm/dp: populate connector of struct dp_panel

    In the Linux kernel, the following vulnerability has been resolved: drm/msm/dp: populate connector of struct dp_panel DP CTS test case 4.2.2.6 has valid edid with bad checksum on purpose and expect DP source return correct checksum. During drm edid read, corr…

  • High 7.8

    xsk: Fix race at socket teardown

    In the Linux kernel, the following vulnerability has been resolved: xsk: Fix race at socket teardown Fix a race in the xsk socket teardown code that can lead to a NULL pointer dereference splat. The current xsk unbind code in xsk_unbind_dev() starts by settin…

  • Critical 9.8

    ibmvnic: fix race between xmit and reset

    In the Linux kernel, the following vulnerability has been resolved: ibmvnic: fix race between xmit and reset There is a race between reset and the transmit paths that can lead to ibmvnic_xmit() accessing an scrq after it has been freed in the reset path. It c…

  • Medium 5.5

    clk: Fix clk_hw_get_clk() when dev is NULL

    In the Linux kernel, the following vulnerability has been resolved: clk: Fix clk_hw_get_clk() when dev is NULL Any registered clk_core structure can have a NULL pointer in its dev field. While never actually documented, this is evidenced by the wide usage of …

  • Medium 5.5

    net: sparx5: switchdev: fix possible NULL pointer dereference

    In the Linux kernel, the following vulnerability has been resolved: net: sparx5: switchdev: fix possible NULL pointer dereference As the possible failure of the allocation, devm_kzalloc() may return NULL pointer. Therefore, it should be better to check the 'd…

  • Medium 5.5

    hwrng: cavium - fix NULL but dereferenced coccicheck error

    In the Linux kernel, the following vulnerability has been resolved: hwrng: cavium - fix NULL but dereferenced coccicheck error Fix following coccicheck warning: ./drivers/char/hw_random/cavium-rng-vf.c:182:17-20: ERROR: pdev is NULL but dereferenced.

  • Medium 5.5

    net: dsa: felix: fix possible NULL pointer dereference

    In the Linux kernel, the following vulnerability has been resolved: net: dsa: felix: fix possible NULL pointer dereference As the possible failure of the allocation, kzalloc() may return NULL pointer. Therefore, it should be better to check the 'sgi' in order…

  • Medium 5.5

    Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt

    In the Linux kernel, the following vulnerability has been resolved: Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt This event is just specified for SCO and eSCO link types. On the reception of a HCI_Synchronous_Connection_Complete for a BDADDR of…

  • Medium 5.5

    mlxsw: spectrum: Guard against invalid local ports

    In the Linux kernel, the following vulnerability has been resolved: mlxsw: spectrum: Guard against invalid local ports When processing events generated by the device's firmware, the driver protects itself from events reported for non-existent local ports, but…

  • Medium 5.5

    ath11k: mhi: use mhi_sync_power_up()

    In the Linux kernel, the following vulnerability has been resolved: ath11k: mhi: use mhi_sync_power_up() If amss.bin was missing ath11k would crash during 'rmmod ath11k_pci'. The reason for that was that we were using mhi_async_power_up() which does not check…

  • Medium 5.5

    drm/sprd: fix potential NULL dereference

    In the Linux kernel, the following vulnerability has been resolved: drm/sprd: fix potential NULL dereference 'drm' could be null in sprd_drm_shutdown, and drm_warn maybe dereference it, remove this warning log. v1 -> v2: - Split checking platform_get_resource…

  • Medium 5.5

    staging: vchiq_core: handle NULL result of find_service_by_handle

    In the Linux kernel, the following vulnerability has been resolved: staging: vchiq_core: handle NULL result of find_service_by_handle In case of an invalid handle the function find_servive_by_handle returns NULL. So take care of this and avoid a NULL pointer …

  • Medium 5.5

    staging: vchiq_arm: Avoid NULL ptr deref in vchiq_dump_platform_instances

    In the Linux kernel, the following vulnerability has been resolved: staging: vchiq_arm: Avoid NULL ptr deref in vchiq_dump_platform_instances vchiq_get_state() can return a NULL pointer. So handle this cases and avoid a NULL pointer derefence in vchiq_dump_pl…

  • High 7.8

    net: sfc: add missing xdp queue reinitialization

    In the Linux kernel, the following vulnerability has been resolved: net: sfc: add missing xdp queue reinitialization After rx/tx ring buffer size is changed, kernel panic occurs when it acts XDP_TX or XDP_REDIRECT. When tx/rx ring buffer size is changed(ethto…

  • Medium 5.5

    drm/panel: ili9341: fix optional regulator handling

    In the Linux kernel, the following vulnerability has been resolved: drm/panel: ili9341: fix optional regulator handling If the optional regulator lookup fails, reset the pointer to NULL. Other functions such as mipi_dbi_poweron_reset_conditional() only do a N…

  • Medium 5.5

    fbdev: Fix unregistering of framebuffers without device

    In the Linux kernel, the following vulnerability has been resolved: fbdev: Fix unregistering of framebuffers without device OF framebuffers do not have an underlying device in the Linux device hierarchy. Do a regular unregister call instead of hot unplugging …

  • High 7.5

    SUNRPC: Fix the svc_deferred_event trace class

    In the Linux kernel, the following vulnerability has been resolved: SUNRPC: Fix the svc_deferred_event trace class Fix a NULL deref crash that occurs when an svc_rqst is deferred while the sunrpc tracing subsystem is enabled. svc_revisit() sets dr->xprt to NU…

  • Medium 5.5

    net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link

    In the Linux kernel, the following vulnerability has been resolved: net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link When using a fixed-link, the altr_tse_pcs driver crashes due to null-pointer dereference as no phy_device is provided …