[bug report] pinmux: Use sequential access to access desc->pinmux data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Mukesh Ojha,

Commit 5a3e85c3c397 ("pinmux: Use sequential access to access
desc->pinmux data") from Oct 15, 2024 (linux-next), leads to the
following Smatch static checker warning:

	drivers/pinctrl/pinmux.c:132 pin_request()
	warn: sleeping in atomic context

drivers/pinctrl/pinmux.c
    113 static int pin_request(struct pinctrl_dev *pctldev,
    114                        int pin, const char *owner,
    115                        struct pinctrl_gpio_range *gpio_range)
    116 {
    117         struct pin_desc *desc;
    118         const struct pinmux_ops *ops = pctldev->desc->pmxops;
    119         int status = -EINVAL;
    120 
    121         desc = pin_desc_get(pctldev, pin);
    122         if (desc == NULL) {
    123                 dev_err(pctldev->dev,
    124                         "pin %d is not registered so it cannot be requested\n",
    125                         pin);
    126                 goto out;
    127         }
    128 
    129         dev_dbg(pctldev->dev, "request pin %d (%s) for %s\n",
    130                 pin, desc->name, owner);
    131 
--> 132         scoped_guard(mutex, &desc->mux_lock) {
                             ^^^^^
The patch adds a mutex to solve a race condition.  However the omap_hsmmc
driver potentially calls this with a spinlock held in the suspend/resume
path so it leads to a sleeping in atomic warning.

The call tree is:

omap_hsmmc_runtime_resume() <- disables preempt
-> pinctrl_select_default_state()
omap_hsmmc_runtime_suspend() <- disables preempt
-> pinctrl_pm_select_idle_state()
   -> pinctrl_select_bound_state()
      -> pinctrl_select_state()
         -> pinctrl_commit_state()
            -> pinmux_enable_setting()
               -> pin_request()

regards,
dan carpenter




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux