libata: reject passthrough WRITE SAME requests
authorChristoph Hellwig <hch@lst.de>
Tue, 25 Apr 2017 11:39:54 +0000 (13:39 +0200)
committerTejun Heo <tj@kernel.org>
Fri, 28 Apr 2017 22:08:21 +0000 (18:08 -0400)
commitc6ade20f5e50e188d20b711a618b20dd1d50457e
treea6b882286df26b634acaf06a4a27639287b92fee
parent1a92e99a55e2689f9c13770fe0068b24476268ef
libata: reject passthrough WRITE SAME requests

The WRITE SAME to TRIM translation rewrites the DATA OUT buffer.  While
the SCSI code accomodates for this by passing a read-writable buffer
userspace applications don't cater for this behavior.  In fact it can
be used to rewrite e.g. a readonly file through mmap and should be
considered as a security fix.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/libata-scsi.c