Re: [PATCH 2/2] block,scsi: convert and handle ERR_PTR from blk_get_request

From: Joe Lawrence
Date: Tue Jun 03 2014 - 16:52:52 EST


On Tue, 3 Jun 2014 15:45:36 -0400
Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:

> Joe Lawrence <joe.lawrence@xxxxxxxxxxx> writes:
>
> > The blk_get_request function may fail in low-memory conditions or during
> > device removal (even if __GFP_WAIT is set). To distinguish between these
> > errors, modify the blk_get_request call stack to return the appropriate
> > ERR_PTR. Verify that all callers check the return status and consider
> > IS_ERR instead of a simple NULL pointer check.
>
> I'm curious to know what testing you did, and what code paths do
> anything different for ENOMEM vs EIO. I guess ENOMEM may make it all
> the way back to userspace?

Hi Jeff,

Good question. In the case of the short repro program provided by
Paolo in [1], the ioctl call returned error and set -ENODEV.

As for each individual caller of blk_get_request, I did not audit all
code paths back out to user space. I can take a look, but I'm guessing
that 24-ish callers might make for quite a *few* scenarios to verify.

Conversion to ERR_PTR was suggested by Jens as a complete fix, but
without sufficient Ack's, I can understand holding off on this part of
the set.

-- Joe

[1] http://thread.gmane.org/gmane.linux.scsi/85824
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/