lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq160j7lbx1.fsf@oracle.com>
Date:   Fri, 17 Mar 2017 19:29:46 -0400
From:   "Martin K. Petersen" <martin.petersen@...cle.com>
To:     Kefeng Wang <wangkefeng.wang@...wei.com>
Cc:     "Martin K. Petersen" <martin.petersen@...cle.com>,
        Jens Axboe <axboe@...nel.dk>,
        "James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
        <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Douglas Gilbert <dgilbert@...erlog.com>
Subject: Re: [PATCH] scsi: sr: fix oob access in get_capabilities

Kefeng Wang <wangkefeng.wang@...wei.com> writes:

Kefeng,

> root@...alhost ~]# sg_modes -p 0x2a /dev/sr0
>     QEMU      QEMU DVD-ROM      0.15   peripheral_type: cd/dvd [0x5]
> Mode parameter header from MODE SENSE(10):
> Invalid block descriptor length=512, ignore
>   Mode data length=36, medium type=0x70, specific param=0x00, longlba=0
>   Block descriptor length=0
>>> MM capabilities and mechanical status (obsolete), page_control: current
>  00     2a 12 00 00 71 60 29 00  02 c2 00 02 02 00 02 c2
>  10     00 00 00 00
> Unexpectedly received extra mode page responses, ignore

That looks pretty broken.

Could you try the following patch?

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f41e6b84a1bd..51a4ce094450 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2485,6 +2485,10 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
 		goto retry;
 	}
 
+	if (data->length > len ||
+	    data->header_length + data->block_descriptor_length > data->length)
+		return 0;
+
 	return result;
 }
 EXPORT_SYMBOL(scsi_mode_sense);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ