[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <93db2fcb-7afa-776e-01a1-de928b93e799@nvidia.com>
Date: Thu, 29 Jun 2023 01:04:18 +0000
From: Chaitanya Kulkarni <chaitanyak@...dia.com>
To: Min Li <min15.li@...sung.com>
CC: "axboe@...nel.dk" <axboe@...nel.dk>,
"dlemoal@...nel.org" <dlemoal@...nel.org>,
"hch@....de" <hch@....de>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...nel.org" <stable@...nel.org>,
"willy@...radead.org" <willy@...radead.org>
Subject: Re: [PATCH v3] block: add check that partition length needs to be
aligned with block size
On 6/28/23 10:07, Min Li wrote:
> On Mon, Jun 28, 2023 at 04:48:36PM +0000, Christoph Hellwig wrote:
>> They are long long in the UAPI, which is weird but has been that way
>> for a long time. So I think we need checks for negative values
>> before they are shifted and converted to a sector_t.
> Do you mean that we need to check if p.start and p.length are negative?
>
> Thanks for your reply
>
> Min li
I think so, from include/uapi/linux/blkpg.h:-
/* The data structure for ADD_PARTITION and DEL_PARTITION */
struct blkpg_partition {
long long start; /* starting offset in bytes */
long long length; /* length in bytes */
int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* unused / ignored */
char volname[BLKPG_VOLNAMELTH]; /* unused / ignore */
};
so start and length can take -ve, hence in your patch we need to error
out instead inviting overflow bugs right after or before IS_ALIGNED
check.
-ck
Powered by blists - more mailing lists