public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Douglas Gilbert <dgilbert@interlog.com>
Cc: Calvin Owens <calvinowens@fb.com>,
	"James E.J. Bottomley" <JBottomley@odin.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH] sg: Fix double-free when drives detach during SG_IO
Date: Mon, 02 Nov 2015 23:52:23 -0500	[thread overview]
Message-ID: <yq1ziyv3cs8.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <5637CE3F.6020706@interlog.com> (Douglas Gilbert's message of "Mon, 2 Nov 2015 21:57:35 +0100")

>>>>> "Doug" == Douglas Gilbert <dgilbert@interlog.com> writes:

>> In sg_common_write(), we free the block request and return -ENODEV if
>> the device is detached in the middle of the SG_IO ioctl().
>> 
>> Unfortunately, sg_finish_rem_req() also tries to free srp->rq, so we
>> end up freeing rq->cmd in the already free rq object, and then free
>> the object itself out from under the current user.
>> 
>> This ends up corrupting random memory via the list_head on the rq
>> object. The most common crash trace I saw is this:

>> Signed-off-by: Calvin Owens <calvinowens@fb.com>

Doug> Acked-by: Douglas Gilbert <dgilbert@interlog.com>

Applied.

-- 
Martin K. Petersen	Oracle Linux Engineering

      reply	other threads:[~2015-11-03  4:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 23:57 [PATCH] sg: Fix double-free when drives detach during SG_IO Calvin Owens
2015-11-02 20:57 ` Douglas Gilbert
2015-11-03  4:52   ` Martin K. Petersen [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=yq1ziyv3cs8.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=JBottomley@odin.com \
    --cc=calvinowens@fb.com \
    --cc=dgilbert@interlog.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox