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] [day] [month] [year] [list]
Message-ID: <20151020045038.GE9764@zurbaran.home>
Date:	Tue, 20 Oct 2015 06:50:38 +0200
From:	Samuel Ortiz <sameo@...ux.intel.com>
To:	Vincent Stehlé <vincent.stehle@...oste.net>
Cc:	linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Thierry Escande <thierry.escande@...ux.intel.com>
Subject: Re: [PATCH] nfc: netlink: avoid NULL pointer dereference on error

Hi Vincent,

On Wed, Oct 07, 2015 at 11:33:19AM +0200, Vincent Stehlé wrote:
> The function nfc_genl_llc_sdreq() can dereference the dev pointer while
> it is NULL on its error path. Create a new error handling label to avoid
> that.
> 
> This fixes the following coccinelle error:
> 
>   ./net/nfc/netlink.c:1175:21-24: ERROR: dev is NULL but dereferenced.
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@...oste.net>
> Cc: Thierry Escande <thierry.escande@...ux.intel.com>
> Cc: Samuel Ortiz <sameo@...ux.intel.com>
> ---
>  net/nfc/netlink.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
> index 853172c..51c48f0 100644
> --- a/net/nfc/netlink.c
> +++ b/net/nfc/netlink.c
> @@ -1111,7 +1111,7 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, struct genl_info *info)
>  	dev = nfc_get_device(idx);
>  	if (!dev) {
>  		rc = -ENODEV;
> -		goto exit;
> +		goto exit_nodev;
>  	}
Julia Lawall sent a better fix that I applied:

-       if (!dev) {
-               rc = -ENODEV;
-               goto exit;
-       }
+       if (!dev)
+               return -ENODEV;

Cheers,
Samuel.
--
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