Re: [PATCH] scsi: int overflow in st_ioctl()

From: Yu Chen
Date: Tue Dec 17 2013 - 23:00:25 EST


Because the local variable of st_int_ioctl function, such as long ltmp
be assigned by arg.
I think we should limit the parameter arg of st_int_ioctl function to
the range of 24-bit signed integer.
Yong Jianxu, please update your patch.

2013/12/18 "Kai Mäkisara (Kolumbus)" <kai.makisara@xxxxxxxxxxx>:
> On 17.12.2013, at 16.43, Yongjian Xu xuyongjiande@xxxxxxxxx wrote:
>
>> From: Yongjian Xu <xuyongjiande@xxxxxxxxx>
>>
>> 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@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
Best Regards
==============================================
Yu Chen
Ph.D. Associate Professor
System Software&Software Engineering Group,
Dept. of Computer Science and Technology
Tsinghua University, Beijing 100084, P.R. China
E-Mail: mailto:yuchen@xxxxxxxxxxxxxxx chyyuu@xxxxxxxxx
==============================================
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/