* [PATCH 4/7] cifs: fix a possible null pointer deref in decode_ascii_ssetup
@ 2014-08-20 10:39 Namjae Jeon
2014-08-21 0:07 ` Steve French
0 siblings, 1 reply; 2+ messages in thread
From: Namjae Jeon @ 2014-08-20 10:39 UTC (permalink / raw)
To: 'Steve French'
Cc: 'Shirish Pargaonkar', 'Pavel Shilovsky',
linux-cifs-u79uwXL29TY76Z2rM5mHXA, Ashish Sangwan
When kzalloc fails, we will end up doing NULL pointer derefrence
Signed-off-by: Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Ashish Sangwan <a.sangwan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
fs/cifs/sess.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 39b8507..07fe97a 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
kfree(ses->serverOS);
ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
- if (ses->serverOS)
+ if (ses->serverOS) {
strncpy(ses->serverOS, bcc_ptr, len);
- if (strncmp(ses->serverOS, "OS/2", 4) == 0)
- cifs_dbg(FYI, "OS/2 server\n");
+ if (strncmp(ses->serverOS, "OS/2", 4) == 0)
+ cifs_dbg(FYI, "OS/2 server\n");
+ }
bcc_ptr += len + 1;
bleft -= len + 1;
--
1.7.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4/7] cifs: fix a possible null pointer deref in decode_ascii_ssetup
2014-08-20 10:39 [PATCH 4/7] cifs: fix a possible null pointer deref in decode_ascii_ssetup Namjae Jeon
@ 2014-08-21 0:07 ` Steve French
0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2014-08-21 0:07 UTC (permalink / raw)
To: Namjae Jeon
Cc: Shirish Pargaonkar, Pavel Shilovsky,
linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ashish Sangwan
merged into cifs-2.6.git for-next
On Wed, Aug 20, 2014 at 5:39 AM, Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> When kzalloc fails, we will end up doing NULL pointer derefrence
>
> Signed-off-by: Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Ashish Sangwan <a.sangwan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> fs/cifs/sess.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
> index 39b8507..07fe97a 100644
> --- a/fs/cifs/sess.c
> +++ b/fs/cifs/sess.c
> @@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
> kfree(ses->serverOS);
>
> ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
> - if (ses->serverOS)
> + if (ses->serverOS) {
> strncpy(ses->serverOS, bcc_ptr, len);
> - if (strncmp(ses->serverOS, "OS/2", 4) == 0)
> - cifs_dbg(FYI, "OS/2 server\n");
> + if (strncmp(ses->serverOS, "OS/2", 4) == 0)
> + cifs_dbg(FYI, "OS/2 server\n");
> + }
>
> bcc_ptr += len + 1;
> bleft -= len + 1;
> --
> 1.7.7
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-21 0:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 10:39 [PATCH 4/7] cifs: fix a possible null pointer deref in decode_ascii_ssetup Namjae Jeon
2014-08-21 0:07 ` Steve French
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.