From: Chris Leech <cleech@redhat.com>
To: Lin Ma <linma@zju.edu.cn>
Cc: lduncan@suse.com, michael.christie@oracle.com,
jejb@linux.ibm.com, martin.petersen@oracle.com,
vikas.chaudhary@qlogic.com, JBottomley@parallels.com,
mchan@broadcom.com, benli@broadcom.com, ogerlitz@voltaire.com,
open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] scsi: iscsi: Add length check for nlattr payload
Date: Tue, 25 Jul 2023 10:25:54 -0700 [thread overview]
Message-ID: <ZMAFoszXQ3vwc9It@rhel-developer-toolbox-latest> (raw)
In-Reply-To: <20230725024529.428311-1-linma@zju.edu.cn>
On Tue, Jul 25, 2023 at 10:45:29AM +0800, Lin Ma wrote:
> The current NETLINK_ISCSI netlink parsing loop checks every nlmsg to
> make sure the length is bigger than the sizeof(struct iscsi_uevent) and
> then calls iscsi_if_recv_msg(...).
>
> nlh = nlmsg_hdr(skb);
> if (nlh->nlmsg_len < sizeof(*nlh) + sizeof(*ev) ||
> skb->len < nlh->nlmsg_len) {
> break;
> }
> ...
> err = iscsi_if_recv_msg(skb, nlh, &group);
>
> Hence, in iscsi_if_recv_msg, the nlmsg_data can be safely converted to
> iscsi_uevent as the length is already checked.
>
> However, in the following parsing, the length of nlattr payload is never
> checked before the payload is converted to other data structures in some
> consumers. A bad one for example is function iscsi_set_path(...) who
> converts the payload to type iscsi_path without any checks.
Thank you for doing the code review on this, I think these changes look
good.
Reviewed-by: Chris Leech <cleech@redhat.com>
next prev parent reply other threads:[~2023-07-25 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 2:45 Lin Ma
2023-07-25 17:25 ` Chris Leech [this message]
2023-07-26 1:55 ` Martin K. Petersen
2023-07-31 19:45 ` Martin K. Petersen
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=ZMAFoszXQ3vwc9It@rhel-developer-toolbox-latest \
--to=cleech@redhat.com \
--cc=JBottomley@parallels.com \
--cc=benli@broadcom.com \
--cc=jejb@linux.ibm.com \
--cc=lduncan@suse.com \
--cc=linma@zju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mchan@broadcom.com \
--cc=michael.christie@oracle.com \
--cc=ogerlitz@voltaire.com \
--cc=open-iscsi@googlegroups.com \
--cc=vikas.chaudhary@qlogic.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
all inboxes | Powered by JetHome®