Re: [PATCH 2/3] scsi: create an all-zero filter for scanners

From: Alan Cox
Date: Wed Sep 12 2012 - 08:31:34 EST


On Wed, 12 Sep 2012 13:23:43 +0200
Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:

> Using /dev/sg for scanners is blocked from unprivileged users. Reimplement
> this using customizable command filters, so that the sysfs knobs will work
> in this case too.
>
> Cc: linux-iscsi@xxxxxxxxxxxxxxx
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> drivers/scsi/scsi_scan.c | 6 +++++-
> drivers/scsi/sg.c | 3 ---
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 56a9379..d168c15 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -773,13 +773,17 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
> }
>
> switch (sdev->type) {
> + case TYPE_SCANNER:
> + sdev->request_queue->cmd_filter =
> + kzalloc(sizeof(struct blk_cmd_filter), GFP_KERNEL);
> + /* fallthrough */

Is that really desireable in the kzalloc failing case ?

--
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/