All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [bug report] staging: lustre: lmv: Error not handled for lmv_find_target
Date: Tue, 7 Feb 2017 15:22:44 +0300	[thread overview]
Message-ID: <20170207122243.GA23469@mwanda> (raw)

Hello Ulka Vaze,

You didn't introduce this warning but you were fixing nearby code so you
might know the answer.

	drivers/staging/lustre/lustre/lmv/lmv_obd.c:1069 lmv_iocontrol()
	warn: check 'reqlen' for integer overflows 'obd_iocontrol()'

drivers/staging/lustre/lustre/lmv/lmv_obd.c
  1056  
  1057                                  /* build a request with fids for this MDS */
  1058                                  reqlen = offsetof(typeof(*hur),
  1059                                                    hur_user_item[nr])
  1060                                           + hur->hur_request.hr_data_len;

It looks like this addition can have an integer overflow bug.

  1061                                  req = libcfs_kvzalloc(reqlen, GFP_NOFS);

Leading to a req that is smaller than necessary.

  1062                                  if (!req)
  1063                                          return -ENOMEM;
  1064  
  1065                                  rc1 = lmv_hsm_req_build(lmv, hur, tgt, req);

Which could be a problem in here.

  1066                                  if (rc1 < 0)
  1067                                          goto hsm_req_err;
  1068  
  1069                                  rc1 = obd_iocontrol(cmd, tgt->ltd_exp, reqlen,
  1070                                                      req, uarg);
  1071  hsm_req_err:
  1072                                  if (rc1 != 0 && rc == 0)
  1073                                          rc = rc1;
  1074                                  kvfree(req);

regards,
dan carpenter

                 reply	other threads:[~2017-02-07 12:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170207122243.GA23469@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=lustre-devel@lists.lustre.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.