Skip to contentSkip to conversation

It needs to check offset array is NULL or not in async_xor_offs

PATCH In review Xiao Ni 3 participants 3 messages May 28, 2021 – Jun 1, 2021

Subsystems (3)
lore
Share & tools
lore

Xiao Ni

author
#0 lore raw

PATCH 1/1 It needs to check offset array is NULL or not in async_xor_offs

Now we support sharing one big page when PAGE_SIZE is not equal 4096. 4096 bytes is the default stripe size. To support this it adds a page offset array in raid5_percpu's scribble. It passes the page offset array to async_xor_offs. But there are some users that don't use the page offset array. In raid5-ppl.c, async_xor passes NULL to asynx_xor_offs. So it needs to check src_offs is NULL or not.

Fixes ceaf2966ab08(async_xor: increase src_offs when dropping destination page)
---
 crypto/async_tx/async_xor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/async_tx/async_xor.c +2 -1
index 6cd7f70..d8a9152 100644
@@ -233,7 +233,8 @@ async_xor_offs(struct page *dest, unsigned int offset,
 		if (submit->flags & ASYNC_TX_XOR_DROP_DST) {
 			src_cnt--;
 			src_list++;
-			src_offs++;
+			if (src_offs)
+				src_offs++;
 		}
 
 		/* wait for any prerequisite operations */
Signature · 1 line
2.7.5
maintainer
#1 lore raw
Quoted 11 lines · Xiao Ni

Now we support sharing one big page when PAGE_SIZE is not equal 4096. 4096 bytes is the default stripe size. To support this it adds a page offset array in raid5_percpu's scribble. It passes the page offset array to async_xor_offs. But there are some users that don't use the page offset array. In raid5-ppl.c, async_xor passes NULL to asynx_xor_offs. So it needs to check src_offs is NULL or not.

Fixes ceaf2966ab08(async_xor: increase src_offs when dropping destination page)

Oleksandr,

Could you please verify this fixes the issue, and reply with your Tested-by?

Thanks,
Song

Quoted 21 lines
---
 crypto/async_tx/async_xor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/async_tx/async_xor.c +2 -2
index 6cd7f70..d8a9152 100644
@@ -233,7 +233,8 @@ async_xor_offs(struct page *dest, unsigned int offset,
                if (submit->flags & ASYNC_TX_XOR_DROP_DST) {
                        src_cnt--;
                        src_list++;
-                       src_offs++;
+                       if (src_offs)
+                               src_offs++;
                }
 
                /* wait for any prerequisite operations */
--

2.7.5

#2 lore raw
Quoted 13 lines · Song Liu
Quoted 11 lines · Xiao Ni

Now we support sharing one big page when PAGE_SIZE is not equal 4096. 4096 bytes is the default stripe size. To support this it adds a page offset array in raid5_percpu's scribble. It passes the page offset array to async_xor_offs. But there are some users that don't use the page offset array. In raid5-ppl.c, async_xor passes NULL to asynx_xor_offs. So it needs to check src_offs is NULL or not.

Fixes ceaf2966ab08(async_xor: increase src_offs when dropping destination page)
Quoted 7 lines

Oleksandr,

Could you please verify this fixes the issue, and reply with your Tested-by?

Thanks,
Song

I can confirm that this patch fixes a NULL pointer dereference issue for me. Thanks for the fix!

Quoted 17 lines
Quoted 17 lines
---
  crypto/async_tx/async_xor.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
crypto/async_tx/async_xor.c +2 -1
index 6cd7f70..d8a9152 100644
@@ -233,7 +233,8 @@ async_xor_offs(struct page *dest, unsigned int offset,
                 if (submit->flags & ASYNC_TX_XOR_DROP_DST) {
                         src_cnt--;
                         src_list++;
-                       src_offs++;
+                       if (src_offs)
+                               src_offs++;
                 }
 
Quoted 4 lines
Quoted 4 lines
crypto/async_tx/async_xor.c +0 -1
                 /* wait for any prerequisite operations */
--

2.7.5

Regards,
Oleksandr Shchirskyi