diff mbox

libertas: fix possible NULL dereference

Message ID 1448281922-20382-1-git-send-email-sudipm.mukherjee@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Sudip Mukherjee Nov. 23, 2015, 12:32 p.m. UTC
We were dereferencing cmd first and checking for NULL later. Lets first
check for NULL.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/net/wireless/marvell/libertas/cfg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko Nov. 23, 2015, 11:43 p.m. UTC | #1
On Mon, Nov 23, 2015 at 2:32 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> We were dereferencing cmd first and checking for NULL later. Lets first
> check for NULL.

However the patch is valid due to reducing error prone part, the
commit message seems wrong.
There is no dereferencing, it is a simple pointer arithmetic.

>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  drivers/net/wireless/marvell/libertas/cfg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
> index 8317afd..e38ad1d 100644
> --- a/drivers/net/wireless/marvell/libertas/cfg.c
> +++ b/drivers/net/wireless/marvell/libertas/cfg.c
> @@ -1108,7 +1108,7 @@ static int lbs_associate(struct lbs_private *priv,
>         size_t len, resp_ie_len;
>         int status;
>         int ret;
> -       u8 *pos = &(cmd->iebuf[0]);
> +       u8 *pos;
>         u8 *tmp;
>
>         lbs_deb_enter(LBS_DEB_CFG80211);
> @@ -1117,6 +1117,7 @@ static int lbs_associate(struct lbs_private *priv,
>                 ret = -ENOMEM;
>                 goto done;
>         }
> +       pos = &cmd->iebuf[0];
>
>         /*
>          * cmd              50 00
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
Sudip Mukherjee Nov. 24, 2015, 7:32 a.m. UTC | #2
On Tue, Nov 24, 2015 at 01:43:38AM +0200, Andy Shevchenko wrote:
> On Mon, Nov 23, 2015 at 2:32 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > We were dereferencing cmd first and checking for NULL later. Lets first
> > check for NULL.
> 
> However the patch is valid due to reducing error prone part, the
> commit message seems wrong.

I will send v2 with modified commit message.

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo Dec. 7, 2015, 6:03 p.m. UTC | #3
Hi Sudip,

Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:

> We were dereferencing cmd first and checking for NULL later. Lets first
> check for NULL.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>

I noticed that your name in git log is not your full name:

commit 0a38c8e1b592c16d959da456f425053e323a5153
Author: sudip <sudipm.mukherjee@gmail.com>
Date:   Tue Nov 24 13:51:38 2015 +0530

This is because for some reason in patchwork your fullname is just
"sudip":

https://patchwork.kernel.org/patch/7688171/

Could you please fix your name in patchwork so that in the future we can
use your correct full name? The problem is that I don't know exactly how
to do this but it should be possible because I remember someone else
having a similar problem and he was able to fix it.
Sudip Mukherjee Dec. 8, 2015, 4:54 a.m. UTC | #4
On Mon, Dec 07, 2015 at 08:03:54PM +0200, Kalle Valo wrote:
> Hi Sudip,
> 
> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> 
> > We were dereferencing cmd first and checking for NULL later. Lets first
> > check for NULL.
> >
> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> 
> I noticed that your name in git log is not your full name:
> 
> commit 0a38c8e1b592c16d959da456f425053e323a5153
> Author: sudip <sudipm.mukherjee@gmail.com>
> Date:   Tue Nov 24 13:51:38 2015 +0530
> 
> This is because for some reason in patchwork your fullname is just
> "sudip":
> 
> https://patchwork.kernel.org/patch/7688171/
> 
> Could you please fix your name in patchwork so that in the future we can
> use your correct full name? The problem is that I don't know exactly how
> to do this but it should be possible because I remember someone else
> having a similar problem and he was able to fix it.

Hi Kalle,
I have also noticed the patch. Anyway, I have created a profile in
patchwork and given full name. Hopefully that should solve the problem.


regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo Dec. 8, 2015, 7:54 a.m. UTC | #5
Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:

> On Mon, Dec 07, 2015 at 08:03:54PM +0200, Kalle Valo wrote:
>> Hi Sudip,
>> 
>> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
>> 
>> > We were dereferencing cmd first and checking for NULL later. Lets first
>> > check for NULL.
>> >
>> > Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
>> 
>> I noticed that your name in git log is not your full name:
>> 
>> commit 0a38c8e1b592c16d959da456f425053e323a5153
>> Author: sudip <sudipm.mukherjee@gmail.com>
>> Date:   Tue Nov 24 13:51:38 2015 +0530
>> 
>> This is because for some reason in patchwork your fullname is just
>> "sudip":
>> 
>> https://patchwork.kernel.org/patch/7688171/
>> 
>> Could you please fix your name in patchwork so that in the future we can
>> use your correct full name? The problem is that I don't know exactly how
>> to do this but it should be possible because I remember someone else
>> having a similar problem and he was able to fix it.
>
> I have also noticed the patch. Anyway, I have created a profile in
> patchwork and given full name. Hopefully that should solve the problem.

At least now your name in the patchwork link above looks correct:

Sudip Mukherjee - Nov. 24, 2015, 8:21 a.m.

Thanks for fixing this.
Sudip Mukherjee Dec. 8, 2015, 8:21 a.m. UTC | #6
On Tue, Dec 08, 2015 at 09:54:41AM +0200, Kalle Valo wrote:
> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> 
> > On Mon, Dec 07, 2015 at 08:03:54PM +0200, Kalle Valo wrote:
> >> Hi Sudip,
> >> 
> >> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
> >> 
<snip>
> >
> > I have also noticed the patch. Anyway, I have created a profile in
> > patchwork and given full name. Hopefully that should solve the problem.
> 
> At least now your name in the patchwork link above looks correct:

Yes, but I am still surprised why this happened for only this patch.

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo Dec. 8, 2015, 8:30 a.m. UTC | #7
Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:

> On Tue, Dec 08, 2015 at 09:54:41AM +0200, Kalle Valo wrote:
>> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
>> 
>> > On Mon, Dec 07, 2015 at 08:03:54PM +0200, Kalle Valo wrote:
>> >> Hi Sudip,
>> >> 
>> >> Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:
>> >> 
> <snip>
>> >
>> > I have also noticed the patch. Anyway, I have created a profile in
>> > patchwork and given full name. Hopefully that should solve the problem.
>> 
>> At least now your name in the patchwork link above looks correct:
>
> Yes, but I am still surprised why this happened for only this patch.

I don't know what other patches you are referring to, but I download the
patches I apply directly from patchwork. If other maintainers take the
patch from a mail folder this issue would not happen.
diff mbox

Patch

diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c
index 8317afd..e38ad1d 100644
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
@@ -1108,7 +1108,7 @@  static int lbs_associate(struct lbs_private *priv,
 	size_t len, resp_ie_len;
 	int status;
 	int ret;
-	u8 *pos = &(cmd->iebuf[0]);
+	u8 *pos;
 	u8 *tmp;
 
 	lbs_deb_enter(LBS_DEB_CFG80211);
@@ -1117,6 +1117,7 @@  static int lbs_associate(struct lbs_private *priv,
 		ret = -ENOMEM;
 		goto done;
 	}
+	pos = &cmd->iebuf[0];
 
 	/*
 	 * cmd              50 00