lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADT32eL_Gok5cODL0P1XwfAsWbzY-gtOFc26sAMHcmhFj70v1g@mail.gmail.com>
Date:	Sat, 28 Mar 2015 09:27:27 -0500
From:	Shirish Pargaonkar <shirishpargaonkar@...il.com>
To:	Steve French <smfrench@...il.com>
Cc:	linux-cifs <linux-cifs@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/4] [SMB3] Fix dereference before null check warning

Looks correct.

Acked-by: Shirish Pargaonkar <shirishpargaonkar@...il.com>

On Fri, Mar 27, 2015 at 12:28 AM, Steve French <smfrench@...il.com> wrote:
> null tcon is not likely in these paths in current
> code, but obviously it does clarify the code to
> check for null (if at all) before derefrencing
> rather than after.
>
> Reported by Coverity (CID 1042666)
>
> Signed-off-by: Steve French <smfrench@...il.com>
> ---
>  fs/cifs/smb2pdu.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 1b906de..78b329f 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1218,7 +1218,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
>         struct smb2_ioctl_req *req;
>         struct smb2_ioctl_rsp *rsp;
>         struct TCP_Server_Info *server;
> -       struct cifs_ses *ses = tcon->ses;
> +       struct cifs_ses *ses;
>         struct kvec iov[2];
>         int resp_buftype;
>         int num_iovecs;
> @@ -1233,6 +1233,11 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
>         if (plen)
>                 *plen = 0;
>
> +       if (tcon)
> +               ses = tcon->ses;
> +       else
> +               return -EIO;
> +
>         if (ses && (ses->server))
>                 server = ses->server;
>         else
> @@ -1296,14 +1301,12 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
>         rsp = (struct smb2_ioctl_rsp *)iov[0].iov_base;
>
>         if ((rc != 0) && (rc != -EINVAL)) {
> -               if (tcon)
> -                       cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
> +               cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
>                 goto ioctl_exit;
>         } else if (rc == -EINVAL) {
>                 if ((opcode != FSCTL_SRV_COPYCHUNK_WRITE) &&
>                     (opcode != FSCTL_SRV_COPYCHUNK)) {
> -                       if (tcon)
> -                               cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
> +                       cifs_stats_fail_inc(tcon, SMB2_IOCTL_HE);
>                         goto ioctl_exit;
>                 }
>         }
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ