From: Sasha Levin Date: Mon, 6 Jul 2020 03:38:56 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.4.230~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26154d7af29fb17372ee79594b00edade04abbef;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/cxgb4-fix-endian-conversions-for-l4-ports-in-filters.patch b/queue-5.4/cxgb4-fix-endian-conversions-for-l4-ports-in-filters.patch new file mode 100644 index 00000000000..4e290cf5d1b --- /dev/null +++ b/queue-5.4/cxgb4-fix-endian-conversions-for-l4-ports-in-filters.patch @@ -0,0 +1,163 @@ +From 5fad405802efef463bd87c57dde9ddd6d374f72a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:35 +0530 +Subject: cxgb4: fix endian conversions for L4 ports in filters + +From: Rahul Lakkireddy + +[ Upstream commit 63b53b0b99cd5f2d9754a21eda2ed8e706646cc9 ] + +The source and destination L4 ports in filter offload need to be +in CPU endian. They will finally be converted to Big Endian after +all operations are done and before giving them to hardware. The +L4 ports for NAT are expected to be passed as a byte stream TCB. +So, treat them as such. + +Fixes following sparse warnings in several places: +cxgb4_tc_flower.c:159:33: warning: cast from restricted __be16 +cxgb4_tc_flower.c:159:33: warning: incorrect type in argument 1 (different +base types) +cxgb4_tc_flower.c:159:33: expected unsigned short [usertype] val +cxgb4_tc_flower.c:159:33: got restricted __be16 [usertype] dst + +Fixes: dca4faeb812f ("cxgb4: Add LE hash collision bug fix path in LLD driver") +Fixes: 62488e4b53ae ("cxgb4: add basic tc flower offload support") +Fixes: 557ccbf9dfa8 ("cxgb4: add tc flower support for L3/L4 rewrite") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 15 +++++++--- + .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- + .../ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 30 +++++++------------ + 3 files changed, 22 insertions(+), 25 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +index 43b0f8c57da7f..8a67a04a5bbc6 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +@@ -165,6 +165,9 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f, + unsigned int tid, bool dip, bool sip, bool dp, + bool sp) + { ++ u8 *nat_lp = (u8 *)&f->fs.nat_lport; ++ u8 *nat_fp = (u8 *)&f->fs.nat_fport; ++ + if (dip) { + if (f->fs.type) { + set_tcb_field(adap, f, tid, TCB_SND_UNA_RAW_W, +@@ -236,8 +239,9 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f, + } + + set_tcb_field(adap, f, tid, TCB_PDU_HDR_LEN_W, WORD_MASK, +- (dp ? f->fs.nat_lport : 0) | +- (sp ? f->fs.nat_fport << 16 : 0), 1); ++ (dp ? (nat_lp[1] | nat_lp[0] << 8) : 0) | ++ (sp ? (nat_fp[1] << 16 | nat_fp[0] << 24) : 0), ++ 1); + } + + /* Validate filter spec against configuration done on the card. */ +@@ -656,6 +660,9 @@ int set_filter_wr(struct adapter *adapter, int fidx) + fwr->fpm = htons(f->fs.mask.fport); + + if (adapter->params.filter2_wr_support) { ++ u8 *nat_lp = (u8 *)&f->fs.nat_lport; ++ u8 *nat_fp = (u8 *)&f->fs.nat_fport; ++ + fwr->natmode_to_ulp_type = + FW_FILTER2_WR_ULP_TYPE_V(f->fs.nat_mode ? + ULP_MODE_TCPDDP : +@@ -663,8 +670,8 @@ int set_filter_wr(struct adapter *adapter, int fidx) + FW_FILTER2_WR_NATMODE_V(f->fs.nat_mode); + memcpy(fwr->newlip, f->fs.nat_lip, sizeof(fwr->newlip)); + memcpy(fwr->newfip, f->fs.nat_fip, sizeof(fwr->newfip)); +- fwr->newlport = htons(f->fs.nat_lport); +- fwr->newfport = htons(f->fs.nat_fport); ++ fwr->newlport = htons(nat_lp[1] | nat_lp[0] << 8); ++ fwr->newfport = htons(nat_fp[1] | nat_fp[0] << 8); + } + + /* Mark the filter as "pending" and ship off the Filter Work Request. +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +index 069a518478850..deb1c1f301078 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +@@ -2504,7 +2504,7 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, + + /* Clear out filter specifications */ + memset(&f->fs, 0, sizeof(struct ch_filter_specification)); +- f->fs.val.lport = cpu_to_be16(sport); ++ f->fs.val.lport = be16_to_cpu(sport); + f->fs.mask.lport = ~0; + val = (u8 *)&sip; + if ((val[0] | val[1] | val[2] | val[3]) != 0) { +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +index e447976bdd3e0..16a939f9b04d5 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +@@ -58,10 +58,6 @@ static struct ch_tc_pedit_fields pedits[] = { + PEDIT_FIELDS(IP6_, DST_63_32, 4, nat_lip, 4), + PEDIT_FIELDS(IP6_, DST_95_64, 4, nat_lip, 8), + PEDIT_FIELDS(IP6_, DST_127_96, 4, nat_lip, 12), +- PEDIT_FIELDS(TCP_, SPORT, 2, nat_fport, 0), +- PEDIT_FIELDS(TCP_, DPORT, 2, nat_lport, 0), +- PEDIT_FIELDS(UDP_, SPORT, 2, nat_fport, 0), +- PEDIT_FIELDS(UDP_, DPORT, 2, nat_lport, 0), + }; + + static struct ch_tc_flower_entry *allocate_flower_entry(void) +@@ -156,14 +152,14 @@ static void cxgb4_process_flow_match(struct net_device *dev, + struct flow_match_ports match; + + flow_rule_match_ports(rule, &match); +- fs->val.lport = cpu_to_be16(match.key->dst); +- fs->mask.lport = cpu_to_be16(match.mask->dst); +- fs->val.fport = cpu_to_be16(match.key->src); +- fs->mask.fport = cpu_to_be16(match.mask->src); ++ fs->val.lport = be16_to_cpu(match.key->dst); ++ fs->mask.lport = be16_to_cpu(match.mask->dst); ++ fs->val.fport = be16_to_cpu(match.key->src); ++ fs->mask.fport = be16_to_cpu(match.mask->src); + + /* also initialize nat_lport/fport to same values */ +- fs->nat_lport = cpu_to_be16(match.key->dst); +- fs->nat_fport = cpu_to_be16(match.key->src); ++ fs->nat_lport = fs->val.lport; ++ fs->nat_fport = fs->val.fport; + } + + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_IP)) { +@@ -354,12 +350,9 @@ static void process_pedit_field(struct ch_filter_specification *fs, u32 val, + switch (offset) { + case PEDIT_TCP_SPORT_DPORT: + if (~mask & PEDIT_TCP_UDP_SPORT_MASK) +- offload_pedit(fs, cpu_to_be32(val) >> 16, +- cpu_to_be32(mask) >> 16, +- TCP_SPORT); ++ fs->nat_fport = val; + else +- offload_pedit(fs, cpu_to_be32(val), +- cpu_to_be32(mask), TCP_DPORT); ++ fs->nat_lport = val >> 16; + } + fs->nat_mode = NAT_MODE_ALL; + break; +@@ -367,12 +360,9 @@ static void process_pedit_field(struct ch_filter_specification *fs, u32 val, + switch (offset) { + case PEDIT_UDP_SPORT_DPORT: + if (~mask & PEDIT_TCP_UDP_SPORT_MASK) +- offload_pedit(fs, cpu_to_be32(val) >> 16, +- cpu_to_be32(mask) >> 16, +- UDP_SPORT); ++ fs->nat_fport = val; + else +- offload_pedit(fs, cpu_to_be32(val), +- cpu_to_be32(mask), UDP_DPORT); ++ fs->nat_lport = val >> 16; + } + fs->nat_mode = NAT_MODE_ALL; + } +-- +2.25.1 + diff --git a/queue-5.4/cxgb4-fix-sge-queue-dump-destination-buffer-context.patch b/queue-5.4/cxgb4-fix-sge-queue-dump-destination-buffer-context.patch new file mode 100644 index 00000000000..6e20a7944b6 --- /dev/null +++ b/queue-5.4/cxgb4-fix-sge-queue-dump-destination-buffer-context.patch @@ -0,0 +1,54 @@ +From e295faf3ad5badb73b106d262703253ee163d31e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:37 +0530 +Subject: cxgb4: fix SGE queue dump destination buffer context + +From: Rahul Lakkireddy + +[ Upstream commit 1992ded5d111997877a9a25205976d8d03c46814 ] + +The data in destination buffer is expected to be be parsed in big +endian. So, use the right context. + +Fixes following sparse warning: +cudbg_lib.c:2041:44: warning: incorrect type in assignment (different +base types) +cudbg_lib.c:2041:44: expected unsigned long long [usertype] +cudbg_lib.c:2041:44: got restricted __be64 [usertype] + +Fixes: 736c3b94474e ("cxgb4: collect egress and ingress SGE queue contexts") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +index 7bcdce182ee5c..e26ae298a080a 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +@@ -1980,7 +1980,6 @@ int cudbg_collect_dump_context(struct cudbg_init *pdbg_init, + u8 mem_type[CTXT_INGRESS + 1] = { 0 }; + struct cudbg_buffer temp_buff = { 0 }; + struct cudbg_ch_cntxt *buff; +- u64 *dst_off, *src_off; + u8 *ctx_buf; + u8 i, k; + int rc; +@@ -2049,8 +2048,11 @@ int cudbg_collect_dump_context(struct cudbg_init *pdbg_init, + } + + for (j = 0; j < max_ctx_qid; j++) { ++ __be64 *dst_off; ++ u64 *src_off; ++ + src_off = (u64 *)(ctx_buf + j * SGE_CTXT_SIZE); +- dst_off = (u64 *)buff->data; ++ dst_off = (__be64 *)buff->data; + + /* The data is stored in 64-bit cpu order. Convert it + * to big endian before parsing. +-- +2.25.1 + diff --git a/queue-5.4/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch b/queue-5.4/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch new file mode 100644 index 00000000000..f9ad61614a2 --- /dev/null +++ b/queue-5.4/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch @@ -0,0 +1,348 @@ +From 689dac3caca16f897895f0eee500453d0245d37f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:34 +0530 +Subject: cxgb4: parse TC-U32 key values and masks natively + +From: Rahul Lakkireddy + +[ Upstream commit 27f78cb245abdb86735529c13b0a579f57829e71 ] + +TC-U32 passes all keys values and masks in __be32 format. The parser +already expects this and hence pass the value and masks in __be32 +natively to the parser. + +Fixes following sparse warnings in several places: +cxgb4_tc_u32.c:57:21: warning: incorrect type in assignment (different base +types) +cxgb4_tc_u32.c:57:21: expected unsigned int [usertype] val +cxgb4_tc_u32.c:57:21: got restricted __be32 [usertype] val +cxgb4_tc_u32_parse.h:48:24: warning: cast to restricted __be32 + +Fixes: 2e8aad7bf203 ("cxgb4: add parser to translate u32 filters to internal spec") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 18 +-- + .../chelsio/cxgb4/cxgb4_tc_u32_parse.h | 122 ++++++++++++------ + 2 files changed, 91 insertions(+), 49 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +index 02fc63fa7f256..b3a342561a968 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +@@ -47,7 +47,7 @@ static int fill_match_fields(struct adapter *adap, + bool next_header) + { + unsigned int i, j; +- u32 val, mask; ++ __be32 val, mask; + int off, err; + bool found; + +@@ -216,7 +216,7 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + const struct cxgb4_next_header *next; + bool found = false; + unsigned int i, j; +- u32 val, mask; ++ __be32 val, mask; + int off; + + if (t->table[link_uhtid - 1].link_handle) { +@@ -230,10 +230,10 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + + /* Try to find matches that allow jumps to next header. */ + for (i = 0; next[i].jump; i++) { +- if (next[i].offoff != cls->knode.sel->offoff || +- next[i].shift != cls->knode.sel->offshift || +- next[i].mask != cls->knode.sel->offmask || +- next[i].offset != cls->knode.sel->off) ++ if (next[i].sel.offoff != cls->knode.sel->offoff || ++ next[i].sel.offshift != cls->knode.sel->offshift || ++ next[i].sel.offmask != cls->knode.sel->offmask || ++ next[i].sel.off != cls->knode.sel->off) + continue; + + /* Found a possible candidate. Find a key that +@@ -245,9 +245,9 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + val = cls->knode.sel->keys[j].val; + mask = cls->knode.sel->keys[j].mask; + +- if (next[i].match_off == off && +- next[i].match_val == val && +- next[i].match_mask == mask) { ++ if (next[i].key.off == off && ++ next[i].key.val == val && ++ next[i].key.mask == mask) { + found = true; + break; + } +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h +index a4b99edcc3399..141085e159e57 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h +@@ -38,12 +38,12 @@ + struct cxgb4_match_field { + int off; /* Offset from the beginning of the header to match */ + /* Fill the value/mask pair in the spec if matched */ +- int (*val)(struct ch_filter_specification *f, u32 val, u32 mask); ++ int (*val)(struct ch_filter_specification *f, __be32 val, __be32 mask); + }; + + /* IPv4 match fields */ + static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.tos = (ntohl(val) >> 16) & 0x000000FF; + f->mask.tos = (ntohl(mask) >> 16) & 0x000000FF; +@@ -52,7 +52,7 @@ static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + u32 mask_val; + u8 frag_val; +@@ -74,7 +74,7 @@ static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.proto = (ntohl(val) >> 16) & 0x000000FF; + f->mask.proto = (ntohl(mask) >> 16) & 0x000000FF; +@@ -83,7 +83,7 @@ static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[0], &val, sizeof(u32)); + memcpy(&f->mask.fip[0], &mask, sizeof(u32)); +@@ -92,7 +92,7 @@ static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_dst_ip(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[0], &val, sizeof(u32)); + memcpy(&f->mask.lip[0], &mask, sizeof(u32)); +@@ -111,7 +111,7 @@ static const struct cxgb4_match_field cxgb4_ipv4_fields[] = { + + /* IPv6 match fields */ + static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.tos = (ntohl(val) >> 20) & 0x000000FF; + f->mask.tos = (ntohl(mask) >> 20) & 0x000000FF; +@@ -120,7 +120,7 @@ static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.proto = (ntohl(val) >> 8) & 0x000000FF; + f->mask.proto = (ntohl(mask) >> 8) & 0x000000FF; +@@ -129,7 +129,7 @@ static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[0], &val, sizeof(u32)); + memcpy(&f->mask.fip[0], &mask, sizeof(u32)); +@@ -138,7 +138,7 @@ static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[4], &val, sizeof(u32)); + memcpy(&f->mask.fip[4], &mask, sizeof(u32)); +@@ -147,7 +147,7 @@ static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[8], &val, sizeof(u32)); + memcpy(&f->mask.fip[8], &mask, sizeof(u32)); +@@ -156,7 +156,7 @@ static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[12], &val, sizeof(u32)); + memcpy(&f->mask.fip[12], &mask, sizeof(u32)); +@@ -165,7 +165,7 @@ static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[0], &val, sizeof(u32)); + memcpy(&f->mask.lip[0], &mask, sizeof(u32)); +@@ -174,7 +174,7 @@ static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[4], &val, sizeof(u32)); + memcpy(&f->mask.lip[4], &mask, sizeof(u32)); +@@ -183,7 +183,7 @@ static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[8], &val, sizeof(u32)); + memcpy(&f->mask.lip[8], &mask, sizeof(u32)); +@@ -192,7 +192,7 @@ static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip3(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[12], &val, sizeof(u32)); + memcpy(&f->mask.lip[12], &mask, sizeof(u32)); +@@ -216,7 +216,7 @@ static const struct cxgb4_match_field cxgb4_ipv6_fields[] = { + + /* TCP/UDP match */ + static inline int cxgb4_fill_l4_ports(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.fport = ntohl(val) >> 16; + f->mask.fport = ntohl(mask) >> 16; +@@ -237,19 +237,13 @@ static const struct cxgb4_match_field cxgb4_udp_fields[] = { + }; + + struct cxgb4_next_header { +- unsigned int offset; /* Offset to next header */ +- /* offset, shift, and mask added to offset above ++ /* Offset, shift, and mask added to beginning of the header + * to get to next header. Useful when using a header + * field's value to jump to next header such as IHL field + * in IPv4 header. + */ +- unsigned int offoff; +- u32 shift; +- u32 mask; +- /* match criteria to make this jump */ +- unsigned int match_off; +- u32 match_val; +- u32 match_mask; ++ struct tc_u32_sel sel; ++ struct tc_u32_key key; + /* location of jump to make */ + const struct cxgb4_match_field *jump; + }; +@@ -258,26 +252,74 @@ struct cxgb4_next_header { + * IPv4 header. + */ + static const struct cxgb4_next_header cxgb4_ipv4_jumps[] = { +- { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF, +- .match_off = 8, .match_val = 0x600, .match_mask = 0xFF00, +- .jump = cxgb4_tcp_fields }, +- { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF, +- .match_off = 8, .match_val = 0x1100, .match_mask = 0xFF00, +- .jump = cxgb4_udp_fields }, +- { .jump = NULL } ++ { ++ /* TCP Jump */ ++ .sel = { ++ .off = 0, ++ .offoff = 0, ++ .offshift = 6, ++ .offmask = cpu_to_be16(0x0f00), ++ }, ++ .key = { ++ .off = 8, ++ .val = cpu_to_be32(0x00060000), ++ .mask = cpu_to_be32(0x00ff0000), ++ }, ++ .jump = cxgb4_tcp_fields, ++ }, ++ { ++ /* UDP Jump */ ++ .sel = { ++ .off = 0, ++ .offoff = 0, ++ .offshift = 6, ++ .offmask = cpu_to_be16(0x0f00), ++ }, ++ .key = { ++ .off = 8, ++ .val = cpu_to_be32(0x00110000), ++ .mask = cpu_to_be32(0x00ff0000), ++ }, ++ .jump = cxgb4_udp_fields, ++ }, ++ { .jump = NULL }, + }; + + /* Accept a rule with a jump directly past the 40 Bytes of IPv6 fixed header + * to get to transport layer header. + */ + static const struct cxgb4_next_header cxgb4_ipv6_jumps[] = { +- { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0, +- .match_off = 4, .match_val = 0x60000, .match_mask = 0xFF0000, +- .jump = cxgb4_tcp_fields }, +- { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0, +- .match_off = 4, .match_val = 0x110000, .match_mask = 0xFF0000, +- .jump = cxgb4_udp_fields }, +- { .jump = NULL } ++ { ++ /* TCP Jump */ ++ .sel = { ++ .off = 40, ++ .offoff = 0, ++ .offshift = 0, ++ .offmask = 0, ++ }, ++ .key = { ++ .off = 4, ++ .val = cpu_to_be32(0x00000600), ++ .mask = cpu_to_be32(0x0000ff00), ++ }, ++ .jump = cxgb4_tcp_fields, ++ }, ++ { ++ /* UDP Jump */ ++ .sel = { ++ .off = 40, ++ .offoff = 0, ++ .offshift = 0, ++ .offmask = 0, ++ }, ++ .key = { ++ .off = 4, ++ .val = cpu_to_be32(0x00001100), ++ .mask = cpu_to_be32(0x0000ff00), ++ }, ++ .jump = cxgb4_udp_fields, ++ }, ++ { .jump = NULL }, + }; + + struct cxgb4_link { +-- +2.25.1 + diff --git a/queue-5.4/cxgb4-use-correct-type-for-all-mask-ip-address-compa.patch b/queue-5.4/cxgb4-use-correct-type-for-all-mask-ip-address-compa.patch new file mode 100644 index 00000000000..ba97c09a05c --- /dev/null +++ b/queue-5.4/cxgb4-use-correct-type-for-all-mask-ip-address-compa.patch @@ -0,0 +1,56 @@ +From ee89bab137524d783f0e4453b5d82e36e273b20d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:36 +0530 +Subject: cxgb4: use correct type for all-mask IP address comparison + +From: Rahul Lakkireddy + +[ Upstream commit f286dd8eaad5a2758750f407ab079298e0bcc8a5 ] + +Use correct type to check for all-mask exact match IP addresses. + +Fixes following sparse warnings due to big endian value checks +against 0xffffffff in is_addr_all_mask(): +cxgb4_filter.c:977:25: warning: restricted __be32 degrades to integer +cxgb4_filter.c:983:37: warning: restricted __be32 degrades to integer +cxgb4_filter.c:984:37: warning: restricted __be32 degrades to integer +cxgb4_filter.c:985:37: warning: restricted __be32 degrades to integer +cxgb4_filter.c:986:37: warning: restricted __be32 degrades to integer + +Fixes: 3eb8b62d5a26 ("cxgb4: add support to create hash-filters via tc-flower offload") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +index 8a67a04a5bbc6..375e1be6a2d8d 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +@@ -839,16 +839,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family) + struct in_addr *addr; + + addr = (struct in_addr *)ipmask; +- if (addr->s_addr == 0xffffffff) ++ if (ntohl(addr->s_addr) == 0xffffffff) + return true; + } else if (family == AF_INET6) { + struct in6_addr *addr6; + + addr6 = (struct in6_addr *)ipmask; +- if (addr6->s6_addr32[0] == 0xffffffff && +- addr6->s6_addr32[1] == 0xffffffff && +- addr6->s6_addr32[2] == 0xffffffff && +- addr6->s6_addr32[3] == 0xffffffff) ++ if (ntohl(addr6->s6_addr32[0]) == 0xffffffff && ++ ntohl(addr6->s6_addr32[1]) == 0xffffffff && ++ ntohl(addr6->s6_addr32[2]) == 0xffffffff && ++ ntohl(addr6->s6_addr32[3]) == 0xffffffff) + return true; + } + return false; +-- +2.25.1 + diff --git a/queue-5.4/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch b/queue-5.4/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch new file mode 100644 index 00000000000..a8dc601687e --- /dev/null +++ b/queue-5.4/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch @@ -0,0 +1,39 @@ +From ecd27880c5c33d8a82459bc2bbc6d968b430763d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:33 +0530 +Subject: cxgb4: use unaligned conversion for fetching timestamp + +From: Rahul Lakkireddy + +[ Upstream commit 589b1c9c166dce120e27b32a83a78f55464a7ef9 ] + +Use get_unaligned_be64() to fetch the timestamp needed for ns_to_ktime() +conversion. + +Fixes following sparse warning: +sge.c:3282:43: warning: cast to restricted __be64 + +Fixes: a456950445a0 ("cxgb4: time stamping interface for PTP") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/sge.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c +index 3a45ac8f0e011..506170fe3a8b7 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -2816,7 +2816,7 @@ static noinline int t4_systim_to_hwstamp(struct adapter *adapter, + + hwtstamps = skb_hwtstamps(skb); + memset(hwtstamps, 0, sizeof(*hwtstamps)); +- hwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*((u64 *)data))); ++ hwtstamps->hwtstamp = ns_to_ktime(get_unaligned_be64(data)); + + return RX_PTP_PKT_SUC; + } +-- +2.25.1 + diff --git a/queue-5.4/drm-msm-dpu-fix-error-return-code-in-dpu_encoder_ini.patch b/queue-5.4/drm-msm-dpu-fix-error-return-code-in-dpu_encoder_ini.patch new file mode 100644 index 00000000000..b356559646e --- /dev/null +++ b/queue-5.4/drm-msm-dpu-fix-error-return-code-in-dpu_encoder_ini.patch @@ -0,0 +1,36 @@ +From addc1dc5c2346d7dcc888565553ecfe81fb13e30 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 8 Jun 2020 09:48:59 +0800 +Subject: drm/msm/dpu: fix error return code in dpu_encoder_init + +From: Chen Tao + +[ Upstream commit aa472721c8dbe1713cf510f56ffbc56ae9e14247 ] + +Fix to return negative error code -ENOMEM with the use of +ERR_PTR from dpu_encoder_init. + +Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") +Signed-off-by: Chen Tao +Signed-off-by: Rob Clark +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +index d82ea994063fa..edf7989d7a8ee 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c ++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +@@ -2232,7 +2232,7 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev, + + dpu_enc = devm_kzalloc(dev->dev, sizeof(*dpu_enc), GFP_KERNEL); + if (!dpu_enc) +- return ERR_PTR(ENOMEM); ++ return ERR_PTR(-ENOMEM); + + rc = drm_encoder_init(dev, &dpu_enc->base, &dpu_encoder_funcs, + drm_enc_mode, NULL); +-- +2.25.1 + diff --git a/queue-5.4/drm-sun4i-hdmi-remove-extra-hpd-polling.patch b/queue-5.4/drm-sun4i-hdmi-remove-extra-hpd-polling.patch new file mode 100644 index 00000000000..eac43bee893 --- /dev/null +++ b/queue-5.4/drm-sun4i-hdmi-remove-extra-hpd-polling.patch @@ -0,0 +1,50 @@ +From 8ed42dc83396fac3c66a19eb58e7f928e5c3b170 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jun 2020 14:00:32 +0800 +Subject: drm: sun4i: hdmi: Remove extra HPD polling + +From: Chen-Yu Tsai + +[ Upstream commit bda8eaa6dee7525f4dac950810a85a88bf6c2ba0 ] + +The HPD sense mechanism in Allwinner's old HDMI encoder hardware is more +or less an input-only GPIO. Other GPIO-based HPD implementations +directly return the current state, instead of polling for a specific +state and returning the other if that times out. + +Remove the I/O polling from sun4i_hdmi_connector_detect() and directly +return a known state based on the current reading. This also gets rid +of excessive CPU usage by kworker as reported on Stack Exchange [1] and +Armbian forums [2]. + + [1] https://superuser.com/questions/1515001/debian-10-buster-on-cubietruck-with-bug-in-sun4i-drm-hdmi + [2] https://forum.armbian.com/topic/14282-headless-systems-and-sun4i_drm_hdmi-a10a20/ + +Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20200629060032.24134-1-wens@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +index 9c3bdfd203373..63b4de81686ac 100644 +--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c ++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +@@ -262,9 +262,8 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); + unsigned long reg; + +- if (readl_poll_timeout(hdmi->base + SUN4I_HDMI_HPD_REG, reg, +- reg & SUN4I_HDMI_HPD_HIGH, +- 0, 500000)) { ++ reg = readl(hdmi->base + SUN4I_HDMI_HPD_REG); ++ if (reg & SUN4I_HDMI_HPD_HIGH) { + cec_phys_addr_invalidate(hdmi->cec_adap); + return connector_status_disconnected; + } +-- +2.25.1 + diff --git a/queue-5.4/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch b/queue-5.4/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch new file mode 100644 index 00000000000..be7e77178c2 --- /dev/null +++ b/queue-5.4/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch @@ -0,0 +1,47 @@ +From 0b1dbb3b4592d5a31a730bcd20e884d5e8377076 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jun 2020 13:32:42 +0900 +Subject: hwmon: (acpi_power_meter) Fix potential memory leak in + acpi_power_meter_add() + +From: Misono Tomohiro + +[ Upstream commit 8b97f9922211c44a739c5cbd9502ecbb9f17f6d1 ] + +Although it rarely happens, we should call free_capabilities() +if error happens after read_capabilities() to free allocated strings. + +Fixes: de584afa5e188 ("hwmon driver for ACPI 4.0 power meters") +Signed-off-by: Misono Tomohiro +Link: https://lore.kernel.org/r/20200625043242.31175-1-misono.tomohiro@jp.fujitsu.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/acpi_power_meter.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c +index 4cf25458f0b95..740ac0a1b7265 100644 +--- a/drivers/hwmon/acpi_power_meter.c ++++ b/drivers/hwmon/acpi_power_meter.c +@@ -883,7 +883,7 @@ static int acpi_power_meter_add(struct acpi_device *device) + + res = setup_attrs(resource); + if (res) +- goto exit_free; ++ goto exit_free_capability; + + resource->hwmon_dev = hwmon_device_register(&device->dev); + if (IS_ERR(resource->hwmon_dev)) { +@@ -896,6 +896,8 @@ static int acpi_power_meter_add(struct acpi_device *device) + + exit_remove: + remove_attrs(resource); ++exit_free_capability: ++ free_capabilities(resource); + exit_free: + kfree(resource); + exit: +-- +2.25.1 + diff --git a/queue-5.4/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch b/queue-5.4/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch new file mode 100644 index 00000000000..0ea2ff681ae --- /dev/null +++ b/queue-5.4/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch @@ -0,0 +1,67 @@ +From 87c846fd63e1cb606dffb9e48a8bb6090e025ff2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Jun 2020 22:13:08 +0000 +Subject: hwmon: (max6697) Make sure the OVERT mask is set correctly + +From: Chu Lin + +[ Upstream commit 016983d138cbe99a5c0aaae0103ee88f5300beb3 ] + +Per the datasheet for max6697, OVERT mask and ALERT mask are different. +For example, the 7th bit of OVERT is the local channel but for alert +mask, the 6th bit is the local channel. Therefore, we can't apply the +same mask for both registers. In addition to that, the max6697 driver +is supposed to be compatibale with different models. I manually went over +all the listed chips and made sure all chip types have the same layout. + +Testing; + mask value of 0x9 should map to 0x44 for ALERT and 0x84 for OVERT. + I used iotool to read the reg value back to verify. I only tested this + change on max6581. + +Reference: +https://datasheets.maximintegrated.com/en/ds/MAX6581.pdf +https://datasheets.maximintegrated.com/en/ds/MAX6697.pdf +https://datasheets.maximintegrated.com/en/ds/MAX6699.pdf + +Signed-off-by: Chu Lin +Fixes: 5372d2d71c46e ("hwmon: Driver for Maxim MAX6697 and compatibles") +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/max6697.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c +index 743752a2467a2..64122eb38060d 100644 +--- a/drivers/hwmon/max6697.c ++++ b/drivers/hwmon/max6697.c +@@ -38,8 +38,9 @@ static const u8 MAX6697_REG_CRIT[] = { + * Map device tree / platform data register bit map to chip bit map. + * Applies to alert register and over-temperature register. + */ +-#define MAX6697_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \ ++#define MAX6697_ALERT_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \ + (((reg) & 0x01) << 6) | ((reg) & 0x80)) ++#define MAX6697_OVERT_MAP_BITS(reg) (((reg) >> 1) | (((reg) & 0x01) << 7)) + + #define MAX6697_REG_STAT(n) (0x44 + (n)) + +@@ -562,12 +563,12 @@ static int max6697_init_chip(struct max6697_data *data, + return ret; + + ret = i2c_smbus_write_byte_data(client, MAX6697_REG_ALERT_MASK, +- MAX6697_MAP_BITS(pdata->alert_mask)); ++ MAX6697_ALERT_MAP_BITS(pdata->alert_mask)); + if (ret < 0) + return ret; + + ret = i2c_smbus_write_byte_data(client, MAX6697_REG_OVERT_MASK, +- MAX6697_MAP_BITS(pdata->over_temperature_mask)); ++ MAX6697_OVERT_MAP_BITS(pdata->over_temperature_mask)); + if (ret < 0) + return ret; + +-- +2.25.1 + diff --git a/queue-5.4/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch b/queue-5.4/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch new file mode 100644 index 00000000000..6f3d98e3e84 --- /dev/null +++ b/queue-5.4/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch @@ -0,0 +1,43 @@ +From 1f576608d39ade71f371301cfae7c813480082c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jul 2020 10:39:11 +1200 +Subject: i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665 + +From: Chris Packham + +[ Upstream commit cd217f2300793a106b49c7dfcbfb26e348bc7593 ] + +The PCA9665 datasheet says that I2CSTA = 78h indicates that SCL is stuck +low, this differs to the PCA9564 which uses 90h for this indication. +Treat either 0x78 or 0x90 as an indication that the SCL line is stuck. + +Based on looking through the PCA9564 and PCA9665 datasheets this should +be safe for both chips. The PCA9564 should not return 0x78 for any valid +state and the PCA9665 should not return 0x90. + +Fixes: eff9ec95efaa ("i2c-algo-pca: Add PCA9665 support") +Signed-off-by: Chris Packham +Reviewed-by: Andy Shevchenko +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/algos/i2c-algo-pca.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c +index 5ac93f41bfecf..8ea850eed18f7 100644 +--- a/drivers/i2c/algos/i2c-algo-pca.c ++++ b/drivers/i2c/algos/i2c-algo-pca.c +@@ -314,7 +314,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, + DEB2("BUS ERROR - SDA Stuck low\n"); + pca_reset(adap); + goto out; +- case 0x90: /* Bus error - SCL stuck low */ ++ case 0x78: /* Bus error - SCL stuck low (PCA9665) */ ++ case 0x90: /* Bus error - SCL stuck low (PCA9564) */ + DEB2("BUS ERROR - SCL Stuck low\n"); + pca_reset(adap); + goto out; +-- +2.25.1 + diff --git a/queue-5.4/i2c-mlxcpld-check-correct-size-of-maximum-recv_len-p.patch b/queue-5.4/i2c-mlxcpld-check-correct-size-of-maximum-recv_len-p.patch new file mode 100644 index 00000000000..a3eecaf5540 --- /dev/null +++ b/queue-5.4/i2c-mlxcpld-check-correct-size-of-maximum-recv_len-p.patch @@ -0,0 +1,42 @@ +From cc7ce3ef271098127ab7e7d39327a4ea7ef0672a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 28 Jun 2020 13:52:44 +0200 +Subject: i2c: mlxcpld: check correct size of maximum RECV_LEN packet + +From: Wolfram Sang + +[ Upstream commit 597911287fcd13c3a4b4aa3e0a52b33d431e0a8e ] + +I2C_SMBUS_BLOCK_MAX defines already the maximum number as defined in the +SMBus 2.0 specs. I don't see a reason to add 1 here. Also, fix the errno +to what is suggested for this error. + +Fixes: c9bfdc7c16cb ("i2c: mlxcpld: Add support for smbus block read transaction") +Signed-off-by: Wolfram Sang +Reviewed-by: Michael Shych +Tested-by: Michael Shych +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-mlxcpld.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c +index 2fd717d8dd30e..71d7bae2cbcad 100644 +--- a/drivers/i2c/busses/i2c-mlxcpld.c ++++ b/drivers/i2c/busses/i2c-mlxcpld.c +@@ -337,9 +337,9 @@ static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv) + if (priv->smbus_block && (val & MLXCPLD_I2C_SMBUS_BLK_BIT)) { + mlxcpld_i2c_read_comm(priv, MLXCPLD_LPCI2C_NUM_DAT_REG, + &datalen, 1); +- if (unlikely(datalen > (I2C_SMBUS_BLOCK_MAX + 1))) { ++ if (unlikely(datalen > I2C_SMBUS_BLOCK_MAX)) { + dev_err(priv->dev, "Incorrect smbus block read message len\n"); +- return -E2BIG; ++ return -EPROTO; + } + } else { + datalen = priv->xfer.data_len; +-- +2.25.1 + diff --git a/queue-5.4/kthread-save-thread-function.patch b/queue-5.4/kthread-save-thread-function.patch new file mode 100644 index 00000000000..f11a4dd5469 --- /dev/null +++ b/queue-5.4/kthread-save-thread-function.patch @@ -0,0 +1,89 @@ +From 8fc259ae3d756536fe0d3d5a105f8b5ff860dbc9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 May 2020 12:09:34 -0400 +Subject: kthread: save thread function + +From: J. Bruce Fields + +[ Upstream commit 52782c92ac85c4e393eb4a903a62e6c24afa633f ] + +It's handy to keep the kthread_fn just as a unique cookie to identify +classes of kthreads. E.g. if you can verify that a given task is +running your thread_fn, then you may know what sort of type kthread_data +points to. + +We'll use this in nfsd to pass some information into the vfs. Note it +will need kthread_data() exported too. + +Original-patch-by: Tejun Heo +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + include/linux/kthread.h | 1 + + kernel/kthread.c | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/include/linux/kthread.h b/include/linux/kthread.h +index 0f9da966934e2..59bbc63ff8637 100644 +--- a/include/linux/kthread.h ++++ b/include/linux/kthread.h +@@ -57,6 +57,7 @@ bool kthread_should_stop(void); + bool kthread_should_park(void); + bool __kthread_should_park(struct task_struct *k); + bool kthread_freezable_should_stop(bool *was_frozen); ++void *kthread_func(struct task_struct *k); + void *kthread_data(struct task_struct *k); + void *kthread_probe_data(struct task_struct *k); + int kthread_park(struct task_struct *k); +diff --git a/kernel/kthread.c b/kernel/kthread.c +index b262f47046ca4..543dff6b576c7 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -46,6 +46,7 @@ struct kthread_create_info + struct kthread { + unsigned long flags; + unsigned int cpu; ++ int (*threadfn)(void *); + void *data; + struct completion parked; + struct completion exited; +@@ -152,6 +153,20 @@ bool kthread_freezable_should_stop(bool *was_frozen) + } + EXPORT_SYMBOL_GPL(kthread_freezable_should_stop); + ++/** ++ * kthread_func - return the function specified on kthread creation ++ * @task: kthread task in question ++ * ++ * Returns NULL if the task is not a kthread. ++ */ ++void *kthread_func(struct task_struct *task) ++{ ++ if (task->flags & PF_KTHREAD) ++ return to_kthread(task)->threadfn; ++ return NULL; ++} ++EXPORT_SYMBOL_GPL(kthread_func); ++ + /** + * kthread_data - return data value specified on kthread creation + * @task: kthread task in question +@@ -164,6 +179,7 @@ void *kthread_data(struct task_struct *task) + { + return to_kthread(task)->data; + } ++EXPORT_SYMBOL_GPL(kthread_data); + + /** + * kthread_probe_data - speculative version of kthread_data() +@@ -237,6 +253,7 @@ static int kthread(void *_create) + do_exit(-ENOMEM); + } + ++ self->threadfn = threadfn; + self->data = data; + init_completion(&self->exited); + init_completion(&self->parked); +-- +2.25.1 + diff --git a/queue-5.4/nfsd-clients-don-t-need-to-break-their-own-delegatio.patch b/queue-5.4/nfsd-clients-don-t-need-to-break-their-own-delegatio.patch new file mode 100644 index 00000000000..7951037a96c --- /dev/null +++ b/queue-5.4/nfsd-clients-don-t-need-to-break-their-own-delegatio.patch @@ -0,0 +1,187 @@ +From aaa9f6e532dc34b60ba7390a9d6d9c3dd22759a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jul 2017 16:35:15 -0400 +Subject: nfsd: clients don't need to break their own delegations + +From: J. Bruce Fields + +[ Upstream commit 28df3d1539de5090f7916f6fff03891b67f366f4 ] + +We currently revoke read delegations on any write open or any operation +that modifies file data or metadata (including rename, link, and +unlink). But if the delegation in question is the only read delegation +and is held by the client performing the operation, that's not really +necessary. + +It's not always possible to prevent this in the NFSv4.0 case, because +there's not always a way to determine which client an NFSv4.0 delegation +came from. (In theory we could try to guess this from the transport +layer, e.g., by assuming all traffic on a given TCP connection comes +from the same client. But that's not really correct.) + +In the NFSv4.1 case the session layer always tells us the client. + +This patch should remove such self-conflicts in all cases where we can +reliably determine the client from the compound. + +To do that we need to track "who" is performing a given (possibly +lease-breaking) file operation. We're doing that by storing the +information in the svc_rqst and using kthread_data() to map the current +task back to a svc_rqst. + +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + Documentation/filesystems/locking.rst | 2 ++ + fs/locks.c | 3 +++ + fs/nfsd/nfs4proc.c | 2 ++ + fs/nfsd/nfs4state.c | 14 ++++++++++++++ + fs/nfsd/nfsd.h | 2 ++ + fs/nfsd/nfssvc.c | 6 ++++++ + include/linux/fs.h | 1 + + include/linux/sunrpc/svc.h | 1 + + 8 files changed, 31 insertions(+) + +diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst +index fc3a0704553cf..b5f8d15a30fb7 100644 +--- a/Documentation/filesystems/locking.rst ++++ b/Documentation/filesystems/locking.rst +@@ -425,6 +425,7 @@ prototypes:: + int (*lm_grant)(struct file_lock *, struct file_lock *, int); + void (*lm_break)(struct file_lock *); /* break_lease callback */ + int (*lm_change)(struct file_lock **, int); ++ bool (*lm_breaker_owns_lease)(struct file_lock *); + + locking rules: + +@@ -435,6 +436,7 @@ lm_notify: yes yes no + lm_grant: no no no + lm_break: yes no no + lm_change yes no no ++lm_breaker_owns_lease: no no no + ========== ============= ================= ========= + + buffer_head +diff --git a/fs/locks.c b/fs/locks.c +index b8a31c1c4fff3..a3f186846e93e 100644 +--- a/fs/locks.c ++++ b/fs/locks.c +@@ -1557,6 +1557,9 @@ static bool leases_conflict(struct file_lock *lease, struct file_lock *breaker) + { + bool rc; + ++ if (lease->fl_lmops->lm_breaker_owns_lease ++ && lease->fl_lmops->lm_breaker_owns_lease(lease)) ++ return false; + if ((breaker->fl_flags & FL_LAYOUT) != (lease->fl_flags & FL_LAYOUT)) { + rc = false; + goto trace; +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c +index 4798667af647c..96fa2837d3cfb 100644 +--- a/fs/nfsd/nfs4proc.c ++++ b/fs/nfsd/nfs4proc.c +@@ -1961,6 +1961,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) + goto encode_op; + } + ++ rqstp->rq_lease_breaker = (void **)&cstate->clp; ++ + trace_nfsd_compound(rqstp, args->opcnt); + while (!status && resp->opcnt < args->opcnt) { + op = &args->ops[resp->opcnt++]; +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index 8650a97e2ba96..1e8f5e281bb53 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -4464,6 +4464,19 @@ nfsd_break_deleg_cb(struct file_lock *fl) + return ret; + } + ++static bool nfsd_breaker_owns_lease(struct file_lock *fl) ++{ ++ struct nfs4_delegation *dl = fl->fl_owner; ++ struct svc_rqst *rqst; ++ struct nfs4_client *clp; ++ ++ if (!i_am_nfsd()) ++ return NULL; ++ rqst = kthread_data(current); ++ clp = *(rqst->rq_lease_breaker); ++ return dl->dl_stid.sc_client == clp; ++} ++ + static int + nfsd_change_deleg_cb(struct file_lock *onlist, int arg, + struct list_head *dispose) +@@ -4475,6 +4488,7 @@ nfsd_change_deleg_cb(struct file_lock *onlist, int arg, + } + + static const struct lock_manager_operations nfsd_lease_mng_ops = { ++ .lm_breaker_owns_lease = nfsd_breaker_owns_lease, + .lm_break = nfsd_break_deleg_cb, + .lm_change = nfsd_change_deleg_cb, + }; +diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h +index af2947551e9ce..7a835fb7d79f7 100644 +--- a/fs/nfsd/nfsd.h ++++ b/fs/nfsd/nfsd.h +@@ -87,6 +87,8 @@ int nfsd_pool_stats_release(struct inode *, struct file *); + + void nfsd_destroy(struct net *net); + ++bool i_am_nfsd(void); ++ + struct nfsdfs_client { + struct kref cl_ref; + void (*cl_release)(struct kref *kref); +diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c +index e8bee8ff30c59..cb7f0aa9a3b05 100644 +--- a/fs/nfsd/nfssvc.c ++++ b/fs/nfsd/nfssvc.c +@@ -590,6 +590,11 @@ static const struct svc_serv_ops nfsd_thread_sv_ops = { + .svo_module = THIS_MODULE, + }; + ++bool i_am_nfsd() ++{ ++ return kthread_func(current) == nfsd; ++} ++ + int nfsd_create_serv(struct net *net) + { + int error; +@@ -997,6 +1002,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) + *statp = rpc_garbage_args; + return 1; + } ++ rqstp->rq_lease_breaker = NULL; + /* + * Give the xdr decoder a chance to change this if it wants + * (necessary in the NFSv4.0 compound case) +diff --git a/include/linux/fs.h b/include/linux/fs.h +index 5bd384dbdca58..4b5b7667405d8 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -1040,6 +1040,7 @@ struct lock_manager_operations { + bool (*lm_break)(struct file_lock *); + int (*lm_change)(struct file_lock *, int, struct list_head *); + void (*lm_setup)(struct file_lock *, void **); ++ bool (*lm_breaker_owns_lease)(struct file_lock *); + }; + + struct lock_manager { +diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h +index 1afe38eb33f7e..ab6e12d9fcf61 100644 +--- a/include/linux/sunrpc/svc.h ++++ b/include/linux/sunrpc/svc.h +@@ -299,6 +299,7 @@ struct svc_rqst { + struct net *rq_bc_net; /* pointer to backchannel's + * net namespace + */ ++ void ** rq_lease_breaker; /* The v4 client breaking a lease */ + }; + + #define SVC_NET(rqst) (rqst->rq_xprt ? rqst->rq_xprt->xpt_net : rqst->rq_bc_net) +-- +2.25.1 + diff --git a/queue-5.4/nfsd-fix-nfsdfs-inode-reference-count-leak.patch b/queue-5.4/nfsd-fix-nfsdfs-inode-reference-count-leak.patch new file mode 100644 index 00000000000..9ad4ecd932c --- /dev/null +++ b/queue-5.4/nfsd-fix-nfsdfs-inode-reference-count-leak.patch @@ -0,0 +1,35 @@ +From dee322430621cba03ecafd792bcdb7e9b6588e00 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Jun 2020 21:01:19 -0400 +Subject: nfsd: fix nfsdfs inode reference count leak + +From: J. Bruce Fields + +[ Upstream commit bf2654017e0268cc83dc88d56f0e67ff4406631d ] + +I don't understand this code well, but I'm seeing a warning about a +still-referenced inode on unmount, and every other similar filesystem +does a dput() here. + +Fixes: e8a79fb14f6b ("nfsd: add nfsd/clients directory") +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfsctl.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c +index 596ed6a42022d..be418fccc9d86 100644 +--- a/fs/nfsd/nfsctl.c ++++ b/fs/nfsd/nfsctl.c +@@ -1335,6 +1335,7 @@ void nfsd_client_rmdir(struct dentry *dentry) + WARN_ON_ONCE(ret); + fsnotify_rmdir(dir, dentry); + d_delete(dentry); ++ dput(dentry); + inode_unlock(dir); + } + +-- +2.25.1 + diff --git a/queue-5.4/nfsd4-fix-nfsdfs-reference-count-loop.patch b/queue-5.4/nfsd4-fix-nfsdfs-reference-count-loop.patch new file mode 100644 index 00000000000..62b6bb5cca2 --- /dev/null +++ b/queue-5.4/nfsd4-fix-nfsdfs-reference-count-loop.patch @@ -0,0 +1,132 @@ +From 848447bfd70b752f41e622c3bd211e657c662f01 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Jun 2020 16:00:33 -0400 +Subject: nfsd4: fix nfsdfs reference count loop + +From: J. Bruce Fields + +[ Upstream commit 681370f4b00af0fcc65bbfb9f82de526ab7ceb0a ] + +We don't drop the reference on the nfsdfs filesystem with +mntput(nn->nfsd_mnt) until nfsd_exit_net(), but that won't be called +until the nfsd module's unloaded, and we can't unload the module as long +as there's a reference on nfsdfs. So this prevents module unloading. + +Fixes: 2c830dd7209b ("nfsd: persist nfsd filesystem across mounts") +Reported-and-Tested-by: Luo Xiaogang +Signed-off-by: J. Bruce Fields +Signed-off-by: Sasha Levin +--- + fs/nfsd/nfs4state.c | 8 +++++++- + fs/nfsd/nfsctl.c | 22 ++++++++++++---------- + fs/nfsd/nfsd.h | 3 +++ + 3 files changed, 22 insertions(+), 11 deletions(-) + +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c +index 1e8f5e281bb53..fa3dcaa82572e 100644 +--- a/fs/nfsd/nfs4state.c ++++ b/fs/nfsd/nfs4state.c +@@ -7719,9 +7719,14 @@ nfs4_state_start_net(struct net *net) + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + int ret; + +- ret = nfs4_state_create_net(net); ++ ret = get_nfsdfs(net); + if (ret) + return ret; ++ ret = nfs4_state_create_net(net); ++ if (ret) { ++ mntput(nn->nfsd_mnt); ++ return ret; ++ } + locks_start_grace(net, &nn->nfsd4_manager); + nfsd4_client_tracking_init(net); + if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0) +@@ -7790,6 +7795,7 @@ nfs4_state_shutdown_net(struct net *net) + + nfsd4_client_tracking_exit(net); + nfs4_state_destroy_net(net); ++ mntput(nn->nfsd_mnt); + } + + void +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c +index 159feae6af8ba..596ed6a42022d 100644 +--- a/fs/nfsd/nfsctl.c ++++ b/fs/nfsd/nfsctl.c +@@ -1424,6 +1424,18 @@ static struct file_system_type nfsd_fs_type = { + }; + MODULE_ALIAS_FS("nfsd"); + ++int get_nfsdfs(struct net *net) ++{ ++ struct nfsd_net *nn = net_generic(net, nfsd_net_id); ++ struct vfsmount *mnt; ++ ++ mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL); ++ if (IS_ERR(mnt)) ++ return PTR_ERR(mnt); ++ nn->nfsd_mnt = mnt; ++ return 0; ++} ++ + #ifdef CONFIG_PROC_FS + static int create_proc_exports_entry(void) + { +@@ -1452,7 +1464,6 @@ unsigned int nfsd_net_id; + static __net_init int nfsd_init_net(struct net *net) + { + int retval; +- struct vfsmount *mnt; + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + + retval = nfsd_export_init(net); +@@ -1479,16 +1490,8 @@ static __net_init int nfsd_init_net(struct net *net) + init_waitqueue_head(&nn->ntf_wq); + seqlock_init(&nn->boot_lock); + +- mnt = vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL); +- if (IS_ERR(mnt)) { +- retval = PTR_ERR(mnt); +- goto out_mount_err; +- } +- nn->nfsd_mnt = mnt; + return 0; + +-out_mount_err: +- nfsd_reply_cache_shutdown(nn); + out_drc_error: + nfsd_idmap_shutdown(net); + out_idmap_error: +@@ -1501,7 +1504,6 @@ static __net_exit void nfsd_exit_net(struct net *net) + { + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + +- mntput(nn->nfsd_mnt); + nfsd_reply_cache_shutdown(nn); + nfsd_idmap_shutdown(net); + nfsd_export_shutdown(net); +diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h +index 7a835fb7d79f7..65097324b42a0 100644 +--- a/fs/nfsd/nfsd.h ++++ b/fs/nfsd/nfsd.h +@@ -89,6 +89,8 @@ void nfsd_destroy(struct net *net); + + bool i_am_nfsd(void); + ++int get_nfsdfs(struct net *); ++ + struct nfsdfs_client { + struct kref cl_ref; + void (*cl_release)(struct kref *kref); +@@ -99,6 +101,7 @@ struct dentry *nfsd_client_mkdir(struct nfsd_net *nn, + struct nfsdfs_client *ncl, u32 id, const struct tree_descr *); + void nfsd_client_rmdir(struct dentry *dentry); + ++ + #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) + #ifdef CONFIG_NFSD_V2_ACL + extern const struct svc_version nfsd_acl_version2; +-- +2.25.1 + diff --git a/queue-5.4/nvme-fix-a-crash-in-nvme_mpath_add_disk.patch b/queue-5.4/nvme-fix-a-crash-in-nvme_mpath_add_disk.patch new file mode 100644 index 00000000000..4ba3e7d9fe2 --- /dev/null +++ b/queue-5.4/nvme-fix-a-crash-in-nvme_mpath_add_disk.patch @@ -0,0 +1,44 @@ +From 479b0b27eca03272a2685b6773fe612accafe2f3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jun 2020 16:30:19 +0200 +Subject: nvme: fix a crash in nvme_mpath_add_disk + +From: Christoph Hellwig + +[ Upstream commit 72d447113bb751ded97b2e2c38f886e4a4139082 ] + +For private namespaces ns->head_disk is NULL, so add a NULL check +before updating the BDI capabilities. + +Fixes: b2ce4d90690b ("nvme-multipath: set bdi capabilities once") +Reported-by: Avinash M N +Signed-off-by: Christoph Hellwig +Reviewed-by: Sagi Grimberg +Reviewed-by: Max Gurtovoy +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/multipath.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c +index e1eeed5856570..5433aa2f76017 100644 +--- a/drivers/nvme/host/multipath.c ++++ b/drivers/nvme/host/multipath.c +@@ -673,10 +673,11 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) + } + + if (bdi_cap_stable_pages_required(ns->queue->backing_dev_info)) { +- struct backing_dev_info *info = +- ns->head->disk->queue->backing_dev_info; ++ struct gendisk *disk = ns->head->disk; + +- info->capabilities |= BDI_CAP_STABLE_WRITES; ++ if (disk) ++ disk->queue->backing_dev_info->capabilities |= ++ BDI_CAP_STABLE_WRITES; + } + } + +-- +2.25.1 + diff --git a/queue-5.4/nvme-fix-identify-error-status-silent-ignore.patch b/queue-5.4/nvme-fix-identify-error-status-silent-ignore.patch new file mode 100644 index 00000000000..77b0ad466bb --- /dev/null +++ b/queue-5.4/nvme-fix-identify-error-status-silent-ignore.patch @@ -0,0 +1,55 @@ +From d30d80007f08f3b807c9ec0bc6035638543cb4a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Jun 2020 10:46:29 -0700 +Subject: nvme: fix identify error status silent ignore + +From: Sagi Grimberg + +[ Upstream commit ea43d9709f727e728e933a8157a7a7ca1a868281 ] + +Commit 59c7c3caaaf8 intended to only silently ignore non retry-able +errors (DNR bit set) such that we can still identify misbehaving +controllers, and in the other hand propagate retry-able errors (DNR bit +cleared) so we don't wrongly abandon a namespace just because it happens +to be temporarily inaccessible. + +The goal remains the same as the original commit where this was +introduced but unfortunately had the logic backwards. + +Fixes: 59c7c3caaaf8 ("nvme: fix possible hang when ns scanning fails during error recovery") +Reported-by: Keith Busch +Signed-off-by: Sagi Grimberg +Reviewed-by: Keith Busch +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index c44c00b9e1d85..d423515547237 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -1088,10 +1088,16 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, unsigned nsid, + dev_warn(ctrl->device, + "Identify Descriptors failed (%d)\n", status); + /* +- * Don't treat an error as fatal, as we potentially already +- * have a NGUID or EUI-64. ++ * Don't treat non-retryable errors as fatal, as we potentially ++ * already have a NGUID or EUI-64. If we failed with DNR set, ++ * we want to silently ignore the error as we can still ++ * identify the device, but if the status has DNR set, we want ++ * to propagate the error back specifically for the disk ++ * revalidation flow to make sure we don't abandon the ++ * device just because of a temporal retry-able error (such ++ * as path of transport errors). + */ +- if (status > 0 && !(status & NVME_SC_DNR)) ++ if (status > 0 && (status & NVME_SC_DNR)) + status = 0; + goto free_data; + } +-- +2.25.1 + diff --git a/queue-5.4/rdma-counter-query-a-counter-before-release.patch b/queue-5.4/rdma-counter-query-a-counter-before-release.patch new file mode 100644 index 00000000000..a865775821e --- /dev/null +++ b/queue-5.4/rdma-counter-query-a-counter-before-release.patch @@ -0,0 +1,49 @@ +From c325e7d7126370019f889fc5110646acfc2235f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 21 Jun 2020 14:00:00 +0300 +Subject: RDMA/counter: Query a counter before release + +From: Mark Zhang + +[ Upstream commit c1d869d64a1955817c4d6fff08ecbbe8e59d36f8 ] + +Query a dynamically-allocated counter before release it, to update it's +hwcounters and log all of them into history data. Otherwise all values of +these hwcounters will be lost. + +Fixes: f34a55e497e8 ("RDMA/core: Get sum value of all counters when perform a sysfs stat read") +Link: https://lore.kernel.org/r/20200621110000.56059-1-leon@kernel.org +Signed-off-by: Mark Zhang +Reviewed-by: Maor Gottlieb +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/core/counters.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c +index 46dd50ff7c85a..11210bf7fd61b 100644 +--- a/drivers/infiniband/core/counters.c ++++ b/drivers/infiniband/core/counters.c +@@ -195,7 +195,7 @@ static int __rdma_counter_unbind_qp(struct ib_qp *qp) + return ret; + } + +-static void counter_history_stat_update(const struct rdma_counter *counter) ++static void counter_history_stat_update(struct rdma_counter *counter) + { + struct ib_device *dev = counter->device; + struct rdma_port_counter *port_counter; +@@ -205,6 +205,8 @@ static void counter_history_stat_update(const struct rdma_counter *counter) + if (!port_counter->hstats) + return; + ++ rdma_counter_query_stats(counter); ++ + for (i = 0; i < counter->stats->num_counters; i++) + port_counter->hstats->value[i] += counter->stats->value[i]; + } +-- +2.25.1 + diff --git a/queue-5.4/rxrpc-fix-afs-large-storage-transmission-performance.patch b/queue-5.4/rxrpc-fix-afs-large-storage-transmission-performance.patch new file mode 100644 index 00000000000..a12a20b645c --- /dev/null +++ b/queue-5.4/rxrpc-fix-afs-large-storage-transmission-performance.patch @@ -0,0 +1,46 @@ +From 3c98d3011a5c949b80cedfec52cfa3836223c456 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 17 Jun 2020 15:46:33 +0100 +Subject: rxrpc: Fix afs large storage transmission performance drop + +From: David Howells + +[ Upstream commit 02c28dffb13abbaaedece1e4a6493b48ad3f913a ] + +Commit 2ad6691d988c, which moved the modification of the status annotation +for a packet in the Tx buffer prior to the retransmission moved the state +clearance, but managed to lose the bit that set it to UNACK. + +Consequently, if a retransmission occurs, the packet is accidentally +changed to the ACK state (ie. 0) by masking it off, which means that the +packet isn't counted towards the tally of newly-ACK'd packets if it gets +hard-ACK'd. This then prevents the congestion control algorithm from +recovering properly. + +Fix by reinstating the change of state to UNACK. + +Spotted by the generic/460 xfstest. + +Fixes: 2ad6691d988c ("rxrpc: Fix race between incoming ACK parser and retransmitter") +Signed-off-by: David Howells +Signed-off-by: Sasha Levin +--- + net/rxrpc/call_event.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c +index 985fb89202d0c..9ff85ee8337cd 100644 +--- a/net/rxrpc/call_event.c ++++ b/net/rxrpc/call_event.c +@@ -253,7 +253,7 @@ static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j) + * confuse things + */ + annotation &= ~RXRPC_TX_ANNO_MASK; +- annotation |= RXRPC_TX_ANNO_RESENT; ++ annotation |= RXRPC_TX_ANNO_UNACK | RXRPC_TX_ANNO_RESENT; + call->rxtx_annotations[ix] = annotation; + + skb = call->rxtx_buffer[ix]; +-- +2.25.1 + diff --git a/queue-5.4/samples-vfs-avoid-warning-in-statx-override.patch b/queue-5.4/samples-vfs-avoid-warning-in-statx-override.patch new file mode 100644 index 00000000000..9bb953d1953 --- /dev/null +++ b/queue-5.4/samples-vfs-avoid-warning-in-statx-override.patch @@ -0,0 +1,61 @@ +From 946f059665a06cf4ef0e68b8c468de460137f9fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jul 2020 15:15:21 -0700 +Subject: samples/vfs: avoid warning in statx override + +From: Kees Cook + +[ Upstream commit c3eeaae9fd736b7f2afbda8d3cbb1cbae06decf3 ] + +Something changed recently to uncover this warning: + + samples/vfs/test-statx.c:24:15: warning: `struct foo' declared inside parameter list will not be visible outside of this definition or declaration + 24 | #define statx foo + | ^~~ + +Which is due the use of "struct statx" (here, "struct foo") in a function +prototype argument list before it has been defined: + + int + # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" + foo + # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4 + (int __dirfd, const char *__restrict __path, int __flags, + unsigned int __mask, struct + # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" + foo + # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4 + *__restrict __buf) + __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 5))); + +Add explicit struct before #include to avoid warning. + +Fixes: f1b5618e013a ("vfs: Add a sample program for the new mount API") +Signed-off-by: Kees Cook +Signed-off-by: Andrew Morton +Cc: Miklos Szeredi +Cc: Al Viro +Cc: David Howells +Link: http://lkml.kernel.org/r/202006282213.C516EA6@keescook +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + samples/vfs/test-statx.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/samples/vfs/test-statx.c b/samples/vfs/test-statx.c +index a3d68159fb510..507f09c38b49f 100644 +--- a/samples/vfs/test-statx.c ++++ b/samples/vfs/test-statx.c +@@ -23,6 +23,8 @@ + #include + #define statx foo + #define statx_timestamp foo_timestamp ++struct statx; ++struct statx_timestamp; + #include + #undef statx + #undef statx_timestamp +-- +2.25.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 0b1b3e82777..ea4c6d196a4 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -20,3 +20,27 @@ tpm_tis-remove-the-hid-ifx0102.patch selftests-tpm-use-bin-sh-instead-of-bin-bash.patch tpm-fix-tis-locality-timeout-problems.patch crypto-af_alg-fix-use-after-free-in-af_alg_accept-due-to-bh_lock_sock.patch +drm-msm-dpu-fix-error-return-code-in-dpu_encoder_ini.patch +rxrpc-fix-afs-large-storage-transmission-performance.patch +rdma-counter-query-a-counter-before-release.patch +cxgb4-use-unaligned-conversion-for-fetching-timestam.patch +cxgb4-parse-tc-u32-key-values-and-masks-natively.patch +cxgb4-fix-endian-conversions-for-l4-ports-in-filters.patch +cxgb4-use-correct-type-for-all-mask-ip-address-compa.patch +cxgb4-fix-sge-queue-dump-destination-buffer-context.patch +hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch +hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch +thermal-drivers-mediatek-fix-bank-number-settings-on.patch +thermal-drivers-rcar_gen3-fix-undefined-temperature-.patch +kthread-save-thread-function.patch +nfsd-clients-don-t-need-to-break-their-own-delegatio.patch +nfsd4-fix-nfsdfs-reference-count-loop.patch +nfsd-fix-nfsdfs-inode-reference-count-leak.patch +drm-sun4i-hdmi-remove-extra-hpd-polling.patch +virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch +smb3-honor-posix-flag-for-multiuser-mounts.patch +nvme-fix-identify-error-status-silent-ignore.patch +nvme-fix-a-crash-in-nvme_mpath_add_disk.patch +samples-vfs-avoid-warning-in-statx-override.patch +i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch +i2c-mlxcpld-check-correct-size-of-maximum-recv_len-p.patch diff --git a/queue-5.4/smb3-honor-posix-flag-for-multiuser-mounts.patch b/queue-5.4/smb3-honor-posix-flag-for-multiuser-mounts.patch new file mode 100644 index 00000000000..ec0867a51b8 --- /dev/null +++ b/queue-5.4/smb3-honor-posix-flag-for-multiuser-mounts.patch @@ -0,0 +1,51 @@ +From b4ed0faadb46906ad311b2853fc5abfbe41f05a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 26 Jun 2020 12:58:09 -0700 +Subject: SMB3: Honor 'posix' flag for multiuser mounts + +From: Paul Aurich + +[ Upstream commit 5391b8e1b7b7e5cfa2dd4ffdc4b8c6b64dfd1866 ] + +The flag from the primary tcon needs to be copied into the volume info +so that cifs_get_tcon will try to enable extensions on the per-user +tcon. At that point, since posix extensions must have already been +enabled on the superblock, don't try to needlessly adjust the mount +flags. + +Fixes: ce558b0e17f8 ("smb3: Add posix create context for smb3.11 posix mounts") +Fixes: b326614ea215 ("smb3: allow "posix" mount option to enable new SMB311 protocol extensions") +Signed-off-by: Paul Aurich +Signed-off-by: Steve French +Reviewed-by: Aurelien Aptel +Signed-off-by: Sasha Levin +--- + fs/cifs/connect.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 947c4aad5d6a4..134a90dc72322 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -5282,6 +5282,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) + vol_info->nohandlecache = master_tcon->nohandlecache; + vol_info->local_lease = master_tcon->local_lease; + vol_info->no_linux_ext = !master_tcon->unix_ext; ++ vol_info->linux_ext = master_tcon->posix_extensions; + vol_info->sectype = master_tcon->ses->sectype; + vol_info->sign = master_tcon->ses->sign; + +@@ -5309,10 +5310,6 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) + goto out; + } + +- /* if new SMB3.11 POSIX extensions are supported do not remap / and \ */ +- if (tcon->posix_extensions) +- cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS; +- + if (cap_unix(ses)) + reset_cifs_unix_caps(0, tcon, NULL, vol_info); + +-- +2.25.1 + diff --git a/queue-5.4/thermal-drivers-mediatek-fix-bank-number-settings-on.patch b/queue-5.4/thermal-drivers-mediatek-fix-bank-number-settings-on.patch new file mode 100644 index 00000000000..61bd0d90d9e --- /dev/null +++ b/queue-5.4/thermal-drivers-mediatek-fix-bank-number-settings-on.patch @@ -0,0 +1,48 @@ +From c7a119647c0955ebb6e6129f4262feba13b073f7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Mar 2020 20:15:35 +0800 +Subject: thermal/drivers/mediatek: Fix bank number settings on mt8183 + +From: Michael Kao + +[ Upstream commit 14533a5a6c12e8d7de79d309d4085bf186058fe1 ] + +MT8183_NUM_ZONES should be set to 1 +because MT8183 doesn't have multiple banks. + +Fixes: a4ffe6b52d27 ("thermal: mediatek: add support for MT8183") +Signed-off-by: Michael Kao +Signed-off-by: Hsin-Yi Wang +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/20200323121537.22697-6-michael.kao@mediatek.com +Signed-off-by: Sasha Levin +--- + drivers/thermal/mtk_thermal.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c +index acf4854cbb8b8..d6fabd0a7da69 100644 +--- a/drivers/thermal/mtk_thermal.c ++++ b/drivers/thermal/mtk_thermal.c +@@ -211,6 +211,9 @@ enum { + /* The total number of temperature sensors in the MT8183 */ + #define MT8183_NUM_SENSORS 6 + ++/* The number of banks in the MT8183 */ ++#define MT8183_NUM_ZONES 1 ++ + /* The number of sensing points per bank */ + #define MT8183_NUM_SENSORS_PER_ZONE 6 + +@@ -498,7 +501,7 @@ static const struct mtk_thermal_data mt7622_thermal_data = { + + static const struct mtk_thermal_data mt8183_thermal_data = { + .auxadc_channel = MT8183_TEMP_AUXADC_CHANNEL, +- .num_banks = MT8183_NUM_SENSORS_PER_ZONE, ++ .num_banks = MT8183_NUM_ZONES, + .num_sensors = MT8183_NUM_SENSORS, + .vts_index = mt8183_vts_index, + .cali_val = MT8183_CALIBRATION, +-- +2.25.1 + diff --git a/queue-5.4/thermal-drivers-rcar_gen3-fix-undefined-temperature-.patch b/queue-5.4/thermal-drivers-rcar_gen3-fix-undefined-temperature-.patch new file mode 100644 index 00000000000..e463925ec3e --- /dev/null +++ b/queue-5.4/thermal-drivers-rcar_gen3-fix-undefined-temperature-.patch @@ -0,0 +1,55 @@ +From 98ea39ed3e99238d827471eb79a2f89465efaa52 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jun 2020 20:38:19 +0900 +Subject: thermal/drivers/rcar_gen3: Fix undefined temperature if negative + +From: Dien Pham + +[ Upstream commit 5f8f06425a0dcdad7bedbb77e67f5c65ab4dacfc ] + +As description for DIV_ROUND_CLOSEST in file include/linux/kernel.h. + "Result is undefined for negative divisors if the dividend variable + type is unsigned and for negative dividends if the divisor variable + type is unsigned." + +In current code, the FIXPT_DIV uses DIV_ROUND_CLOSEST but has not +checked sign of divisor before using. It makes undefined temperature +value in case the value is negative. + +This patch fixes to satisfy DIV_ROUND_CLOSEST description +and fix bug too. Note that the variable name "reg" is not good +because it should be the same type as rcar_gen3_thermal_read(). +However, it's better to rename the "reg" in a further patch as +cleanup. + +Signed-off-by: Van Do +Signed-off-by: Dien Pham +[shimoda: minor fixes, add Fixes tag] +Fixes: 564e73d283af ("thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver") +Signed-off-by: Yoshihiro Shimoda +Reviewed-by: Niklas Soderlund +Tested-by: Niklas Soderlund +Reviewed-by: Amit Kucheria +Signed-off-by: Daniel Lezcano +Link: https://lore.kernel.org/r/1593085099-2057-1-git-send-email-yoshihiro.shimoda.uh@renesas.com +Signed-off-by: Sasha Levin +--- + drivers/thermal/rcar_gen3_thermal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c +index 755d2b5bd2c2b..1ab2ffff4e7c7 100644 +--- a/drivers/thermal/rcar_gen3_thermal.c ++++ b/drivers/thermal/rcar_gen3_thermal.c +@@ -169,7 +169,7 @@ static int rcar_gen3_thermal_get_temp(void *devdata, int *temp) + { + struct rcar_gen3_thermal_tsc *tsc = devdata; + int mcelsius, val; +- u32 reg; ++ int reg; + + /* Read register and convert to mili Celsius */ + reg = rcar_gen3_thermal_read(tsc, REG_GEN3_TEMP) & CTEMP_MASK; +-- +2.25.1 + diff --git a/queue-5.4/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch b/queue-5.4/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch new file mode 100644 index 00000000000..3aef0a5fa96 --- /dev/null +++ b/queue-5.4/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch @@ -0,0 +1,36 @@ +From 9ca2580612cb57bdab7dcc223cf9fa6ef54bfded Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 15 Jun 2020 12:14:59 +0800 +Subject: virtio-blk: free vblk-vqs in error path of virtblk_probe() + +From: Hou Tao + +[ Upstream commit e7eea44eefbdd5f0345a0a8b80a3ca1c21030d06 ] + +Else there will be memory leak if alloc_disk() fails. + +Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device") +Signed-off-by: Hou Tao +Reviewed-by: Stefano Garzarella +Reviewed-by: Ming Lei +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/virtio_blk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c +index 0cf2fe2902307..c1de270046bfe 100644 +--- a/drivers/block/virtio_blk.c ++++ b/drivers/block/virtio_blk.c +@@ -990,6 +990,7 @@ static int virtblk_probe(struct virtio_device *vdev) + put_disk(vblk->disk); + out_free_vq: + vdev->config->del_vqs(vdev); ++ kfree(vblk->vqs); + out_free_vblk: + kfree(vblk); + out_free_index: +-- +2.25.1 +