[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <F1B567DD-C322-4BA7-BFEA-E7C4B1F82697@kolumbus.fi>
Date: Tue, 17 Dec 2013 19:53:52 +0200
From: "Kai Mäkisara (Kolumbus)"
<kai.makisara@...umbus.fi>
To: xuyongjiande@...il.com
Cc: "James E.J. Bottomley" <JBottomley@...allels.com>,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: [PATCH] scsi: int overflow in st_ioctl()
On 17.12.2013, at 16.43, Yongjian Xu xuyongjiande@...il.com wrote:
> From: Yongjian Xu <xuyongjiande@...il.com>
>
> mtc.mt_count comes from user-space.
> int overflow may occur:
> mtc.mt_count++;
> mtc.mt_count—;
I agree that this is a problem. However, it seems that there is also another problem: the SPACE command uses a 24-bit count field and this overflows far below INT_MAX. Should the count in MTFSF etc. be limited to (2<<24-2)? This would make the checks you suggest unnecessary. (-2 so that the behavior does not depend on whether we are at file mark or not.)
I am a bit hesitant with this suggestion because someone may use count INT_MAX to space to the end of the tape. This probably succeeds now but after the fix it would return an error.
Thanks,
Kai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists