From: Dan Carpenter <dan.carpenter@oracle.com> To: Darren Hart <dvhart@infradead.org>, Mario Limonciello <mario.limonciello@dell.com> Cc: Andy Shevchenko <andy@infradead.org>, platform-driver-x86@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl() Date: Mon, 13 Nov 2017 10:06:01 +0000 [thread overview] Message-ID: <20171113100601.quq6qjvlk6ijzmri@mwanda> (raw) We need to drop a lock if try_module_get() fails. Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 8c31ed4f0e1b..791449a2370f 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /* let the driver do any filtering and do the call */ wdriver = container_of(wblock->dev.dev.driver, struct wmi_driver, driver); - if (!try_module_get(wdriver->driver.owner)) - return -EBUSY; + if (!try_module_get(wdriver->driver.owner)) { + ret = -EBUSY; + goto out_ioctl; + } ret = wdriver->filter_callback(&wblock->dev, cmd, buf); module_put(wdriver->driver.owner); if (ret)
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Darren Hart <dvhart@infradead.org>, Mario Limonciello <mario.limonciello@dell.com> Cc: Andy Shevchenko <andy@infradead.org>, platform-driver-x86@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl() Date: Mon, 13 Nov 2017 13:06:01 +0300 [thread overview] Message-ID: <20171113100601.quq6qjvlk6ijzmri@mwanda> (raw) We need to drop a lock if try_module_get() fails. Fixes: 44b6b7661132 ("platform/x86: wmi: create userspace interface for drivers") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 8c31ed4f0e1b..791449a2370f 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -868,8 +868,10 @@ static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) /* let the driver do any filtering and do the call */ wdriver = container_of(wblock->dev.dev.driver, struct wmi_driver, driver); - if (!try_module_get(wdriver->driver.owner)) - return -EBUSY; + if (!try_module_get(wdriver->driver.owner)) { + ret = -EBUSY; + goto out_ioctl; + } ret = wdriver->filter_callback(&wblock->dev, cmd, buf); module_put(wdriver->driver.owner); if (ret)
next reply other threads:[~2017-11-13 10:06 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-13 10:06 Dan Carpenter [this message] 2017-11-13 10:06 ` [PATCH] platform/x86: wmi: Unlock on error in wmi_ioctl() Dan Carpenter 2017-11-13 14:51 ` Mario.Limonciello 2017-11-13 17:21 ` Darren Hart 2017-11-13 17:21 ` Darren Hart
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=20171113100601.quq6qjvlk6ijzmri@mwanda \ --to=dan.carpenter@oracle.com \ --cc=andy@infradead.org \ --cc=dvhart@infradead.org \ --cc=kernel-janitors@vger.kernel.org \ --cc=mario.limonciello@dell.com \ --cc=platform-driver-x86@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.