Skip to content

Commit

Permalink
mctp: Fix check for dev_hard_header() result
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/1969107

[ Upstream commit 60be976 ]

dev_hard_header() returns the length of the header, so
we need to test for negative errors rather than non-zero.

Fixes: 889b7da ("mctp: Add initial routing framework")
Signed-off-by: Matt Johnston <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
(cherry picked from commit 71d28e5073b817189418ddd694e35e08d1c79cf3)
Signed-off-by: Paolo Pisati <[email protected]>
  • Loading branch information
mkj authored and smb49 committed May 20, 2022
1 parent c2a56e1 commit 54aa036
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/mctp/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static int mctp_route_output(struct mctp_route *route, struct sk_buff *skb)

rc = dev_hard_header(skb, skb->dev, ntohs(skb->protocol),
daddr, skb->dev->dev_addr, skb->len);
if (rc) {
if (rc < 0) {
kfree_skb(skb);
return -EHOSTUNREACH;
}
Expand Down

0 comments on commit 54aa036

Please sign in to comment.