From: Simon Horman <horms@kernel.org>
To: Matt Johnston <matt@codeconstruct.com.au>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Wolfram Sang <wsa@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Dung Cao <dung@os.amperecomputing.com>
Subject: Re: [PATCH net v2] mctp i2c: handle NULL header address
Date: Mon, 21 Oct 2024 12:58:33 +0100 [thread overview]
Message-ID: <20241021115833.GG402847@kernel.org> (raw)
In-Reply-To: <20241021-mctp-i2c-null-dest-v2-1-4503e478517c@codeconstruct.com.au>
On Mon, Oct 21, 2024 at 12:35:26PM +0800, Matt Johnston wrote:
> daddr can be NULL if there is no neighbour table entry present,
> in that case the tx packet should be dropped.
>
> saddr will normally be set by MCTP core, but in case it is NULL it
> should be set to the device address.
>
> Incorrect indent of the function arguments is also fixed.
>
> Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
> Cc: stable@vger.kernel.org
> Reported-by: Dung Cao <dung@os.amperecomputing.com>
> Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
> ---
> Changes in v2:
> - Set saddr to device address if NULL, mention in commit message
> - Fix patch prefix formatting
> - Link to v1: https://lore.kernel.org/r/20241018-mctp-i2c-null-dest-v1-1-ba1ab52966e9@codeconstruct.com.au
> ---
> drivers/net/mctp/mctp-i2c.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
> index 4dc057c121f5d0fb9c9c48bf16b6933ae2f7b2ac..c909254e03c21518c17daf8b813e610558e074c1 100644
> --- a/drivers/net/mctp/mctp-i2c.c
> +++ b/drivers/net/mctp/mctp-i2c.c
> @@ -579,7 +579,7 @@ static void mctp_i2c_flow_release(struct mctp_i2c_dev *midev)
>
> static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
> unsigned short type, const void *daddr,
> - const void *saddr, unsigned int len)
> + const void *saddr, unsigned int len)
> {
> struct mctp_i2c_hdr *hdr;
> struct mctp_hdr *mhdr;
Hi Matt,
I think you should drop this hunk.
While it's nice to clean things up, in the context of other work [1],
this isn't really appropriate as part of a fix for net.
[1] https://docs.kernel.org/process/maintainer-netdev.html#clean-up-patches
> @@ -588,8 +588,15 @@ static int mctp_i2c_header_create(struct sk_buff *skb, struct net_device *dev,
> if (len > MCTP_I2C_MAXMTU)
> return -EMSGSIZE;
>
> - lldst = *((u8 *)daddr);
> - llsrc = *((u8 *)saddr);
> + if (daddr)
> + lldst = *((u8 *)daddr);
> + else
> + return -EINVAL;
> +
> + if (saddr)
> + llsrc = *((u8 *)saddr);
> + else
> + llsrc = dev->dev_addr;
This last line doesn't seem right, as llsrc is a u8,
while dev->dev_addr is a pointer to unsigned char.
>
> skb_push(skb, sizeof(struct mctp_i2c_hdr));
> skb_reset_mac_header(skb);
--
pw-bot: changes-requested
next prev parent reply other threads:[~2024-10-21 11:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 4:35 [PATCH net v2] mctp i2c: handle NULL header address Matt Johnston
2024-10-21 11:58 ` Simon Horman [this message]
2024-10-21 22:32 ` kernel test robot
2024-10-22 0:04 ` kernel test robot
2024-10-22 3:11 ` kernel test robot
2024-10-22 9:52 ` kernel test robot
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=20241021115833.GG402847@kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dung@os.amperecomputing.com \
--cc=edumazet@google.com \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=wsa@kernel.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 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).