pvcalls-front: don't try to free unallocated rings
authorStefano Stabellini <sstabellini@kernel.org>
Fri, 21 Dec 2018 23:06:30 +0000 (15:06 -0800)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Wed, 2 Jan 2019 16:00:10 +0000 (11:00 -0500)
inflight_req_id is 0 when initialized. If inflight_req_id is 0, there is
no accept_map to free. Fix the check in pvcalls_front_release.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/xen/pvcalls-front.c

index e5d95aab2cb80d5e03e0509326e2e84e32d9c04b..4f3d664b3f39e4eebfd3247ff239e936615a693a 100644 (file)
@@ -1030,8 +1030,8 @@ int pvcalls_front_release(struct socket *sock)
                spin_lock(&bedata->socket_lock);
                list_del(&map->list);
                spin_unlock(&bedata->socket_lock);
-               if (READ_ONCE(map->passive.inflight_req_id) !=
-                   PVCALLS_INVALID_ID) {
+               if (READ_ONCE(map->passive.inflight_req_id) != PVCALLS_INVALID_ID &&
+                       READ_ONCE(map->passive.inflight_req_id) != 0) {
                        pvcalls_front_free_map(bedata,
                                               map->passive.accept_map);
                }