aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_ioctl.c
AgeCommit message (Collapse)AuthorFilesLines
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-2/+2
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <[email protected]>
2020-04-25scsi_ioctl.c: switch SCSI_IOCTL_GET_IDLUN to copy_to_user()Al Viro1-10/+10
Signed-off-by: Al Viro <[email protected]>
2020-01-03compat_ioctl: add scsi_compat_ioctlArnd Bergmann1-14/+40
In order to move the compat handling for SCSI ioctl commands out of fs/compat_ioctl.c into the individual drivers, we need a helper function first to match the native ioctl handler called by sd, sr, st, etc. Reviewed-by: Ben Hutchings <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
2019-05-21treewide: Add SPDX license identifier for missed filesThomas Gleixner1-0/+1
Add SPDX license identifiers to all files which: - Have no license information of any form - Have EXPORT_.*_SYMBOL_GPL inside which was used in the initial scan/conversion to ignore the file These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-01-03Remove 'type' argument from access_ok() functionLinus Torvalds1-1/+1
Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument of the user address range verification function since we got rid of the old racy i386-only code to walk page tables by hand. It existed because the original 80386 would not honor the write protect bit when in kernel mode, so you had to do COW by hand before doing any user access. But we haven't supported that in a long time, and these days the 'type' argument is a purely historical artifact. A discussion about extending 'user_access_begin()' to do the range checking resulted this patch, because there is no way we're going to move the old VERIFY_xyz interface to that model. And it's best done at the end of the merge window when I've done most of my merges, so let's just get this done once and for all. This patch was mostly done with a sed-script, with manual fix-ups for the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form. There were a couple of notable cases: - csky still had the old "verify_area()" name as an alias. - the iter_iov code had magical hardcoded knowledge of the actual values of VERIFY_{READ,WRITE} (not that they mattered, since nothing really used it) - microblaze used the type argument for a debug printout but other than those oddities this should be a total no-op patch. I tried to fix up all architectures, did fairly extensive grepping for access_ok() uses, and the changes are trivial, but I may have missed something. Any missed conversion should be trivially fixable, though. Signed-off-by: Linus Torvalds <[email protected]>
2018-06-26scsi: core: check for equality of result byte valuesJohannes Thumshirn1-2/+2
When evaluating a SCSI command's result using the field access macros, check for equality of the fields and not if a specific bit is set. This is a preparation patch, for reworking the results field in the SCSI command. Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2017-08-25scsi: Suppress gcc 7 fall-through warnings reported with W=1Bart Van Assche1-1/+3
The conclusion of a recent discussion about the new warnings reported by gcc 7 is that the new warnings reported when building with W=1 should be suppressed. However, gcc 7 still warns about fall-through in switch statements when building with W=1. Suppress these warnings by annotating the SCSI core properly. See also Linus Torvalds, Lots of new warnings with gcc-7.1.1, 11 July 2017 (https://www.mail-archive.com/[email protected]/msg115428.html). References: commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now") Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2017-02-22scsi: make the sense header argument to scsi_test_unit_ready mandatoryChristoph Hellwig1-1/+2
It's a tiny structure that can be allocated on the stack, don't complicate the code by making it optional. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2016-12-24Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds1-1/+1
This was entirely automated, using the script by Al: PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>' sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \ $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h) to do the replacement at the end of the merge window. Requested-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-11-12scsi: return EAGAIN when resetting a device under EHChristoph Hellwig1-1/+1
Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
2014-11-12scsi: split scsi_nonblockable_ioctlChristoph Hellwig1-34/+13
The calling conventions for this function are bad as it could return -ENODEV both for a device not currently online and a not recognized ioctl. Add a new scsi_ioctl_block_when_processing_errors function that wraps scsi_block_when_processing_errors with the a special case for the SG_SCSI_RESET ioctl command, and handle the SG_SCSI_RESET case itself in scsi_ioctl. All callers of scsi_ioctl now must call the above helper to check for the EH state, so that the ioctl handler itself doesn't have to. Reported-by: Robert Elliott <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
2014-11-12scsi: refactor scsi_reset_provider handlingChristoph Hellwig1-32/+1
Pull the common code from the two callers into the function, and rename it to scsi_ioctl_reset. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]>
2014-11-12scsi: use sdev as argument for sense code printingHannes Reinecke1-1/+1
We should be using the standard dev_printk() variants for sense code printing. [hch: remove __scsi_print_sense call in xen-scsiback, Acked by Juergen] [hch: folded bracing fix from Dan Carpenter] Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Robert Elliott <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2014-11-12scsi: add SG_SCSI_RESET_NO_ESCALATE flag to SG_SCSI_RESET ioctlDouglas Gilbert1-7/+13
Further to a January 2013 thread titled: "[PATCH] SG_SCSI_RESET ioctl should only perform requested operation" by Jeremy Linton a patch (v3) is presented that expands the existing ioctl to include "no_escalate" versions to the existing resets. This requires no changes to SCSI low level drivers (LLDs); it adds several more finely tuned reset options to the user space. For example: /* This call remains the same, with the same escalating semantics * if the device (LU) reset fail. That is: on failure to try a * target reset and if that fails, try a bus reset, and if that fails * try a host (i.e. LLD) reset. */ val = SG_SCSI_RESET_DEVICE; res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val); /* What follows is a new option introduced by this patch series. Only * a device reset is attempted. If that fails then an appropriate * error code is provided. N.B. There is no reset escalation. */ val = SG_SCSI_RESET_DEVICE | SG_SCSI_RESET_NO_ESCALATE; res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val); Signed-off-by: Douglas Gilbert <[email protected]> Reviewed-by: Jeremy Linton <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2014-07-17scsi: use dev_printk() variants for ioctlHannes Reinecke1-6/+11
Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
2009-12-04[SCSI] add scsi target reset support to scsi ioctlMike Christie1-0/+3
The scsi ioctl code path was missing scsi target reset support. This patch just adds it. Signed-off-by: Mike Christie <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2009-01-02[SCSI] struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers1-1/+8
[jejb: limit ioctl to returning 20 characters to avoid overrun on long device names and add a few more conversions] Signed-off-by: Kay Sievers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2008-12-29[SCSI] add residual argument to scsi_execute and scsi_execute_reqFUJITA Tomonori1-1/+1
scsi_execute() and scsi_execute_req() discard the residual length information. Some callers need it. This adds residual argument (optional) to scsi_execute and scsi_execute_req. Signed-off-by: FUJITA Tomonori <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2008-12-29[SCSI] scsi ioctl: fix kernel-doc warningRandy Dunlap1-2/+2
Fix kernel-doc parameter warning and correct the function name: Warning(linux-next-20081022//drivers/scsi/scsi_ioctl.c:281): No description found for parameter 'ndelay' Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2008-10-21[PATCH] don't mess with file in scsi_nonblockable_ioctl()Al Viro1-2/+2
Signed-off-by: Al Viro <[email protected]>
2008-10-21[PATCH] switch sg_scsi_ioctl() to passing fmode_tAl Viro1-1/+1
Signed-off-by: Al Viro <[email protected]>
2008-01-11[SCSI] sd,sr: add early detection of medium not presentJames Bottomley1-1/+1
The current scsi_test_unit_ready() is updated to return sense code information (in struct scsi_sense_hdr). The sd and sr drivers are changed to interpret the sense code return asc 0x3a as no media and adjust the device status accordingly. Signed-off-by: James Bottomley <[email protected]>
2008-01-11[SCSI] Add Documentation and integrate into docbook buildRob Landley1-8/+16
Add Documentation/DocBook/scsi_midlayer.tmpl, add to Makefile, and update lots of kerneldoc comments in drivers/scsi/*. Updated with comments from Stefan Richter, Stephen M. Cameron, James Bottomley and Randy Dunlap. Signed-off-by: Rob Landley <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2006-07-28[PATCH] scsi: kill overeager "not-ready" messagesJens Axboe1-4/+1
HAL and friends have a tendency to trigger this one all the time. It's not really interesting, so kill it. The vendor kernels all do anyways. Signed-off-by: Jens Axboe <[email protected]>
2006-06-10[SCSI] remove scsi_request infrastructureChristoph Hellwig1-1/+1
With Achim patch the last user (gdth) is switched away from scsi_request so we an kill it now. Also disables some code in i2o_scsi that was broken since the sg driver stopped using scsi_requests. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2006-04-13[SCSI] unify SCSI_IOCTL_SEND_COMMAND implementationsChristoph Hellwig1-175/+1
We currently have two implementations of this obsolete ioctl, one in the block layer and one in the scsi code. Both of them have drawbacks. This patch kills the scsi layer version after updating the block version with the missing bits: - argument checking - use scatterlist I/O - set number of retries based on the submitted command This is the last user of non-S/G I/O except for the gdth driver, so getting this in ASAP and through the scsi tree would be nie to kill the non-S/G I/O path. Jens, what do you think about adding a check for non-S/G I/O in the midlayer? Thanks to Or Gerlitz for testing this patch. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2006-02-27[SCSI] SCSI core kmalloc2kzallocJes Sorensen1-2/+1
Change the core SCSI code to use kzalloc rather than kmalloc+memset where possible. Signed-off-by: Jes Sorensen <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2005-10-28[SCSI] Fix issue reported by coverity in drivers/scsi/scsi_ioctl.cJayachandran C1-2/+2
This patch attempts to fix an issue found in drivers/scsi/scsi_ioctl.c by Coverity. Error reported: CID: 3437 Checker: FORWARD_NULL (help) File: /export2/p4-coverity/mc2/linux26/drivers/scsi/scsi_ioctl.c Function: scsi_ioctl_send_command Description: Variable "buf" tracked as NULL was passed to a function that dereferences it. Patch description: buf can be NULL if inlen and outlen are both 0. This patch adds check if the length is non-zero before calling copy from/to user. Signed-off-by: Jayachandran C. <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2005-10-28[SCSI] move the mid-layer printk's over to shost/starget/sdev_printkJames Bottomley1-7/+3
This should eliminate (at least in the mid layer) to make numeric assumptions about any of the enumeration variables. As a side effect, it will also make all the messages consistent and line us up nicely for the error logging strategy (if it ever shows itself again). Signed-off-by: James Bottomley <[email protected]>
2005-10-28[PATCH] gfp_t: drivers/scsiAl Viro1-1/+2
Signed-off-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-09-19[SCSI] fix oops on usb storage device disconnectJames Bottomley1-1/+1
We fix the oops by enforcing the host state model. There have also been two extra states added: SHOST_CANCEL_RECOVERY and SHOST_DEL_RECOVERY so we can take the model through host removal while the recovery thread is active. Signed-off-by: James Bottomley <[email protected]>
2005-09-06Merge by hand (conflicts in sd.c)James Bottomley1-9/+9
2005-09-06[SCSI] fix SCSI_IOCTL_PROBE_HOSTChristoph Hellwig1-9/+9
This returns always false with new-style drivers right now. Make it return always true instead, as a host must be present if we are able to call the ioctl (without a host attached there would be no device node to call on..) Signed-off-by: James Bottomley <[email protected]>
2005-08-28[SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API)James Bottomley1-9/+6
This one removes struct scsi_request entirely from sd. In the process, I noticed we have no callers of scsi_wait_req who don't immediately normalise the sense, so I updated the API to make it take a struct scsi_sense_hdr instead of simply a big sense buffer. Signed-off-by: James Bottomley <[email protected]>
2005-08-28[SCSI] convert the remaining mid-layer pieces to scsi_execute_reqJames Bottomley1-30/+16
After this, we just have some drivers, all the ULDs and the SPI transport class using scsi_wait_req(). Signed-off-by: James Bottomley <[email protected]>
2005-07-30[SCSI] host state model update: replace old host bitmap stateMike Anderson1-2/+1
Migrate the current SCSI host state model to a model like SCSI device is using. Signed-off-by: Mike Anderson <[email protected]> Rejections fixed up and Signed-off-by: James Bottomley <[email protected]>
2005-04-18[PATCH] consolidate timeout defintions in scsi.h1-5/+0
Adapted from a patch in SuSE's kernel SRPM. Signed-off-by: James Bottomley <[email protected]>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+516
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!