All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] rbd: do a safe list traversal in rbd_img_request_submit()
Date: Thu, 11 Apr 2013 13:03:33 -0700	[thread overview]
Message-ID: <51671715.2060505@inktank.com> (raw)
In-Reply-To: <5165EC73.5000600@inktank.com>

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 04/10/2013 03:49 PM, Alex Elder wrote:
> It's possible that the reference to the object request dropped
> inside the loop in rbd_img_request_submit() will be the last
> one, in which case the content of the object pointer can't be
> trusted.
>
> Use a safe form of the object request list traversal to avoid
> problems.
>
> This resolves:
>      http://tracker.ceph.com/issues/4705
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 3c0abe6..7eb1032 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1652,9 +1652,10 @@ static int rbd_img_request_submit(struct
> rbd_img_request *img_request)
>   	struct rbd_device *rbd_dev = img_request->rbd_dev;
>   	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
>   	struct rbd_obj_request *obj_request;
> +	struct rbd_obj_request *next_obj_request;
>
>   	dout("%s: img %p\n", __func__, img_request);
> -	for_each_obj_request(img_request, obj_request) {
> +	for_each_obj_request_safe(img_request, obj_request, next_obj_request) {
>   		int ret;
>
>   		ret = rbd_obj_request_submit(osdc, obj_request);
>


      reply	other threads:[~2013-04-11 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 22:49 [PATCH] rbd: do a safe list traversal in rbd_img_request_submit() Alex Elder
2013-04-11 20:03 ` Josh Durgin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51671715.2060505@inktank.com \
    --to=josh.durgin@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.