All of lore.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@HansenPartnership.com, mdr@sgi.com,
	linux-scsi@vger.kernel.org, tomof@acm.org
Subject: Re: [PATCH 1/2] sg: set class_data after success
Date: Mon, 14 Jan 2008 23:54:48 -0500	[thread overview]
Message-ID: <478C3C98.3080802@torque.net> (raw)
In-Reply-To: <20080115131747L.fujita.tomonori@lab.ntt.co.jp>

FUJITA Tomonori wrote:
> If cdev_add fails in sg_add, sg_remove crashes since class_data is
> bogus.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  drivers/scsi/sg.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index f1871ea..92b4367 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -1418,7 +1418,6 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
>  		goto out;
>  	}
>  
> -	class_set_devdata(cl_dev, sdp);
>  	error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1);
>  	if (error)
>  		goto cdev_add_err;
> @@ -1447,6 +1446,8 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
>  		    "Attached scsi generic sg%d type %d\n", sdp->index,
>  		    scsidp->type);
>  
> +	class_set_devdata(cl_dev, sdp);
> +
>  	return 0;
>  
>  cdev_add_err:

Tomo,
Thanks.

Signed-off-by: Douglas Gilbert <dougg@torque.net>


      reply	other threads:[~2008-01-15  4:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-15  4:17 [PATCH 1/2] sg: set class_data after success FUJITA Tomonori
2008-01-15  4:54 ` Douglas Gilbert [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=478C3C98.3080802@torque.net \
    --to=dougg@torque.net \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mdr@sgi.com \
    --cc=tomof@acm.org \
    /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.