--- x/drivers/scsi/scsi_lib.c +++ y/drivers/scsi/scsi_lib.c @@ -1037,6 +1037,7 @@ blk_status_t scsi_alloc_sgtables(struct /* * If sg table allocation fails, requeue request later. */ + cmd->sdb.table.sgl = NULL; if (unlikely(sg_alloc_table_chained(&cmd->sdb.table, nr_segs, cmd->sdb.table.sgl, SCSI_INLINE_SG_CNT))) return BLK_STS_RESOURCE; --- x/block/blk-merge.c +++ y/block/blk-merge.c @@ -455,7 +455,6 @@ static inline struct scatterlist *blk_ne * or the driver would be buggy, so force clear the termination bit * to avoid doing a full sg_init_table() in drivers for each command. */ - sg_unmark_end(*sg); return sg_next(*sg); }