All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: manish.rangankar@qlogic.com, open-iscsi@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [SCSI] qla4xxx: support iscsiadm session mgmt
Date: Wed, 08 Aug 2012 10:35:44 -0500	[thread overview]
Message-ID: <50228750.3030108@cs.wisc.edu> (raw)
In-Reply-To: <20120808150022.GA3734@mwanda>

On 08/08/2012 10:00 AM, Dan Carpenter wrote:
> I never heard back on this.  This buffer overflow is still present
> in the current code.
> 

Qlogic just sent a patch yesterday.
http://marc.info/?l=linux-scsi&m=134434199930938&w=2

> regards,
> dan carpenter
> 
> On Thu, Jun 14, 2012 at 09:27:45PM +0300, Dan Carpenter wrote:
>> Hi Manish,
>>
>> The patch b3a271a94d00: "[SCSI] qla4xxx: support iscsiadm session 
>> mgmt" from Jul 25, 2011, leads to the following warning:
>> drivers/scsi/qla4xxx/ql4_os.c:4479 qla4xxx_get_ep_fwdb()
>> 	 warn: casting from 16 to 28 bytes
>>
>> (Sort of).
>>
>> drivers/scsi/qla4xxx/ql4_os.c qla4xxx_ep_connect()
>>    705          qla_ep = ep->dd_data;
>>    706          memset(qla_ep, 0, sizeof(struct qla_endpoint));
>>    707          if (dst_addr->sa_family == AF_INET) {
>>    708                  memcpy(&qla_ep->dst_addr, dst_addr, sizeof(struct sockaddr_in));
>>    709                  addr = (struct sockaddr_in *)&qla_ep->dst_addr;
>>    710                  DEBUG2(ql4_printk(KERN_INFO, ha, "%s: %pI4\n", __func__,
>>    711                                    (char *)&addr->sin_addr));
>>    712          } else if (dst_addr->sa_family == AF_INET6) {
>>    713                  memcpy(&qla_ep->dst_addr, dst_addr,
>>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>    714                         sizeof(struct sockaddr_in6));
>>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> Both qla_ep->dst_addr and dst_addr are type struct sockaddr.  We are
>> copying sizeof(struct sockaddr_in6) bytes which is 12 bytes larger.  I
>> don't know the actual size of qla_ep->dst_addr but dst_addr is allocated
>> in qla4xxx_get_ep_fwdb() as a struct sockaddr.  So we are copying past
>> the end of the struct here and it's possibly an information leak or even
>> a memory corruption issue depending on how much space ep->dd_data has.
>>
>>    715                  addr6 = (struct sockaddr_in6 *)&qla_ep->dst_addr;
>>    716                  DEBUG2(ql4_printk(KERN_INFO, ha, "%s: %pI6\n", __func__,
>>    717                                    (char *)&addr6->sin6_addr));
>>    718          }
>>
>> regards,
>> dan carpenter


  reply	other threads:[~2012-08-08 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 18:27 [SCSI] qla4xxx: support iscsiadm session mgmt Dan Carpenter
2012-08-08 15:00 ` Dan Carpenter
2012-08-08 15:35   ` Mike Christie [this message]
2012-08-08 16:57     ` Dan Carpenter
2012-08-09 17:49       ` Michael Christie

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=50228750.3030108@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manish.rangankar@qlogic.com \
    --cc=open-iscsi@googlegroups.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 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.