Patch "mmc: block: Check return value of blk_get_request()" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
mmc: block: Check return value of blk_get_request()
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mmc-block-check-return-value-of-blk_get_request.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fb8e456e547ed2c699f64665bd8a3b9bde7b9728Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Tue, 21 Nov 2017 15:42:28 +0200
Subject: mmc: block: Check return value of blk_get_request()
From: Adrian Hunter <[email protected]>
commit fb8e456e547ed2c699f64665bd8a3b9bde7b9728 upstream.
blk_get_request() can fail, always check the return value.
--- drivers/mmc/core/block.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +19 -1
@@ -204,6 +204,10 @@ static ssize_t power_ro_lock_store(struc/* Dispatch locking to the block layer */ req =blk_get_request (mq->queue,REQ_OP_DRV_OUT , __GFP_RECLAIM); +if (IS_ERR (req)) { + count =PTR_ERR (req); + goto out_put; + }req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_BOOT_WP ;blk_execute_rq (mq->queue,NULL , req,0 ); ret =req_to_mmc_queue_req (req)->drv_op_result;
@@ -220,7 +224,7 @@ static ssize_t power_ro_lock_store(strucset_disk_ro (part_md->disk,1 ); } } - +out_put:mmc_blk_put (md);return count; }
@@ -581,6 +585,10 @@ static int mmc_blk_ioctl_cmd(struct mmc_ req =blk_get_request (mq->queue, idata->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN , __GFP_RECLAIM); +if (IS_ERR (req)) { + err =PTR_ERR (req); + goto cmd_done; + } idatas[0 ] = idata;req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_IOCTL ;req_to_mmc_queue_req (req)->drv_op_data = idatas;
@@ -644,6 +652,10 @@ static int mmc_blk_ioctl_multi_cmd(struc req =blk_get_request (mq->queue, idata[0 ]->ic.write_flag ?REQ_OP_DRV_OUT :REQ_OP_DRV_IN , __GFP_RECLAIM); +if (IS_ERR (req)) { + err =PTR_ERR (req); + goto cmd_err; + }req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_IOCTL ;req_to_mmc_queue_req (req)->drv_op_data = idata;req_to_mmc_queue_req (req)->ioc_count = num_of_cmds;
@@ -2315,6 +2327,8 @@ static int mmc_dbg_card_status_get(void/* Ask the block layer about the card status */ req =blk_get_request (mq->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); +if (IS_ERR (req)) +return PTR_ERR (req);req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_GET_CARD_STATUS ;blk_execute_rq (mq->queue,NULL , req,0 ); ret =req_to_mmc_queue_req (req)->drv_op_result;
@@ -2349,6 +2363,10 @@ static int mmc_ext_csd_open(struct inode/* Ask the block layer for the EXT CSD */ req =blk_get_request (mq->queue,REQ_OP_DRV_IN , __GFP_RECLAIM); +if (IS_ERR (req)) { + err =PTR_ERR (req); + goto out_free; + }req_to_mmc_queue_req (req)->drv_op =MMC_DRV_OP_GET_EXT_CSD ;req_to_mmc_queue_req (req)->drv_op_data = &ext_csd;blk_execute_rq (mq->queue,NULL , req,0 );
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/mmc-block-check-return-value-of-blk_get_request.patch queue-4.14/mmc-block-fix-missing-blk_put_request.patch queue-4.14/mmc-block-ensure-that-debugfs-files-are-removed.patch queue-4.14/mmc-core-do-not-leave-the-block-driver-in-a-suspended-state.patch queue-4.14/mmc-sdhci-avoid-swiotlb-buffer-being-full.patch