linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Chen <chyyuu@gmail.com>
To: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi>
Cc: 徐永健 <xuyongjiande@gmail.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: int overflow in st_ioctl()
Date: Wed, 18 Dec 2013 12:00:20 +0800	[thread overview]
Message-ID: <CAAdffVH3pPpvu+GWwikPpGynTRRMW2unbyRvP2jQWpUU-=R6qw@mail.gmail.com> (raw)
In-Reply-To: <F1B567DD-C322-4BA7-BFEA-E7C4B1F82697@kolumbus.fi>

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@kolumbus.fi>:
> On 17.12.2013, at 16.43, Yongjian Xu xuyongjiande@gmail.com wrote:
>
>> From: Yongjian Xu <xuyongjiande@gmail.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@vger.kernel.org
> 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@tsinghua.edu.cn  chyyuu@gmail.com
==============================================

      reply	other threads:[~2013-12-18  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1387291383-25126-1-git-send-email-xuyongjiande@gmail.com>
2013-12-17 17:53 ` [PATCH] scsi: int overflow in st_ioctl() "Kai Mäkisara (Kolumbus)"
2013-12-18  4:00   ` Yu Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAdffVH3pPpvu+GWwikPpGynTRRMW2unbyRvP2jQWpUU-=R6qw@mail.gmail.com' \
    --to=chyyuu@gmail.com \
    --cc=JBottomley@parallels.com \
    --cc=kai.makisara@kolumbus.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=xuyongjiande@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).