Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1484185 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2016-09-15 15:50 +0200 |
| Last post | 2016-09-15 16:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mwifiex: fix null pointer deference when adapter is null Colin King <colin.king@canonical.com> - 2016-09-15 15:50 +0200
Re: [PATCH] mwifiex: fix null pointer deference when adapter is null Julian Calaby <julian.calaby@gmail.com> - 2016-09-15 16:00 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2016-09-15 15:50 +0200 |
| Subject | [PATCH] mwifiex: fix null pointer deference when adapter is null |
| Message-ID | <shFd8-7FN-15@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com> If adapter is null the error exit path in mwifiex_shutdown_sw is to down the semaphore sem and print some debug via mwifiex_dbg. However, passing a NULL adapter to mwifiex_dbg causes a null pointer deference when accessing adapter->dev. This fix checks for a null adapter at the start of the function and to exit without the need to up the semaphore and we also skip the debug to avoid the null pointer dereference. Signed-off-by: Colin Ian King <colin.king@canonical.com> --- drivers/net/wireless/marvell/mwifiex/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 9b2e98c..7a4f8cc 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -1369,12 +1369,12 @@ mwifiex_shutdown_sw(struct mwifiex_adapter *adapter, struct semaphore *sem) struct mwifiex_private *priv; int i; + if (!adapter) + goto exit_return; + if (down_interruptible(sem)) goto exit_sem_err; - if (!adapter) - goto exit_remove; - priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); mwifiex_deauthenticate(priv, NULL); @@ -1434,6 +1434,7 @@ mwifiex_shutdown_sw(struct mwifiex_adapter *adapter, struct semaphore *sem) up(sem); exit_sem_err: mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); +exit_return: return 0; } -- 2.9.3
[toc] | [next] | [standalone]
| From | Julian Calaby <julian.calaby@gmail.com> |
|---|---|
| Date | 2016-09-15 16:00 +0200 |
| Message-ID | <shFmO-7Jn-11@gated-at.bofh.it> |
| In reply to | #1484185 |
Hi All, On Thu, Sep 15, 2016 at 11:42 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > If adapter is null the error exit path in mwifiex_shutdown_sw is > to down the semaphore sem and print some debug via mwifiex_dbg. > However, passing a NULL adapter to mwifiex_dbg causes a null > pointer deference when accessing adapter->dev. This fix checks > for a null adapter at the start of the function and to exit > without the need to up the semaphore and we also skip the debug > to avoid the null pointer dereference. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Thanks, -- Julian Calaby Email: julian.calaby@gmail.com Profile: http://www.google.com/profiles/julian.calaby/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web