[LU-6877] Potential integer overflow in osc_shrink_grant and osc_shrink_grant_to_target Created: 19/Jul/15  Updated: 30/Jan/22

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: Yang Sheng
Resolution: Unresolved Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Currently a low priority because I don't think we allow grants to go up over 2 or 4 G, here's the potential one:

static int osc_shrink_grant(struct client_obd *cli)
...
__u64 target_bytes...
...
        if (cli->cl_avail_grant <= target_bytes)
                target_bytes = cli->cl_max_pages_per_rpc << PAGE_CACHE_SHIFT;
...

cli->cl_max_pages_per_rpc is a 32 bit type, so result of the shift is also 32 bit and the overflow could happen.

Same bug in the osc_shrink_grant_to_target a few lines below.



 Comments   
Comment by Gerrit Updater [ 26/Feb/16 ]

Yang Sheng (yang.sheng@intel.com) uploaded a new patch: http://review.whamcloud.com/18682
Subject: LU-6877 osc: expand cl_max_pages_per_rpc to 64bit.
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 1a3ce0322085c7901e2b8caff0ac41b773abddd7

Generated at Sat Feb 10 02:04:03 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.