diff mbox

xen/pvcalls: NULL dereference in error handling

Message ID 20170712072506.3lzevgfwuzgs5u2s@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter July 12, 2017, 7:25 a.m. UTC
We accidentally dereference "map" when it's NULL.

Fixes: b535e2b9b78a ("xen/pvcalls: implement connect command")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Stefano Stabellini July 12, 2017, 7:27 a.m. UTC | #1
On Wed, 12 Jul 2017, Dan Carpenter wrote:
> We accidentally dereference "map" when it's NULL.
> 
> Fixes: b535e2b9b78a ("xen/pvcalls: implement connect command")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks!

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> index d6c4c4aecb41..01b690e1e555 100644
> --- a/drivers/xen/pvcalls-back.c
> +++ b/drivers/xen/pvcalls-back.c
> @@ -424,7 +424,7 @@ static int pvcalls_back_connect(struct xenbus_device *dev,
>  					sock);
>  	if (!map) {
>  		ret = -EFAULT;
> -		sock_release(map->sock);
> +		sock_release(sock);
>  	}
>  
>  out:
>
Jürgen Groß July 18, 2017, 7 a.m. UTC | #2
On 12/07/17 09:25, Dan Carpenter wrote:
> We accidentally dereference "map" when it's NULL.
> 
> Fixes: b535e2b9b78a ("xen/pvcalls: implement connect command")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

The patch is okay, but the very same one has already been sent before.
I'll take the first one.


Juergen

> 
> diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> index d6c4c4aecb41..01b690e1e555 100644
> --- a/drivers/xen/pvcalls-back.c
> +++ b/drivers/xen/pvcalls-back.c
> @@ -424,7 +424,7 @@ static int pvcalls_back_connect(struct xenbus_device *dev,
>  					sock);
>  	if (!map) {
>  		ret = -EFAULT;
> -		sock_release(map->sock);
> +		sock_release(sock);
>  	}
>  
>  out:
> 
>
diff mbox

Patch

diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6c4c4aecb41..01b690e1e555 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -424,7 +424,7 @@  static int pvcalls_back_connect(struct xenbus_device *dev,
 					sock);
 	if (!map) {
 		ret = -EFAULT;
-		sock_release(map->sock);
+		sock_release(sock);
 	}
 
 out: