* [PATCH v2] mwifiex: fix possible NULL dereference @ 2016-04-12 11:46 Sudip Mukherjee [not found] ` <1460461597-7309-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Sudip Mukherjee @ 2016-04-12 11:46 UTC (permalink / raw) To: Amitkumar Karwar, Nishant Sarmukadam, Kalle Valo Cc: linux-kernel, linux-wireless, netdev, Sudip Mukherjee, Christian Daudt From: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> We have a check for card just after dereferencing it. So if it is NULL we have already dereferenced it before its check. Lets dereference it after checking card for NULL. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> --- drivers/net/wireless/marvell/mwifiex/pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index edf8b07..d4db9db 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2884,10 +2884,11 @@ static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; const struct mwifiex_pcie_card_reg *reg; - struct pci_dev *pdev = card->dev; int i; if (card) { + struct pci_dev *pdev = card->dev; + if (card->msix_enable) { for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) synchronize_irq(card->msix_entries[i].vector); -- 1.9.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1460461597-7309-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2] mwifiex: fix possible NULL dereference [not found] ` <1460461597-7309-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2016-04-12 11:50 ` Arend van Spriel 2016-04-12 11:56 ` Sudip Mukherjee 0 siblings, 1 reply; 3+ messages in thread From: Arend van Spriel @ 2016-04-12 11:50 UTC (permalink / raw) To: Sudip Mukherjee, Amitkumar Karwar, Nishant Sarmukadam, Kalle Valo Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, Sudip Mukherjee, Christian Daudt On 12-04-16 13:46, Sudip Mukherjee wrote: > From: Sudip Mukherjee <sudip.mukherjee-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org> > > We have a check for card just after dereferencing it. So if it is NULL > we have already dereferenced it before its check. Lets dereference it > after checking card for NULL. And you are changing the scope of the pdev variable. Regards, Arend > Signed-off-by: Sudip Mukherjee <sudip.mukherjee-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org> > --- > drivers/net/wireless/marvell/mwifiex/pcie.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c > index edf8b07..d4db9db 100644 > --- a/drivers/net/wireless/marvell/mwifiex/pcie.c > +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c > @@ -2884,10 +2884,11 @@ static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) > { > struct pcie_service_card *card = adapter->card; > const struct mwifiex_pcie_card_reg *reg; > - struct pci_dev *pdev = card->dev; > int i; > > if (card) { > + struct pci_dev *pdev = card->dev; > + > if (card->msix_enable) { > for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) > synchronize_irq(card->msix_entries[i].vector); > -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mwifiex: fix possible NULL dereference 2016-04-12 11:50 ` Arend van Spriel @ 2016-04-12 11:56 ` Sudip Mukherjee 0 siblings, 0 replies; 3+ messages in thread From: Sudip Mukherjee @ 2016-04-12 11:56 UTC (permalink / raw) To: Arend van Spriel, Amitkumar Karwar, Nishant Sarmukadam, Kalle Valo Cc: linux-kernel, linux-wireless, netdev, Sudip Mukherjee, Christian Daudt On Tuesday 12 April 2016 05:20 PM, Arend van Spriel wrote: > > > On 12-04-16 13:46, Sudip Mukherjee wrote: >> From: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> >> >> We have a check for card just after dereferencing it. So if it is NULL >> we have already dereferenced it before its check. Lets dereference it >> after checking card for NULL. > > And you are changing the scope of the pdev variable. yes, and since all usage of pdev is inside the "if" block so it should not matter. regards sudip > > Regards, > Arend > >> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> >> --- >> drivers/net/wireless/marvell/mwifiex/pcie.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c >> index edf8b07..d4db9db 100644 >> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c >> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c >> @@ -2884,10 +2884,11 @@ static void mwifiex_unregister_dev(struct mwifiex_adapter *adapter) >> { >> struct pcie_service_card *card = adapter->card; >> const struct mwifiex_pcie_card_reg *reg; >> - struct pci_dev *pdev = card->dev; >> int i; >> >> if (card) { >> + struct pci_dev *pdev = card->dev; >> + >> if (card->msix_enable) { >> for (i = 0; i < MWIFIEX_NUM_MSIX_VECTORS; i++) >> synchronize_irq(card->msix_entries[i].vector); >> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-12 11:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-04-12 11:46 [PATCH v2] mwifiex: fix possible NULL dereference Sudip Mukherjee [not found] ` <1460461597-7309-1-git-send-email-sudipm.mukherjee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2016-04-12 11:50 ` Arend van Spriel 2016-04-12 11:56 ` Sudip Mukherjee
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).