Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737915

Re: [PATCH v4 12/13] xen/pvcalls: implement release command

From Boris Ostrovsky <boris.ostrovsky@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 12/13] xen/pvcalls: implement release command
Date 2017-09-23 00:50 +0200
Message-ID <usEVI-3q0-9@gated-at.bofh.it> (permalink)
References <uq7Ud-1h7-3@gated-at.bofh.it> <uq7Ud-1h7-5@gated-at.bofh.it> <uq7Ud-1h7-19@gated-at.bofh.it> <usEVH-3q0-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> +		 */
>> +		map->active.ring->in_error = -EBADF;
>> +		wake_up_interruptible(&map->active.inflight_conn_req);
>> +
>> +		/*
>> +		 * Wait until there are no more waiters on the mutexes.
>> +		 * We know that no new waiters can be added because sk_send_head
>> +		 * is set to NULL -- we only need to wait for the existing
>> +		 * waiters to return.
>> +		 */
>> +		while (!mutex_trylock(&map->active.in_mutex) ||
>> +			   !mutex_trylock(&map->active.out_mutex))
>> +			cpu_relax();
>
> What if you manage to grab the locks before waiters get to run? for
> example, in recvmsg:
>
> 	while (!(flags & MSG_DONTWAIT) && !pvcalls_front_read_todo(map)) {
> 		wait_event_interruptible(map->active.inflight_conn_req,
> 					 pvcalls_front_read_todo(map));
> 	}
> 	ret = __read_ring(map->active.ring, &map->active.data,
> 			  &msg->msg_iter, len, flags);
>
> map will be freed (by pvcalls_front_free_map() below) before __read_ring
> is passed the just-freed ring.

Actually, since you don't drop the locks I am not sure recvmsg side will
even get there.

-boris

>
>
>> +
>> +		pvcalls_front_free_map(bedata, map);
>> +		kfree(map);
>
> -boris
>
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 01/13] xen/pvcalls: introduce the pvcalls xenbus frontend Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
  [PATCH v4 11/13] xen/pvcalls: implement poll command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 11/13] xen/pvcalls: implement poll command Andrea Parri <parri.andrea@gmail.com> - 2017-09-19 17:30 +0200
    Re: [PATCH v4 11/13] xen/pvcalls: implement poll command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-23 00:30 +0200
  [PATCH v4 12/13] xen/pvcalls: implement release command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 12/13] xen/pvcalls: implement release command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-23 00:50 +0200
    Re: [PATCH v4 12/13] xen/pvcalls: implement release command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-23 00:50 +0200
  [PATCH v4 02/13] xen/pvcalls: implement frontend disconnect Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 02/13] xen/pvcalls: implement frontend disconnect Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-20 22:40 +0200
    Re: [PATCH v4 02/13] xen/pvcalls: implement frontend disconnect Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-20 23:10 +0200
  [PATCH v4 10/13] xen/pvcalls: implement recvmsg Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 10/13] xen/pvcalls: implement recvmsg Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-23 00:10 +0200
  [PATCH v4 04/13] xen/pvcalls: implement socket command and handle events Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 04/13] xen/pvcalls: implement socket command and handle  events Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-21 19:50 +0200
  [PATCH v4 03/13] xen/pvcalls: connect to the backend Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 03/13] xen/pvcalls: connect to the backend Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-20 23:20 +0200
  [PATCH v4 08/13] xen/pvcalls: implement accept command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 08/13] xen/pvcalls: implement accept command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-22 02:10 +0200
  [PATCH v4 09/13] xen/pvcalls: implement sendmsg Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 09/13] xen/pvcalls: implement sendmsg Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-23 00:00 +0200
  [PATCH v4 06/13] xen/pvcalls: implement bind command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 06/13] xen/pvcalls: implement bind command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-21 21:50 +0200
  [PATCH v4 05/13] xen/pvcalls: implement connect command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-16 01:10 +0200
    Re: [PATCH v4 05/13] xen/pvcalls: implement connect command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-21 20:30 +0200

csiph-web