Re: SG_IO ioctl regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 11, 2023 at 08:27:47AM -0700, Keith Busch wrote:
> On Wed, Jan 11, 2023 at 02:38:56PM +0000, Niklas Cassel wrote:
> > It appears that this commit breaks SG_IO ioctl.
> 
> Thanks for the catch. I'll send either a fix or revert today.

The below will fix it. The code was corrupting the ubuf by assuming
iovec type when copying the original iov_iter.

---
diff --git a/block/blk-map.c b/block/blk-map.c
index 4cf83eae9f2e8..f2135e6ee8f62 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -31,7 +31,8 @@ static struct bio_map_data *bio_alloc_map_data(struct iov_iter *data,
 		return NULL;
 	memcpy(bmd->iov, data->iov, sizeof(struct iovec) * data->nr_segs);
 	bmd->iter = *data;
-	bmd->iter.iov = bmd->iov;
+	if (iter_is_iovec(data))
+		bmd->iter.iov = bmd->iov;
 	return bmd;
 }
 
--



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux